mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
框架支持Shudown不关闭游戏重启
框架支持Shudown不关闭游戏重启
This commit is contained in:
@@ -23,6 +23,7 @@ namespace GameMain
|
||||
m_btnClear = FindChildComponent<Button>("TopNode/m_btnClear");
|
||||
m_textAppid = FindChildComponent<Text>("TopNode/m_textAppid");
|
||||
m_textResid = FindChildComponent<Text>("TopNode/m_textResid");
|
||||
m_scrollbarProgress = FindChildComponent<Scrollbar>("m_scrollbarProgress");
|
||||
m_btnClear.onClick.AddListener(OnClickClearBtn);
|
||||
}
|
||||
#endregion
|
||||
@@ -30,7 +31,6 @@ namespace GameMain
|
||||
public override void OnCreate()
|
||||
{
|
||||
base.OnCreate();
|
||||
m_scrollbarProgress = FindChildComponent<Scrollbar>("m_scrollbarProgress");
|
||||
LoadUpdateLogic.Instance.DownloadCompleteAction += DownLoad_Complete_Action;
|
||||
LoadUpdateLogic.Instance.DownProgressAction += DownLoad_Progress_Action;
|
||||
LoadUpdateLogic.Instance.UnpackedCompleteAction += Unpacked_Complete_Action;
|
||||
@@ -118,12 +118,12 @@ namespace GameMain
|
||||
m_scrollbarProgress.size = progress;
|
||||
}
|
||||
|
||||
protected override void Close()
|
||||
public override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
OnStop(null);
|
||||
LoadUpdateLogic.Instance.DownloadCompleteAction -= DownLoad_Complete_Action;
|
||||
LoadUpdateLogic.Instance.DownProgressAction -= DownLoad_Progress_Action;
|
||||
base.Close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -395,7 +395,7 @@ namespace TEngine
|
||||
DrawDebuggerWindowGroup(subDebuggerWindowGroup);
|
||||
}
|
||||
|
||||
debuggerWindowGroup.SelectedWindow.OnDraw();
|
||||
debuggerWindowGroup?.SelectedWindow?.OnDraw();
|
||||
}
|
||||
|
||||
private void DrawDebuggerWindowIcon(int windowId)
|
||||
|
@@ -11,18 +11,29 @@ namespace TEngine
|
||||
{
|
||||
private static readonly Dictionary<Type, Module> _moduleMaps = new Dictionary<Type, Module>(ModuleImpSystem.DesignModuleCount);
|
||||
|
||||
private static GameObject _gameModuleRoot;
|
||||
|
||||
#region 框架模块
|
||||
/// <summary>
|
||||
/// 获取游戏基础模块。
|
||||
/// </summary>
|
||||
public static RootModule Base => _base ??= Get<RootModule>();
|
||||
public static RootModule Base
|
||||
{
|
||||
get => _base ??= Get<RootModule>();
|
||||
private set => _base = value;
|
||||
}
|
||||
|
||||
private static RootModule _base;
|
||||
|
||||
/// <summary>
|
||||
/// 获取调试模块。
|
||||
/// </summary>
|
||||
public static DebuggerModule Debugger => _debugger ??= Get<DebuggerModule>();
|
||||
public static DebuggerModule Debugger
|
||||
{
|
||||
get => _debugger ??= Get<DebuggerModule>();
|
||||
private set => _debugger = value;
|
||||
}
|
||||
|
||||
|
||||
private static DebuggerModule _debugger;
|
||||
|
||||
@@ -117,7 +128,31 @@ namespace TEngine
|
||||
{
|
||||
Log.Info("GameModule Active");
|
||||
gameObject.name = $"[{nameof(GameModule)}]";
|
||||
_gameModuleRoot = gameObject;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
public static void Shutdown(ShutdownType shutdownType)
|
||||
{
|
||||
Log.Info("GameModule Shutdown");
|
||||
if (_gameModuleRoot != null)
|
||||
{
|
||||
Destroy(_gameModuleRoot);
|
||||
_gameModuleRoot = null;
|
||||
}
|
||||
_moduleMaps.Clear();
|
||||
|
||||
_base = null;
|
||||
_debugger = null;
|
||||
_fsm = null;
|
||||
_procedure = null;
|
||||
_objectPool = null;
|
||||
_resource = null;
|
||||
_audio = null;
|
||||
_setting = null;
|
||||
_ui = null;
|
||||
_localization = null;
|
||||
_scene = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -84,9 +84,10 @@ namespace TEngine
|
||||
rootModule.Shutdown();
|
||||
rootModule = null;
|
||||
}
|
||||
|
||||
_modules.Clear();
|
||||
|
||||
GameModule.Shutdown(shutdownType);
|
||||
|
||||
if (shutdownType == ShutdownType.None)
|
||||
{
|
||||
return;
|
||||
|
@@ -101,6 +101,10 @@ namespace TEngine
|
||||
_errorLogger = null;
|
||||
}
|
||||
CloseAll();
|
||||
if (m_InstanceRoot != null && m_InstanceRoot.parent != null)
|
||||
{
|
||||
Destroy(m_InstanceRoot.parent.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
#region 设置安全区域
|
||||
|
Reference in New Issue
Block a user