You've already forked taptap2024_GJ_chidouren
update 主程序逻辑
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Framework.Utils;
|
||||
using StateSystem;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace System
|
||||
@@ -24,8 +25,19 @@ namespace System
|
||||
[UnityEditor.InitializeOnLoadMethod]
|
||||
static void InitializeOnLoadMethod()
|
||||
{
|
||||
UnityEditor.EditorApplication.wantsToQuit -= OnExit;
|
||||
UnityEditor.EditorApplication.wantsToQuit += OnExit;
|
||||
UnityEditor.EditorApplication.playModeStateChanged -= OnPlaying;
|
||||
UnityEditor.EditorApplication.playModeStateChanged += OnPlaying;
|
||||
UnityEditor.EditorApplication.wantsToQuit -= OnExit;
|
||||
UnityEditor.EditorApplication.wantsToQuit += OnExit;
|
||||
}
|
||||
|
||||
//当编辑器运行时
|
||||
static void OnPlaying (PlayModeStateChange stateChange)
|
||||
{
|
||||
if (stateChange == PlayModeStateChange.EnteredPlayMode)
|
||||
{
|
||||
GameStateManager.Instance.Active(StateSystem.GameGlobalState.GameBegin);
|
||||
}
|
||||
}
|
||||
|
||||
static bool OnExit ()
|
||||
|
||||
@@ -47,8 +47,19 @@ namespace StateSystem.State
|
||||
// return;
|
||||
//初始化资源管理器,并挂载AlwaysRes下的所有资源
|
||||
AssetManager.Instance.Rouse ();
|
||||
this._sceneLoader = new SceneLoader (SceneName.InitScene, true);
|
||||
this._sceneLoader.BeginLoad (null, ManagerInit);
|
||||
#if UNITY_EDITOR
|
||||
ManagerInit ();
|
||||
return;
|
||||
#endif
|
||||
if (SceneManager.GetActiveScene ().name != SceneName.InitScene.ToString ())
|
||||
{
|
||||
this._sceneLoader = new SceneLoader (SceneName.InitScene, true);
|
||||
this._sceneLoader.BeginLoad (null, ManagerInit);
|
||||
}
|
||||
else
|
||||
{
|
||||
ManagerInit ();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
@@ -127,7 +138,8 @@ namespace StateSystem.State
|
||||
{
|
||||
GameUpdateMgr.Instance.CreateTimer (1f , () =>
|
||||
{
|
||||
this.stateMachineRunner.OpenState (GameGlobalState.GameLogin);
|
||||
BeginStaticPanel.ReleasePanel ();
|
||||
this.stateMachineRunner.OpenState (GameGlobalState.GameRoom);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,9 @@ namespace StateSystem.State
|
||||
Debug.Log ("Asset pre load " + AssetManager.ResRootPath + "AutoSource/");
|
||||
AssetManager.Instance.LoadAssets<Object>(AssetManager.ResRootPath + "AutoSource/");
|
||||
PoolObjectPreload ();
|
||||
GameManager.Instance.StartAutoSave ();
|
||||
LoadScene ();
|
||||
// GameManager.Instance.StartAutoSave ();
|
||||
// LoadScene ();
|
||||
OnActived ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user