From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts

---
 Main/Config/ConfigBase.cs |   93 ++++++++++++++++++++++++----------------------
 1 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index 93f9299..e51fef1 100644
--- a/Main/Config/ConfigBase.cs
+++ b/Main/Config/ConfigBase.cs
@@ -7,13 +7,27 @@
 
 public class ConfigBase<U, T> where T : ConfigBase<U, T>, new()
 {
+    /// <summary>
+    /// 鏄惁璁块棶杩囬潤鎬佹瀯閫犲嚱鏁�
+    /// </summary>
+    public static bool visit = false;
+
+    static ConfigBase()
+    {
+        if (isInit)
+        {
+            return;
+        }
+
+        LazyInit();
+    }
+
     private static Dictionary<U, T> m_dic = new Dictionary<U, T>();
 
     public static Dictionary<U, T> dic
     {
         get
         {
-            LazyInit();
             return m_dic;
         }
     }
@@ -22,8 +36,6 @@
 
     public static T Get(U id)
     {
-        LazyInit();
-
         if (m_dic.ContainsKey(id))
         {
             return m_dic[id];
@@ -32,20 +44,14 @@
         return null;
     }
 
-    public static void ForceRelease()
-    {
-        m_dic.Clear();
-        isInit = false;
-    }
-
-    public static void ForceInit()
-    {
-        ConfigManager.Instance.LoadConfigByType(typeof(T));
-    }
+    // public static void ForceRelease()
+    // {
+    //     m_dic.Clear();
+    //     isInit = false;
+    // }
 
     public static List<U> GetKeys()
     {
-        LazyInit();
         List<U> result = new List<U>();
         result.AddRange(m_dic.Keys);
         return result;
@@ -54,7 +60,6 @@
 
     public static List<T> GetValues()
     {
-        LazyInit();
         List<T> result = new List<T>();
         result.AddRange(m_dic.Values);
         return result;
@@ -62,8 +67,6 @@
 
     public static bool HasKey(U key)
     {
-        LazyInit();
-
         return m_dic.ContainsKey(key);
     }
 
@@ -80,43 +83,43 @@
     {
         if (isInit)
         {
-            Debug.LogError("閲嶅鍔犺浇琛ㄦ牸  绫诲瀷 " + typeof(T).Name);
             return;
         }
 
         for (int i = 3; i < lines.Length; i++)
+        {
+            string line = lines[i];
+            var index = line.IndexOf("\t");
+            if (index == -1)
             {
-                string line = lines[i];
-                var index = line.IndexOf("\t");
-                if (index == -1)
-                {
-                    continue;
-                }
-
-                string strKey = line.Substring(0, index);
-                T config = new T();
-                U key = config.LoadKey(strKey);
-                config.LoadConfig(line);
-                config.OnConfigParseCompleted();
-#if UNITY_EDITOR
-                try
-                {
-#endif
-                    m_dic.Add(key, config);
-#if UNITY_EDITOR
-                }
-                catch (ArgumentException exception)
-                {
-                    Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
-                }
-#endif
+                continue;
             }
 
-        foreach (var cfg in m_dic.Values)
-        {
-            cfg.AllConfigLoadFinish();
+            string strKey = line.Substring(0, index);
+            T config = new T();
+            U key = config.LoadKey(strKey);
+            config.LoadConfig(line);
+            config.OnConfigParseCompleted();
+#if UNITY_EDITOR
+            try
+            {
+#endif
+                m_dic.Add(key, config);
+#if UNITY_EDITOR
+            }
+            catch (ArgumentException exception)
+            {
+                Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
+            }
+#endif
         }
 
+        
+        // foreach (var cfg in m_dic.Values)
+        // {
+        //     cfg.AllConfigLoadFinish();
+        // }
+
         isInit = true;
     }
 

--
Gitblit v1.8.0