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 | 51 +++++++++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index 36addb8..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);
}
@@ -78,7 +81,10 @@
public static void Init(string[] lines)
{
- m_dic.Clear();
+ if (isInit)
+ {
+ return;
+ }
for (int i = 3; i < lines.Length; i++)
{
@@ -108,10 +114,11 @@
#endif
}
- foreach (var cfg in m_dic.Values)
- {
- cfg.AllConfigLoadFinish();
- }
+
+ // foreach (var cfg in m_dic.Values)
+ // {
+ // cfg.AllConfigLoadFinish();
+ // }
isInit = true;
}
--
Gitblit v1.8.0