GameApp Shutdown

This commit is contained in:
ALEXTANG
2024-05-08 10:06:33 +08:00
parent f016fdd0a6
commit c707cc1a38
2 changed files with 5 additions and 2 deletions

View File

@@ -46,6 +46,7 @@ public partial class GameApp:Singleton<GameApp>
/// <param name="shutdownType">关闭游戏框架类型。</param> /// <param name="shutdownType">关闭游戏框架类型。</param>
public static void Shutdown(ShutdownType shutdownType) public static void Shutdown(ShutdownType shutdownType)
{ {
Log.Info("GameApp Shutdown");
if (shutdownType == ShutdownType.None) if (shutdownType == ShutdownType.None)
{ {
return; return;
@@ -128,6 +129,7 @@ public partial class GameApp:Singleton<GameApp>
var logic = listLogic[i]; var logic = listLogic[i];
logic.OnDestroy(); logic.OnDestroy();
} }
Shutdown(ShutdownType.Restart);
} }
private void OnDrawGizmos() private void OnDrawGizmos()

View File

@@ -266,7 +266,7 @@ namespace TEngine
{ {
if (_behaviour != null) if (_behaviour != null)
{ {
_behaviour.Release(); _behaviour.Shutdown();
} }
if (_entity != null) if (_entity != null)
{ {
@@ -392,8 +392,9 @@ namespace TEngine
OnApplicationPauseEvent -= fun; OnApplicationPauseEvent -= fun;
} }
public void Release() internal void Shutdown()
{ {
DestroyEvent?.Invoke();
UpdateEvent = null; UpdateEvent = null;
FixedUpdateEvent = null; FixedUpdateEvent = null;
LateUpdateEvent = null; LateUpdateEvent = null;