update 主程序逻辑

This commit is contained in:
2024-10-19 16:46:07 +08:00
parent 71484ea988
commit 7badf4a6af
5 changed files with 36 additions and 11 deletions

View File

@@ -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 ()