diff --git a/Assets/GameRes/Scenes/InitScene.unity b/Assets/GameRes/Scenes/InitScene.unity index a4341d1..792a28d 100644 --- a/Assets/GameRes/Scenes/InitScene.unity +++ b/Assets/GameRes/Scenes/InitScene.unity @@ -1084,7 +1084,7 @@ MonoBehaviour: m_Priority: 10 m_StandbyUpdate: 2 m_LookAt: {fileID: 0} - m_Follow: {fileID: 0} + m_Follow: {fileID: 355335390} m_Lens: FieldOfView: 60 OrthographicSize: 5 @@ -1805,7 +1805,7 @@ Transform: m_GameObject: {fileID: 1575124293} serializedVersion: 2 m_LocalRotation: {x: 0.00000001560446, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -2.31, y: -4.3899984, z: -12} + m_LocalPosition: {x: -2.31, y: -4.389999, z: -12} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Assets/Resources/BeginStaticPanel.prefab b/Assets/Resources/BeginStaticPanel.prefab index a083fa3..c422122 100644 --- a/Assets/Resources/BeginStaticPanel.prefab +++ b/Assets/Resources/BeginStaticPanel.prefab @@ -1367,8 +1367,8 @@ Camera: m_GameObject: {fileID: 3177260320638737075} m_Enabled: 1 serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 diff --git a/Assets/Scripts/System/GameSetup.cs b/Assets/Scripts/System/GameSetup.cs index 4a459f0..491d9c7 100644 --- a/Assets/Scripts/System/GameSetup.cs +++ b/Assets/Scripts/System/GameSetup.cs @@ -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 () diff --git a/Assets/Scripts/System/StateSystem/State/StateInit.cs b/Assets/Scripts/System/StateSystem/State/StateInit.cs index 25346c6..f7b8660 100644 --- a/Assets/Scripts/System/StateSystem/State/StateInit.cs +++ b/Assets/Scripts/System/StateSystem/State/StateInit.cs @@ -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); }); } } diff --git a/Assets/Scripts/System/StateSystem/State/StateRoom.cs b/Assets/Scripts/System/StateSystem/State/StateRoom.cs index e7d4aeb..7f9579d 100644 --- a/Assets/Scripts/System/StateSystem/State/StateRoom.cs +++ b/Assets/Scripts/System/StateSystem/State/StateRoom.cs @@ -29,8 +29,9 @@ namespace StateSystem.State Debug.Log ("Asset pre load " + AssetManager.ResRootPath + "AutoSource/"); AssetManager.Instance.LoadAssets(AssetManager.ResRootPath + "AutoSource/"); PoolObjectPreload (); - GameManager.Instance.StartAutoSave (); - LoadScene (); + // GameManager.Instance.StartAutoSave (); + // LoadScene (); + OnActived (); }