【日志】由内网控制日志

main
刘涛 2026-04-07 19:33:49 +08:00
parent 92d6c478ca
commit e3e8dc5a2d
2 changed files with 28 additions and 3 deletions

View File

@ -4,6 +4,8 @@ using PhxhSDK.AOT.Aspect;
using PhxhSDK.Reference; using PhxhSDK.Reference;
using System; using System;
using System.Reflection; using System.Reflection;
using Cysharp.Threading.Tasks;
using PhxhSDK.AOT.Net;
using UnityEngine; using UnityEngine;
namespace Gameplay namespace Gameplay
@ -66,22 +68,45 @@ namespace Gameplay
{ {
} }
private void Start() private async UniTask _DynamicEnableLog()
{ {
if (InformationShower.Instance != null)
{
// 先默认关闭
InformationShower.Instance.enabled = false;
}
// 默认关闭 // 默认关闭
var shouldEnableDebug = false; var shouldEnableDebug = false;
#if DEBUG || DEVELOPMENT_BUILD #if DEBUG || DEVELOPMENT_BUILD || UNITY_EDITOR
shouldEnableDebug = true; shouldEnableDebug = true;
#endif #endif
if (!shouldEnableDebug)
{
// 不开启的时候, 如果在内网环境则强行开启
if (await NetChecker.CheckIsInsideNet())
{
shouldEnableDebug = true;
}
}
Debug.Log("[Debug] Debug log enabled: " + shouldEnableDebug); Debug.Log("[Debug] Debug log enabled: " + shouldEnableDebug);
Debug.unityLogger.logEnabled = shouldEnableDebug; Debug.unityLogger.logEnabled = shouldEnableDebug;
DebugUtil.LogEnable = shouldEnableDebug; DebugUtil.LogEnable = shouldEnableDebug;
// 同步控制FPS显示
if (InformationShower.Instance != null) if (InformationShower.Instance != null)
{ {
InformationShower.Instance.enabled = shouldEnableDebug; InformationShower.Instance.enabled = shouldEnableDebug;
} }
}
private void Start()
{
_DynamicEnableLog();
_lastSecondUpdate = Time.time; _lastSecondUpdate = Time.time;
_lastTenthSecondUpdate = Time.time; _lastTenthSecondUpdate = Time.time;

@ -1 +1 @@
Subproject commit 02904eb6e075af9d684964c609d8be644b6a01cd Subproject commit e7fbb88c88ba7587de0103d4daec0812fe6e28bf