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 | 94 +++++++++++++++++++++++++++++------------------
1 files changed, 58 insertions(+), 36 deletions(-)
diff --git a/Main/System/Debug/DebugUtility.cs b/Main/System/Debug/DebugUtility.cs
index 01feb3f..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>
@@ -38,59 +39,80 @@
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();
+
}
- public void CreateDebugRoot()
+ public async UniTask CreateDebugRoot()
{
if (debugRoot == null)
{
- var prefab = BuiltInLoader.LoadPrefab("UIRootDebug");
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRootDebug");
+ debugRoot = GameObject.Instantiate(prefab);
+ MonoBehaviour.DontDestroyOnLoad(debugRoot);
+ debugRoot.name = "UIRootDebug";
+ }
+ }
+
+ public async UniTask CreateDebugRootAsync()
+ {
+ if (debugRoot == null)
+ {
+ var prefab = await BuiltInLoader.LoadPrefabAsync("UIRootDebug");
debugRoot = GameObject.Instantiate(prefab);
MonoBehaviour.DontDestroyOnLoad(debugRoot);
debugRoot.name = "UIRootDebug";
--
Gitblit v1.8.0