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

@@ -1084,7 +1084,7 @@ MonoBehaviour:
m_Priority: 10 m_Priority: 10
m_StandbyUpdate: 2 m_StandbyUpdate: 2
m_LookAt: {fileID: 0} m_LookAt: {fileID: 0}
m_Follow: {fileID: 0} m_Follow: {fileID: 355335390}
m_Lens: m_Lens:
FieldOfView: 60 FieldOfView: 60
OrthographicSize: 5 OrthographicSize: 5
@@ -1805,7 +1805,7 @@ Transform:
m_GameObject: {fileID: 1575124293} m_GameObject: {fileID: 1575124293}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.00000001560446, y: -0, z: -0, w: 1} 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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:

View File

@@ -1367,8 +1367,8 @@ Camera:
m_GameObject: {fileID: 3177260320638737075} m_GameObject: {fileID: 3177260320638737075}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2 m_GateFitMode: 2
m_FOVAxisMode: 0 m_FOVAxisMode: 0

View File

@@ -1,5 +1,6 @@
using Framework.Utils; using Framework.Utils;
using StateSystem; using StateSystem;
using UnityEditor;
using UnityEngine; using UnityEngine;
namespace System namespace System
@@ -24,8 +25,19 @@ namespace System
[UnityEditor.InitializeOnLoadMethod] [UnityEditor.InitializeOnLoadMethod]
static void InitializeOnLoadMethod() static void InitializeOnLoadMethod()
{ {
UnityEditor.EditorApplication.wantsToQuit -= OnExit; UnityEditor.EditorApplication.playModeStateChanged -= OnPlaying;
UnityEditor.EditorApplication.wantsToQuit += OnExit; 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 () static bool OnExit ()

View File

@@ -47,8 +47,19 @@ namespace StateSystem.State
// return; // return;
//初始化资源管理器并挂载AlwaysRes下的所有资源 //初始化资源管理器并挂载AlwaysRes下的所有资源
AssetManager.Instance.Rouse (); AssetManager.Instance.Rouse ();
this._sceneLoader = new SceneLoader (SceneName.InitScene, true); #if UNITY_EDITOR
this._sceneLoader.BeginLoad (null, ManagerInit); 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 () protected override void OnExit ()
@@ -127,7 +138,8 @@ namespace StateSystem.State
{ {
GameUpdateMgr.Instance.CreateTimer (1f , () => GameUpdateMgr.Instance.CreateTimer (1f , () =>
{ {
this.stateMachineRunner.OpenState (GameGlobalState.GameLogin); BeginStaticPanel.ReleasePanel ();
this.stateMachineRunner.OpenState (GameGlobalState.GameRoom);
}); });
} }
} }

View File

@@ -29,8 +29,9 @@ namespace StateSystem.State
Debug.Log ("Asset pre load " + AssetManager.ResRootPath + "AutoSource/"); Debug.Log ("Asset pre load " + AssetManager.ResRootPath + "AutoSource/");
AssetManager.Instance.LoadAssets<Object>(AssetManager.ResRootPath + "AutoSource/"); AssetManager.Instance.LoadAssets<Object>(AssetManager.ResRootPath + "AutoSource/");
PoolObjectPreload (); PoolObjectPreload ();
GameManager.Instance.StartAutoSave (); // GameManager.Instance.StartAutoSave ();
LoadScene (); // LoadScene ();
OnActived ();
} }