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/ClientVersion/VersionConfig.cs |   60 +++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/Main/System/ClientVersion/VersionConfig.cs b/Main/System/ClientVersion/VersionConfig.cs
index 2053938..d4d949a 100644
--- a/Main/System/ClientVersion/VersionConfig.cs
+++ b/Main/System/ClientVersion/VersionConfig.cs
@@ -3,6 +3,8 @@
 using UnityEngine;
 using System.IO;
 using LitJson;
+using Cysharp.Threading.Tasks;
+
 
 #if UNITY_EDITOR
 using UnityEditor;
@@ -12,6 +14,7 @@
 
 public class VersionConfig : ScriptableObject
 {
+
     public const string VERSION_ALTERNATIVE = "1.0.0";
 
     [SerializeField] public string m_AppId = string.Empty;
@@ -32,11 +35,12 @@
     {
         get
         {
-            if (!string.IsNullOrEmpty(SDKUtils.Yj_SpID))
-            {
-                return SDKUtils.Yj_SpID;
-            }
-            return m_SpID;
+            //鏆備笖鍚屾appid 鐩墠娌℃湁鍒嗗紑鐨勯渶姹�
+            // if (!string.IsNullOrEmpty(SDKUtils.Yj_SpID))
+            // {
+            //     return SDKUtils.Yj_SpID;
+            // }
+            return m_AppId;
         }
     }
 
@@ -72,15 +76,7 @@
         {
             if (string.IsNullOrEmpty(m_GameId))
             {
-                var gameText = Resources.Load<TextAsset>("Game");
-                if (gameText != null)
-                {
-                    m_GameId = gameText.text;
-                }
-                else
-                {
-                    m_GameId = "xbqy";
-                }
+                Debug.LogError("VersionConfig gameId is empty, do getasync first");
             }
 
             return m_GameId;
@@ -199,14 +195,13 @@
         }
     }
 
-    static VersionConfig config = null;
-    public static VersionConfig Get()
+    public static async UniTask<VersionConfig> GetAsync()
     {
         if (config == null)
         {
             if (Application.isEditor)
             {
-                config = Resources.Load<VersionConfig>("VersionConfig");
+                config = await Resources.LoadAsync<VersionConfig>("VersionConfig") as VersionConfig;
                 //debug鐧诲綍鍚庣浜屾鍚姩榛樿鎭㈠test
                 if (LocalSave.GetBool("RestoreTest"))
                 {
@@ -214,20 +209,43 @@
                     LocalSave.SetBool("RestoreTest", false);
                     Debug.Log("appid 鎭㈠test");
                 }
-
             }
             else
             {
-                var text = Resources.Load<TextAsset>("VersionConfigEx");
-                if (text != null)
+                var textAsset = await Resources.LoadAsync<TextAsset>("VersionConfigEx") as TextAsset;
+                if (textAsset != null)
                 {
                     config = ScriptableObject.CreateInstance<VersionConfig>();
-                    var json = JsonMapper.ToObject(text.text);
+                    var json = JsonMapper.ToObject(textAsset.text);
                     ReadJson(json);  //閫愪竴瑙f瀽锛屼笉鐢╒ersionConfig绫荤粨鏋勮鍙栵紝鍥犱负鍙橀噺瀹氫箟鏄寜asset鐨勭粨鏋勫畾涔夌殑
+                }
+                else
+                {
+                    Debug.LogError("[VersionConfig] VersionConfigEx not found, falling back to VersionConfig asset");
+                    config = await Resources.LoadAsync<VersionConfig>("VersionConfig") as VersionConfig;
                 }
             }
         }
 
+        if (string.IsNullOrEmpty(config.m_GameId))
+        {
+            var gameText = await Resources.LoadAsync<TextAsset>("Game") as TextAsset;
+            if (gameText != null)
+            {
+                config.m_GameId = gameText.text;
+            }
+            else
+            {
+                config.m_GameId = "xssg";
+            }
+        }
+
+        return config;
+    }
+
+    public static VersionConfig config = null;
+    public static VersionConfig Get()
+    {
         return config;
     }
 

--
Gitblit v1.8.0