From 3bd7f56906e31e8fe0072108c9d4652707b51de8 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 21 十月 2025 17:59:00 +0800
Subject: [PATCH] 125 战斗 战斗UI

---
 Main/Config/ConfigBase.cs |   82 ++++++++++++++++++++++-------------------
 1 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index 36addb8..14a45c5 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);
     }
 
@@ -78,35 +81,38 @@
 
     public static void Init(string[] lines)
     {
-        m_dic.Clear();
+        if (isInit)
+        {
+            return;
+        }
 
         for (int i = 3; i < lines.Length; i++)
-        {
-            string line = lines[i];
-            var index = line.IndexOf("\t");
-            if (index == -1)
             {
-                continue;
-            }
+                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();
+                string strKey = line.Substring(0, index);
+                T config = new T();
+                U key = config.LoadKey(strKey);
+                config.LoadConfig(line);
+                config.OnConfigParseCompleted();
 #if UNITY_EDITOR
-            try
-            {
+                try
+                {
 #endif
-                m_dic.Add(key, config);
+                    m_dic.Add(key, config);
 #if UNITY_EDITOR
-            }
-            catch (ArgumentException exception)
-            {
-                Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
-            }
+                }
+                catch (ArgumentException exception)
+                {
+                    Debug.LogError(typeof(T).Name + " 閲嶅鐨刱ey " + key + " " + exception.Message);
+                }
 #endif
-        }
+            }
 
         foreach (var cfg in m_dic.Values)
         {

--
Gitblit v1.8.0