From 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 11 五月 2026 16:20:37 +0800
Subject: [PATCH] Merge branch 'master' into h5version
---
Main/System/Debug/DebugUtility.cs | 208 ++++++++++++++++------------------------------------
1 files changed, 64 insertions(+), 144 deletions(-)
diff --git a/Main/System/Debug/DebugUtility.cs b/Main/System/Debug/DebugUtility.cs
index 1170615..67551b2 100644
--- a/Main/System/Debug/DebugUtility.cs
+++ b/Main/System/Debug/DebugUtility.cs
@@ -4,6 +4,7 @@
using LitJson;
using System.IO;
using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
public class DebugUtility : Singleton<DebugUtility>
@@ -12,7 +13,7 @@
GameObject debugRoot;
bool m_DebugAccount = false;
- public bool debugAccount
+ public bool debugAccount // 鏄惁寮�鍚痙ebug妯″紡
{
get { return m_DebugAccount; }
private set
@@ -20,185 +21,104 @@
if (m_DebugAccount != value)
{
m_DebugAccount = value;
- if (m_DebugAccount)
- {
- RunTimeExceptionUtility.Instance.Init();
- }
+ // if (m_DebugAccount)
+ // {
+ // RunTimeExceptionUtility.Instance.Init();
+ // }
}
}
}
public int debugBranch = -1;
-
+ //鏈嶅姟绔缃櫧鍚嶅崟锛�1.鍙墦寮�debug妯″紡 2. 鍙彁鍓嶇櫥褰曠淮鎶ゆ湇锛涚己鐐归渶瑕佽繍缁翠汉鍛橀厤鍚堜絾瀹夊叏
+ //鍏朵粬鍙傝��: 瀹㈡埛绔嚜宸辫缃殑debug妯″紡锛屽鍔燿ebug鏂囦欢锛涚己鐐癸細ios鏃犳硶鎿嶄綔
+ // 鑱婂ぉ璁剧疆鍒嗘敮鍚屾椂浼氬紑鍚痙ebug妯″紡锛屼紭鐐癸細浠讳綍鎯呭喌涓嬪彲浠ョ嫭绔嬫搷浣滐紝涓嶅畨鍏ㄤ絾鏃犲疄璐ㄦ�у奖鍝�
public bool isWhiteListAccount { get; set; }
- public bool autoLogin { get; private set; }
public void Init()
{
isWhiteListAccount = false;
- if (VersionConfig.Get().debugVersion)
+ VersionConfig.GetAsync().ContinueWith(config =>
{
- debugAccount = true;
- }
- else
- {
- var parentDirectory = Directory.GetParent(Application.persistentDataPath);
- debugAccount = File.Exists(parentDirectory + "/Debug");
- }
-
- if (LocalSave.GetString("#@#BrancH") != string.Empty)
- {
- var branch = LocalSave.GetString("#@#BrancH");
- int tmpbranch;
- int.TryParse(LocalSave.GetString("#@#BrancH").Substring(1), out tmpbranch);
- if (branch.StartsWith("d") && tmpbranch != 0)
+ if (config != null && config.debugVersion)
{
- debugBranch = tmpbranch;
debugAccount = true;
}
- else if (branch.StartsWith("r") && tmpbranch != 0)
+ else
{
- debugBranch = tmpbranch;
- debugAccount = false;
- }
- }
-
- if (debugAccount)
- {
- if (Application.isMobilePlatform)
- {
+#if !UNITY_WEBGL
var parentDirectory = Directory.GetParent(Application.persistentDataPath);
- if (File.Exists(parentDirectory + "/Debug"))
+ debugAccount = File.Exists(parentDirectory + "/Debug");
+#else
+ debugAccount = false;
+#endif
+ }
+
+ if (LocalSave.GetString("#@#BrancH") != string.Empty)
+ {
+ var branch = LocalSave.GetString("#@#BrancH");
+ int tmpbranch;
+ int.TryParse(LocalSave.GetString("#@#BrancH").Substring(1), out tmpbranch);
+ if (branch.StartsWith("d") && tmpbranch != 0)
{
- var content = File.ReadAllText(parentDirectory + "/Debug");
- if (!string.IsNullOrEmpty(content))
- {
- var json = JsonMapper.ToObject<DebugBranch>(File.ReadAllText(parentDirectory + "/Debug"));
- debugBranch = json.branch;
- }
+ debugBranch = tmpbranch;
+ debugAccount = true;
+ }
+ else if (branch.StartsWith("r") && tmpbranch != 0)
+ {
+ debugBranch = tmpbranch;
+ debugAccount = false;
}
}
- }
+
+ if (debugAccount)
+ {
+#if !UNITY_WEBGL
+ if (Application.isMobilePlatform)
+ {
+ var parentDirectory = Directory.GetParent(Application.persistentDataPath);
+ if (File.Exists(parentDirectory + "/Debug"))
+ {
+ var content = File.ReadAllText(parentDirectory + "/Debug");
+ if (!string.IsNullOrEmpty(content))
+ {
+ var json = JsonMapper.ToObject<DebugBranch>(File.ReadAllText(parentDirectory + "/Debug"));
+ debugBranch = json.branch;
+ }
+ }
+ }
+#endif
+ }
+ }).Forget();
+
-
-
- if (debugAccount)
- {
- Launch.Instance.EnableLog = LocalSave.GetBool("DesignEnableLog", true);
- Launch.Instance.EnableLogWarning = LocalSave.GetBool("DesignEnableLogWarning", true);
- Launch.Instance.EnableLogError = LocalSave.GetBool("DesignEnableLogError", true);
- Launch.Instance.EnableNetLog = false;
- }
- else
- {
- Launch.Instance.EnableLog = false;
- Launch.Instance.EnableLogWarning = false;
- Launch.Instance.EnableLogError = false;
- Launch.Instance.EnableNetLog = false;
- }
-
- autoLogin = Resources.Load<TextAsset>("AutoLogin") != null;
- if (autoLogin)
- {
- var update = new LogicUpdate(3f);
- update.Start(OnAutoLoginUpdate);
- }
}
- private void OnAutoLoginUpdate()
- {
- // TODO YYL
- // if (StageLoad.Instance.currentStage is LoginStage)
- // {
- // var loginWin = WindowCenter.Instance.Get<LoginWin>();
- // if (loginWin != null)
- // {
- // var accountIpf = loginWin.transform.FindComponent("InputField", "Container_Account/AccountInput");
- // if (accountIpf != null)
- // {
- // (accountIpf as InputField).text = StringUtility.Contact("Test_", UnityEngine.Random.Range(10000, 99999));
- // }
- // var enterGame = loginWin.transform.FindComponent("Button", "Container_EnterGame/LoginButton");
- // (enterGame as Button).onClick.Invoke();
- // }
- // }
-
-
- // if (StageLoad.Instance.currentStage is CreateRoleStage)
- // {
- // var win = WindowCenter.Instance.Get<CreateRoleWin>();
- // if (win != null)
- // {
- // var enterGame = win.transform.FindComponent("Button", "Container_Right/Btn_CreateRole");
- // if (enterGame is Button)
- // {
- // (enterGame as Button).onClick.Invoke();
- // }
- // }
- // }
- }
-
- public void CreateDebugRoot()
+ public async UniTask CreateDebugRoot()
{
if (debugRoot == null)
{
- // var prefab = BuiltInLoader.LoadPrefab("UIRootDebug");
- // debugRoot = GameObject.Instantiate(prefab);
- // MonoBehaviour.DontDestroyOnLoad(debugRoot);
- // debugRoot.name = "UIRootDebug";
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRootDebug");
+ debugRoot = GameObject.Instantiate(prefab);
+ MonoBehaviour.DontDestroyOnLoad(debugRoot);
+ debugRoot.name = "UIRootDebug";
}
}
- public void RequestWhiteListAuthority(string _account)
+ public async UniTask CreateDebugRootAsync()
{
- //isWhiteListAccount = false;
- //var tables = new Dictionary<string, string>();
- //tables["channel"] = VersionConfig.Get().appId;
- //tables["player"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account;
- //tables["game"] = VersionConfig.Get().gameId;
-
- //HttpRequest.Instance.RequestHttpGet(StringUtility.Contact(url, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType, 1, OnDebugAuthority);
- }
-
- private void OnDebugAuthority(bool _ok, string _result)
- {
- if (_ok)
+ if (debugRoot == null)
{
- var debugAuthority = JsonMapper.ToObject<DebugAuthority>(_result);
- isWhiteListAccount = debugAuthority.dbg == 1;
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRootDebug");
+ debugRoot = GameObject.Instantiate(prefab);
+ MonoBehaviour.DontDestroyOnLoad(debugRoot);
+ debugRoot.name = "UIRootDebug";
}
}
- public static void SetLogAble(bool _able)
- {
- LocalSave.SetBool("DesignEnableLog", _able);
- Launch.Instance.EnableLog = _able;
- }
-
- public static void SetLogWarningAble(bool _able)
- {
- LocalSave.SetBool("DesignEnableLogWarning", _able);
- Launch.Instance.EnableLogWarning = _able;
- }
-
- public static void SetLogErrorAble(bool _able)
- {
- LocalSave.SetBool("DesignEnableLogError", _able);
- Launch.Instance.EnableLogError = _able;
- }
-
- public static void SetLogNetAble(bool _able)
- {
- Launch.Instance.EnableNetLog = _able;
- }
-
- struct DebugAuthority
- {
- public int dbg;
- }
public class DebugBranch
{
--
Gitblit v1.8.0