using Framework.Utils; using StateSystem; using UnityEditor; using UnityEngine; namespace System { /// /// 游戏入口 /// public class GameSetup : MonoBehaviour { private void Awake() { #if DebugLog DebugLogTrigger.Instance.StartLog(); #endif #if UNITY_EDITOR DontDestroyOnLoad (this.gameObject); return; #endif GameStateManager.Instance.Active(StateSystem.GameGlobalState.GameBegin); } #if UNITY_EDITOR [UnityEditor.InitializeOnLoadMethod] static void InitializeOnLoadMethod() { 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 () { CameraEffectUtils.Instance.SetGameCamBlur (0 , 0 , null , BlurEffectType.Blur); return true; } #endif } }