From f4c97339a01fdd75d8b862be572eefe66bd51d5a Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 16 五月 2025 19:18:21 +0800
Subject: [PATCH] update

---
 Main/Manager/ConfigManager.cs |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/Main/Manager/ConfigManager.cs b/Main/Manager/ConfigManager.cs
index 61d235e..09e54f0 100644
--- a/Main/Manager/ConfigManager.cs
+++ b/Main/Manager/ConfigManager.cs
@@ -3,6 +3,7 @@
 using UnityEngine;
 using Cysharp.Threading.Tasks;
 using System.Reflection;
+using System.IO;
 
 
 public class ConfigManager : ManagerBase<ConfigManager>
@@ -57,10 +58,10 @@
         {
             configName = configName.Substring(0, configName.Length - 6);
         }
-        TextAsset textAsset = await ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
-        if (textAsset != null)
+        string texts = await Load(configName);
+        if (!string.IsNullOrEmpty(texts))
         {
-            string[] lines = textAsset.text.Split('\n');
+            string[] lines = texts.Split('\n');
             var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
             if (methodInfo != null)
             {
@@ -80,7 +81,7 @@
         }
         else
         {
-            Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
+            Debug.LogError($"{configName} 鍐呭涓虹┖鎴栧姞杞藉け璐�");
         }
     }
 
@@ -88,10 +89,10 @@
     {
         string configName = typeof(T).Name;
 
-        TextAsset textAsset = await ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
-        if (textAsset != null)
+        string texts = await Load(configName);
+        if (!string.IsNullOrEmpty(texts))
         {
-            string[] lines = textAsset.text.Split('\n');
+            string[] lines = texts.Split('\n');
             var methodInfo = typeof(T).GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
             if (methodInfo != null)
             {
@@ -111,7 +112,7 @@
         }
         else
         {
-            Debug.LogError($"鎵句笉鍒伴厤缃枃浠�: {configName}");
+            Debug.LogError($"{configName} 鍐呭涓虹┖鎴栧姞杞藉け璐�");
         }
     }
 
@@ -130,6 +131,23 @@
         }
     }
 
+    public static async UniTask<string> Load(string configName)
+    {
+		var path = string.Empty;
+        if (AssetSource.refdataFromEditor)
+        {
+            path = ResourcesPath.CONFIG_FODLER + $"/{configName}.txt";
+        }
+        else
+        {
+            path = AssetVersionUtility.GetAssetFilePath($"config/{configName}.txt");
+        }
+
+        string texts = await File.ReadAllTextAsync(path);
+
+        return texts;
+    }
+
     public override void Release()
     {
         // 娓呯┖ FamilyConfig 瀛楀吀

--
Gitblit v1.8.0