【启动流程】增加详细阶段日志
parent
1a506e01d0
commit
8fb2cd2423
|
|
@ -27,33 +27,43 @@ namespace Gameplay
|
|||
|
||||
private void _InitGame()
|
||||
{
|
||||
|
||||
Type type = Type.GetType(GAME_TYPE_NAME);
|
||||
var type = Type.GetType(GAME_TYPE_NAME);
|
||||
if (null == type)
|
||||
{
|
||||
Debug.LogError($"{GAME_TYPE_NAME} Type found");
|
||||
Debug.LogError($"[Main: _InitGame] {GAME_TYPE_NAME} Type found");
|
||||
return;
|
||||
}
|
||||
DebugUtil.Log($"[Main: _InitGame] {GAME_TYPE_NAME} Type found, start creating instance");
|
||||
|
||||
_game = Activator.CreateInstance(type) as BaseGame;
|
||||
if (_game == null)
|
||||
{
|
||||
DebugUtil.LogError("PhxhSDK.Main: no game instance created");
|
||||
DebugUtil.LogError("[Main: _InitGame] PhxhSDK.Main: no game instance created");
|
||||
return;
|
||||
}
|
||||
DebugUtil.Log($"[Main: _InitGame] {GAME_TYPE_NAME} instance created successfully: {_game.GetType().FullName}");
|
||||
|
||||
SDKManager.GetSingleton().Init();
|
||||
DebugUtil.Log("[Main: _InitGame] SDKManager:Init 完成");
|
||||
|
||||
_game.Init();
|
||||
DebugUtil.Log("[Main: _InitGame] Game:Init 完成");
|
||||
|
||||
_game.Start();
|
||||
DebugUtil.Log("[Main: _InitGame] Game:Start 完成");
|
||||
}
|
||||
|
||||
private async void _InitAsync()
|
||||
private async UniTask _InitAsync()
|
||||
{
|
||||
DebugUtil.Log("[Main: _InitAsync] 开始异步初始化");
|
||||
isInited = false;
|
||||
#if USE_YOO
|
||||
await YooAssetHelper.Init();
|
||||
DebugUtil.Log("[Main: _InitAsync] 资源系统初始化完成");
|
||||
#endif
|
||||
isInited = true;
|
||||
_InitGame();
|
||||
DebugUtil.Log("[Main: _InitAsync] 游戏初始化完成");
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
|
|
@ -69,7 +79,7 @@ namespace Gameplay
|
|||
|
||||
private async UniTask _DynamicEnableLog()
|
||||
{
|
||||
|
||||
Debug.Log("[Main:_DynamicEnableLog] 开始动态设置日志");
|
||||
if (InformationShower.Instance != null)
|
||||
{
|
||||
// 先默认关闭
|
||||
|
|
@ -81,6 +91,8 @@ namespace Gameplay
|
|||
#if DEBUG || DEVELOPMENT_BUILD || UNITY_EDITOR
|
||||
shouldEnableDebug = true;
|
||||
#endif
|
||||
|
||||
Debug.Log("[Main:_DynamicEnableLog] 初始日志开关: " + shouldEnableDebug);
|
||||
|
||||
if (!shouldEnableDebug)
|
||||
{
|
||||
|
|
@ -88,29 +100,33 @@ namespace Gameplay
|
|||
if (await NetChecker.CheckIsInsideNet())
|
||||
{
|
||||
shouldEnableDebug = true;
|
||||
Debug.Log("[Main:_DynamicEnableLog] 检测到内网环境, 强制开启日志");
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[Debug] Debug log enabled: " + shouldEnableDebug);
|
||||
Debug.Log("[Main:_DynamicEnableLog] 日志开关状态: " + shouldEnableDebug);
|
||||
Debug.unityLogger.logEnabled = shouldEnableDebug;
|
||||
DebugUtil.LogEnable = shouldEnableDebug;
|
||||
|
||||
Debug.Log("[Main:_DynamicEnableLog] 日志开关已设置: " + shouldEnableDebug);
|
||||
|
||||
// 同步控制FPS显示
|
||||
if (InformationShower.Instance != null)
|
||||
{
|
||||
InformationShower.Instance.enabled = shouldEnableDebug;
|
||||
Debug.Log("[Main:_DynamicEnableLog] FPS信息展示组件状态: " + shouldEnableDebug);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_DynamicEnableLog();
|
||||
|
||||
_DynamicEnableLog().Forget();
|
||||
|
||||
_lastSecondUpdate = Time.time;
|
||||
_lastTenthSecondUpdate = Time.time;
|
||||
_lastTenSecondsUpdate = Time.time;
|
||||
_InitAsync();
|
||||
|
||||
_InitAsync().Forget();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
|
|||
Loading…
Reference in New Issue