You've already forked taptap2024_GJ_chidouren
init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI;
|
||||
using StateSystem;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
namespace System.StateSystem.State
|
||||
{
|
||||
public class StateCertification : StateMachine<GameGlobalState>
|
||||
{
|
||||
// 是否启用时长限制功能
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public bool useTimeLimit = true;
|
||||
|
||||
// 是否启用消费限制功能
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public bool usePaymentLimit = true;
|
||||
|
||||
// 是否显示切换账号按钮
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public bool showSwitchAccount = true;
|
||||
|
||||
#pragma warning disable CS1998
|
||||
protected override async void OnEnter(params object[] args)
|
||||
#pragma warning restore CS1998
|
||||
{
|
||||
EnterGame();
|
||||
return;
|
||||
#if UNITY_EDITOR || DisCertification
|
||||
Debug.Log("实名认证模块{模拟完成,跳过实名认证}");
|
||||
EnterGame();
|
||||
#else
|
||||
// // AnalysisEventMgr.Instance.EventLog("certification" , new KeyValuePair<string, object>("channel" , GameGlobalConfig.Instance.Channel));
|
||||
// string gameIdentifier = GameGlobalConfig.Instance.TapClientId;
|
||||
// AntiAddictionConfig config = new AntiAddictionConfig()
|
||||
// {
|
||||
// gameId = GameGlobalConfig.Instance.TapClientId, // TapTap 开发者中心对应 Client ID
|
||||
// showSwitchAccount = this.showSwitchAccount, // 是否显示切换账号按钮
|
||||
// };
|
||||
// AntiAddictionUIKit.Init(config, OnCertiffication);
|
||||
// #if UNITY_EDITOR
|
||||
// TapTap.AntiAddiction.TapTapAntiAddictionManager.AntiAddictionConfig.gameId = gameIdentifier;
|
||||
// #endif
|
||||
// string userIdentifier = Account.Instance.UserID;
|
||||
// if (Account.Instance.IsLogin)
|
||||
// {
|
||||
// AntiAddictionUIKit.Startup( userIdentifier , true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AntiAddictionUIKit.Startup(userIdentifier, false);
|
||||
// }
|
||||
// this.EnterGame();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OnCertiffication (int code, string errorMsg)
|
||||
{
|
||||
if (code == 500)
|
||||
{
|
||||
EnterGame ();
|
||||
}
|
||||
else if (code == 9002)
|
||||
{
|
||||
// MessageBox.CloseAll ();
|
||||
// var messageBox = MessageBox.Show ("错误", "无法通过实名认证! 进入游戏失败!" , "确认" , null);
|
||||
// messageBox.onComplete = id =>
|
||||
// {
|
||||
// GameManager.Instance.ExitGame ();
|
||||
// };
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
BeginStaticPanel.ReleasePanel ();
|
||||
}
|
||||
|
||||
protected void EnterGame()
|
||||
{
|
||||
this.stateMachineRunner.OpenState(GameGlobalState.GameHome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 884191d459ae43269f0cdef59335d1e7
|
||||
timeCreated: 1675139129
|
||||
91
Assets/Scripts/System/StateSystem/State/StateCheckAsset.cs
Normal file
91
Assets/Scripts/System/StateSystem/State/StateCheckAsset.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.StateSystem;
|
||||
using AssetLoader;
|
||||
using Framework.FSMLite;
|
||||
using UniFramework.Event;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateCheckAsset : StateMachine<GameGlobalState>
|
||||
{
|
||||
private Uri remotePath;
|
||||
private bool sMandatory;
|
||||
private EPlayMode ePlayMode;
|
||||
|
||||
|
||||
protected override void OnEnter (params object[] args)
|
||||
{
|
||||
Debug.Log ("开始资源检查!");
|
||||
remotePath = new Uri ((string) args[0]);
|
||||
Debug.Log ( "remotePath: " + remotePath);
|
||||
sMandatory = GameGlobalConfig.Instance.IsMandatory;
|
||||
ePlayMode = GameGlobalConfig.Instance.IsCheckNetAsset ? EPlayMode.HostPlayMode : EPlayMode.OfflinePlayMode;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// if (ePlayMode != EPlayMode.HostPlayMode)
|
||||
{
|
||||
if (GameGlobalConfig.Instance.IsNativeAssets)
|
||||
{
|
||||
if (GameGlobalConfig.Instance.IsCheckNetAsset)
|
||||
{
|
||||
ePlayMode = EPlayMode.HostPlayMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
ePlayMode = EPlayMode.OfflinePlayMode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ePlayMode = EPlayMode.EditorSimulateMode;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
GameManager.Instance.StartCoroutine (InitAsset ());
|
||||
}
|
||||
|
||||
private IEnumerator InitAsset ()
|
||||
{
|
||||
// 初始化事件系统
|
||||
UniEvent.Initalize ();
|
||||
|
||||
// 初始化资源系统
|
||||
YooAssets.Initialize ();
|
||||
|
||||
yield return new WaitForSeconds (0.1f);
|
||||
|
||||
// 创建资源包裹类配置表
|
||||
var content
|
||||
= new AssetBundleLoader.Content (null , remotePath , "DefaultPackage" , GameManager.Instance);
|
||||
content.BuildPipeline = EDefaultBuildPipeline.BuiltinBuildPipeline;
|
||||
content.IsStrictModeUpdate = sMandatory;
|
||||
content.PlayMode = ePlayMode;
|
||||
content.ClientVersion = GameGlobalConfig.Instance.ClientBuildID.ToString ();
|
||||
// 创建资源加载器
|
||||
var loader = new AssetBundleLoader (content);
|
||||
// 创建资源加载适配器 ,与外部UI交互
|
||||
AssetLoadDrawAdapter adapter = new AssetLoadDrawAdapter (BeginStaticPanel.ShowMessage , BeginStaticPanel.ShowMessageBox);
|
||||
|
||||
adapter.OnCompleteCallBack = OnCheckComplete;
|
||||
//开始资源加载
|
||||
loader.StartLoad (adapter);
|
||||
}
|
||||
|
||||
private void OnCheckComplete ()
|
||||
{
|
||||
// 设置默认的资源包
|
||||
var gamePackage = YooAssets.GetPackage ("DefaultPackage");
|
||||
YooAssets.SetDefaultPackage (gamePackage);
|
||||
|
||||
Debug.Log ("资源检查结束");
|
||||
this.stateMachineRunner.OpenState (GameGlobalState.GameInit, true);
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd8e93c5e8a44f56a035213169a8d28d
|
||||
timeCreated: 1675139129
|
||||
23
Assets/Scripts/System/StateSystem/State/StateExit.cs
Normal file
23
Assets/Scripts/System/StateSystem/State/StateExit.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Framework.FSMLite;
|
||||
using Framework.Save;
|
||||
using UnityEngine;
|
||||
|
||||
namespace System.StateSystem.State
|
||||
{
|
||||
public class StateExit: StateMachine<GameGlobalState>
|
||||
{
|
||||
protected override void OnEnter(params object[] args)
|
||||
{
|
||||
SaveManager.Instance.Release();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#endif
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be94505d48a04d73b246abf1b8f564a0
|
||||
timeCreated: 1675234601
|
||||
33
Assets/Scripts/System/StateSystem/State/StateGameBegin.cs
Normal file
33
Assets/Scripts/System/StateSystem/State/StateGameBegin.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.StateSystem;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI.SystemUI.Script;
|
||||
using IcecreamView;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateGameBegin: StateMachine<GameGlobalState>
|
||||
{
|
||||
protected override void OnEnter(params object[] args)
|
||||
{
|
||||
// #if !UNITY_EDITOR || (SystemUITest && UNITY_EDITOR)
|
||||
// SystemUIMgr.Instance.OpenView(SystemUIMgr.GameAdvicePanel , new IC_ViewData(new Action(OnComplete)));
|
||||
// #else
|
||||
// SystemUIMgr.Instance.OpenView(SystemUIMgr.GameAdvicePanel , new IC_ViewData(new Action(OnComplete)));
|
||||
// #endif
|
||||
CameraEffectUtils.Instance.SetGameCamBlur (0 , 0 , null);
|
||||
//初始基础加载页面
|
||||
BeginStaticPanel.Create ();
|
||||
OnComplete();
|
||||
}
|
||||
|
||||
private void OnComplete()
|
||||
{
|
||||
GameStateManager.Instance.OpenState(GameGlobalState.GameAssetCheck , GameGlobalConfig.Instance.AssetRemotePath);
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 597cd6dcc6e64d72a8eaa9b1b0398758
|
||||
timeCreated: 1675139129
|
||||
67
Assets/Scripts/System/StateSystem/State/StateHome.cs
Normal file
67
Assets/Scripts/System/StateSystem/State/StateHome.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.StateSystem;
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.Timer;
|
||||
using Framework.UI;
|
||||
using StateSystem.Loader;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Views;
|
||||
using AudioType = Framework.Audio.AudioType;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateHome : StateMachine<GameGlobalState>
|
||||
{
|
||||
private SceneLoader _loader;
|
||||
|
||||
public int _lastCatLevel = -1; //记录上一次的猫的等级,用于判断是否升级
|
||||
|
||||
protected override async void OnEnter (params object[] args)
|
||||
{
|
||||
|
||||
AudioManager.Instance.PlayBGM (BgmAudio.LobbyBgm);
|
||||
GameUpdateMgr.Instance.AddUpdater (DoUpdate);
|
||||
var activeScene = SceneManager.GetActiveScene ();
|
||||
if (activeScene.name != SceneName.MainScene.ToString ())
|
||||
{
|
||||
Debug.Log ("进入Home,开始加载场景:" + SceneName.MainScene.ToString ());
|
||||
this._loader = new SceneLoader (SceneName.MainScene);
|
||||
this._loader.BeginLoad (OnLoading, OnActived);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnActived ();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoading (float obj)
|
||||
{
|
||||
Debug.Log ("加载进度: " + obj);
|
||||
if (obj >= 1)
|
||||
{
|
||||
// Debug.Log("加载完成");
|
||||
this._loader.Active ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnActived ()
|
||||
{
|
||||
UIManager.Instance.OpenView (UIPanel.HomePanel);
|
||||
UIManager.Instance.CloseLoading (null);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnExit ()
|
||||
{
|
||||
GameUpdateMgr.Instance.RemoveUpdater (DoUpdate);
|
||||
this._loader.Kill ();
|
||||
}
|
||||
|
||||
private void DoUpdate ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74da953d1ff0446aab01c36de7c568c5
|
||||
timeCreated: 1675139129
|
||||
134
Assets/Scripts/System/StateSystem/State/StateInit.cs
Normal file
134
Assets/Scripts/System/StateSystem/State/StateInit.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.AudioHandler;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Loader;
|
||||
using System.OfflineSystem;
|
||||
using System.StateSystem;
|
||||
using System.Threading.Tasks;
|
||||
using FJson;
|
||||
using Framework.Asset;
|
||||
using Framework.Audio;
|
||||
using Framework.common;
|
||||
using Framework.FSMLite;
|
||||
using Framework.GamePool.manager;
|
||||
using Framework.Save;
|
||||
using Framework.Timer;
|
||||
using Framework.UI;
|
||||
using Framework.Utils;
|
||||
using Framework.Utils.Extend;
|
||||
using Runtime.ADAggregator;
|
||||
using StateSystem.Loader;
|
||||
using TMPro;
|
||||
using ToffeeHttp.Runtime;
|
||||
using ToffeeHttp.Runtime.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Views;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateInit : StateMachine<GameGlobalState>
|
||||
{
|
||||
private SceneLoader _sceneLoader;
|
||||
protected override void OnEnter (params object[] args)
|
||||
{
|
||||
CameraEffectUtils.Instance.SetGameCamBlur(0, 0, null);
|
||||
SceneInit ();
|
||||
}
|
||||
|
||||
|
||||
private void SceneInit ()
|
||||
{
|
||||
Debug.Log ("SceneInit");
|
||||
// return;
|
||||
//初始化资源管理器,并挂载AlwaysRes下的所有资源
|
||||
AssetManager.Instance.Rouse ();
|
||||
this._sceneLoader = new SceneLoader (SceneName.InitScene, true);
|
||||
this._sceneLoader.BeginLoad (null, ManagerInit);
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
{
|
||||
// this._sceneLoader.Kill();
|
||||
}
|
||||
|
||||
protected void ManagerInit ()
|
||||
{
|
||||
BeginStaticPanel.OnMessage ("系统初始化...");
|
||||
Input.multiTouchEnabled = false;
|
||||
GameQualitySettings.SetFPS (90);
|
||||
FontLoad ();
|
||||
Debug.Log ("初始化系统模块");
|
||||
//初始化配置文件系统
|
||||
RofManagerConfig.Instance.Rouse ();
|
||||
//ui 层数据初始化
|
||||
var viewConfig = new IC_AddressabelConfig (); //使用AssetBundle资源管理
|
||||
// var viewConfig = Resources.Load<IC_Resource_ViewConfig>("Config/ViewConfig"); //使用Resource资源管理
|
||||
UIManager.Instance.AddConfig (viewConfig);
|
||||
//存储系统初始化 ,针对Game类型存档特殊处理
|
||||
var saveConfig = SaveConfig.CreateConfig (SaveManager.Instance.BaseConfig.RootPath);
|
||||
// var saveConfig = SaveConfig.CreateConfig();
|
||||
saveConfig.SetDataHandler (new SaveHandlerFileStream ());
|
||||
// saveConfig.SetDataHandler (new SaveHandlerQuickFileStream ());
|
||||
#if UNITY_EDITOR
|
||||
saveConfig.SetSerializer (new SaveSerializerJson ());
|
||||
#else
|
||||
saveConfig.SetSerializer(new SaveSerializerCommonJson());
|
||||
#endif
|
||||
SaveManager.Instance.SetConfig (SaveData.Game , saveConfig);
|
||||
|
||||
//对象池初始化
|
||||
GamePoolManager.Instance.Rouse ();
|
||||
//存档系统初始化
|
||||
Account.Instance.Rouse ();
|
||||
//提前唤醒缓动系统驱动
|
||||
MintAnimation.Core.MintDriveComponentSinge.Instance.ToString ();
|
||||
//音频管理器初始化
|
||||
AudioManager.Instance.Init (new AudioSourceHandler (AudioManager._AUDIO_Path)); //使用AssetBundle资源管理
|
||||
GameManager.Instance.ScriptRegist ();
|
||||
GameManager.Instance.Inited ();
|
||||
//激活离线奖励系统
|
||||
OfflineMgr.Instance.Rouse ();
|
||||
//初始化系统时间
|
||||
GameManager.Instance.InitSystemTime (ThirdPartyMgrInit);
|
||||
Debug.Log ("系统初始化完毕");
|
||||
}
|
||||
|
||||
private void ThirdPartyMgrInit ()
|
||||
{
|
||||
|
||||
UIManager.Instance.OpenView (UIPanel.ScreenEffectPanel);
|
||||
|
||||
AnalysisEventMgr.Instance.Rouse ();
|
||||
// var adConfig = AssetManager.Instance.LoadAsset<ADConfig>("Config/ToponAdConfig.asset");
|
||||
// var toponAdController = new ToponAdController();
|
||||
// toponAdController.SetListener(GameManager.Instance.OnAdMask , null);
|
||||
// ADManager.Instance.Init(null , Account.Instance.UserID , adConfig , toponAdController , GameGlobalConfig.Instance.Channel.ToString());
|
||||
ADManager.Instance.Init(null , Account.Instance.UserID , null , null , GameGlobalConfig.Instance.Channel.ToString());
|
||||
#if GM
|
||||
ADManager.Instance.SetTestModel();
|
||||
#endif
|
||||
Debug.Log ("三方系统初始化完毕");
|
||||
ADManager.Instance.GLOBAL_ShowAwardVideoComplete += GameManager.Instance.OnGlobalVideoAdComplete;
|
||||
OnInited ();
|
||||
}
|
||||
|
||||
private void FontLoad()
|
||||
{
|
||||
TMP_Settings.instance = AssetManager.Instance.LoadAlwaysAsset<TMP_Settings>("/FontResource/TMP Settings.asset");
|
||||
}
|
||||
|
||||
|
||||
private void OnInited ()
|
||||
{
|
||||
GameUpdateMgr.Instance.CreateTimer (1f , () =>
|
||||
{
|
||||
this.stateMachineRunner.OpenState (GameGlobalState.GameLogin);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a51b18116d344fada2c86a92bd29663f
|
||||
timeCreated: 1675139129
|
||||
74
Assets/Scripts/System/StateSystem/State/StateLoading.cs
Normal file
74
Assets/Scripts/System/StateSystem/State/StateLoading.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.StateSystem;
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.Timer;
|
||||
using Framework.UI;
|
||||
using Framework.Utils.Extend;
|
||||
using StateSystem.Loader;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
using AudioType = Framework.Audio.AudioType;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateLoading : StateMachine<GameGlobalState>
|
||||
{
|
||||
private GameGlobalState _targetGlobalState;
|
||||
private object[] _targetParams;
|
||||
private ILoader _loader;
|
||||
|
||||
protected override void OnEnter(params object[] args)
|
||||
{
|
||||
// AudioManager.Instance.StopPlayers (AudioType.BGM , 0.5f);
|
||||
// UIManager.Instance.OpenView(UIPanel.LoadingPanel);
|
||||
if (args[0] is GameGlobalState)
|
||||
{
|
||||
this._targetGlobalState = (GameGlobalState) args[0];
|
||||
GameUpdateMgr.Instance.CreateTimer((float) args[1],
|
||||
() => { this.stateMachineRunner.OpenState(this._targetGlobalState); });
|
||||
}
|
||||
else
|
||||
{
|
||||
this._loader = (ILoader) args[0];
|
||||
this._targetGlobalState = (GameGlobalState) args[1];
|
||||
// this._targetParams = args[2];
|
||||
if (args.Length > 2)
|
||||
{
|
||||
this._targetParams = new object[args.Length - 2];
|
||||
for (int i = 2; i < args.Length; i++)
|
||||
{
|
||||
this._targetParams[i - 2] = args[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._targetParams = null;
|
||||
}
|
||||
this._loader.BeginLoad(OnLoading, OnLoadComplete);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoading(float progress)
|
||||
{
|
||||
Debug.Log("加载中: " + progress);
|
||||
if (progress.Compare(1))
|
||||
{
|
||||
// GameUpdateMgr.Instance.CreateTimer(2.6f,
|
||||
// () => { UIManager.Instance.CloseView(UIPanel.LoadingPanel);});
|
||||
GameUpdateMgr.Instance.CreateTimer(2.5f,
|
||||
() => { this._loader.Active(); });
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoadComplete()
|
||||
{
|
||||
this.stateMachineRunner.OpenState(this._targetGlobalState , this._targetParams);
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 936c801f3dda4505ae5711ee7831f5e3
|
||||
timeCreated: 1675139129
|
||||
67
Assets/Scripts/System/StateSystem/State/StateLogin.cs
Normal file
67
Assets/Scripts/System/StateSystem/State/StateLogin.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.StateSystem;
|
||||
// using com.taptap.tapsdk.bindings.csharp;
|
||||
using FJson;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI;
|
||||
// using TapTap.Connect;
|
||||
// using TapTap.Moment;
|
||||
// using TapTap.Common;
|
||||
// using TapTap.Login;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateLogin : StateMachine<GameGlobalState>
|
||||
{
|
||||
#pragma warning disable CS1998
|
||||
protected override async void OnEnter(params object[] args)
|
||||
#pragma warning restore CS1998
|
||||
{
|
||||
#if UNITY_EDITOR || DisCertification
|
||||
LocalLogin ();
|
||||
// TapTapLoginCheck ();
|
||||
return;
|
||||
#endif
|
||||
LocalLogin ();
|
||||
//测试版本阶段不启用tap登录
|
||||
// TapTapLoginCheck();
|
||||
}
|
||||
|
||||
private async void TapTapLoginCheck()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
// UIManager.Instance.CloseView(UIPanel.LoginPanel);
|
||||
}
|
||||
|
||||
|
||||
public async void LoginSuccess(string openId)
|
||||
{
|
||||
//tap内嵌动态
|
||||
// TapMoment.Init(GameGlobalConfig.Instance.TapClientId);
|
||||
//tap悬浮窗
|
||||
// TapConnect.Init(GameGlobalConfig.Instance.TapClientId, GameGlobalConfig.Instance.TapToken , true);
|
||||
Debug.Log ("初始化悬浮窗");
|
||||
// TapConnect.SetEntryVisible (true);
|
||||
|
||||
// var profile = await TapLogin.Authorize ();
|
||||
var accession = openId;
|
||||
Account.Instance.SetLogin(accession, 1);
|
||||
this.stateMachineRunner.OpenState(GameGlobalState.Certification);
|
||||
}
|
||||
|
||||
public async void LocalLogin()
|
||||
{
|
||||
// await TDSUser.LoginAnonymously();
|
||||
//登录失败后走单机模式
|
||||
PlayerPrefs.SetInt("FirstTip", 1);
|
||||
Account.Instance.SetLogout();
|
||||
this.stateMachineRunner.OpenState(GameGlobalState.Certification);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26ae3d83de744321a28525c898d32083
|
||||
timeCreated: 1675139129
|
||||
84
Assets/Scripts/System/StateSystem/State/StateRoom.cs
Normal file
84
Assets/Scripts/System/StateSystem/State/StateRoom.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.StateSystem;
|
||||
using Framework.Asset;
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.GamePool.manager;
|
||||
using Framework.UI;
|
||||
using Game;
|
||||
using Game.Data;
|
||||
using Game.Manager;
|
||||
using Runtime.ADAggregator;
|
||||
using StateSystem.Loader;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Views;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace StateSystem.State
|
||||
{
|
||||
public class StateRoom : StateMachine<GameGlobalState>
|
||||
{
|
||||
public static string RoomGroup = "ROOM_OBJECT_GROUP";
|
||||
private SceneLoader _loader;
|
||||
|
||||
protected override void OnEnter(params object[] args)
|
||||
{
|
||||
ADManager.Instance.LoadAD (AD_Type.AwardVideo);
|
||||
//预加载资源
|
||||
Debug.Log ("Asset pre load " + AssetManager.ResRootPath + "AutoSource/");
|
||||
AssetManager.Instance.LoadAssets<Object>(AssetManager.ResRootPath + "AutoSource/");
|
||||
PoolObjectPreload ();
|
||||
GameManager.Instance.StartAutoSave ();
|
||||
LoadScene ();
|
||||
}
|
||||
|
||||
|
||||
private void LoadScene ()
|
||||
{
|
||||
var activeScene = SceneManager.GetActiveScene();
|
||||
if (activeScene.name != SceneName.GameScene.ToString())
|
||||
{
|
||||
Debug.Log("进入Home,开始加载场景:" + SceneName.GameScene);
|
||||
this._loader = new SceneLoader(SceneName.GameScene);
|
||||
this._loader.BeginLoad(OnLoading, OnActived);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnActived();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoading(float obj)
|
||||
{
|
||||
Debug.Log("加载进度: " + obj);
|
||||
if (obj >= 1)
|
||||
{
|
||||
// Debug.Log("加载完成");
|
||||
this._loader.Active();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnActived()
|
||||
{
|
||||
RoomManager.Instance.JoinGame ();
|
||||
}
|
||||
|
||||
private void PoolObjectPreload ()
|
||||
{
|
||||
GamePoolManager.Instance.LoadPoolObjects("UI/",RoomGroup , 5);
|
||||
GamePoolManager.Instance.LoadPoolObjects("Object/",RoomGroup , 5);
|
||||
}
|
||||
|
||||
protected override void OnExit()
|
||||
{
|
||||
UIManager.Instance.CloseViewWithGroup (RoomGroup);
|
||||
GamePoolManager.Instance.KillForGroup (RoomGroup);
|
||||
GameManager.Instance.EndAutoSave ();
|
||||
Account.Instance.Save();
|
||||
AssetManager.Instance.UnLoadAssets(AssetManager.ResRootPath + "AutoSource/" , false);
|
||||
SpriteLoaderMgr.Instance.Clear ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83fd4c3d0778423fa5c00d01c2fac452
|
||||
timeCreated: 1675139129
|
||||
Reference in New Issue
Block a user