From bf838c34902a0cd12d89c718801a3b2446ad3a45 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 01 八月 2025 16:59:23 +0800
Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建 配置新增静态构造 即访问即加载
---
Main/Config/ConfigBase.cs | 22 +++++++++-------------
Main/Core/GameEngine/Launch/LaunchInHot.cs | 10 +++++-----
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/Main/Config/ConfigBase.cs b/Main/Config/ConfigBase.cs
index 93f9299..6c9806c 100644
--- a/Main/Config/ConfigBase.cs
+++ b/Main/Config/ConfigBase.cs
@@ -7,13 +7,21 @@
public class ConfigBase<U, T> where T : ConfigBase<U, T>, new()
{
+ 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 +30,6 @@
public static T Get(U id)
{
- LazyInit();
-
if (m_dic.ContainsKey(id))
{
return m_dic[id];
@@ -38,14 +44,8 @@
isInit = false;
}
- public static void ForceInit()
- {
- ConfigManager.Instance.LoadConfigByType(typeof(T));
- }
-
public static List<U> GetKeys()
{
- LazyInit();
List<U> result = new List<U>();
result.AddRange(m_dic.Keys);
return result;
@@ -54,7 +54,6 @@
public static List<T> GetValues()
{
- LazyInit();
List<T> result = new List<T>();
result.AddRange(m_dic.Values);
return result;
@@ -62,8 +61,6 @@
public static bool HasKey(U key)
{
- LazyInit();
-
return m_dic.ContainsKey(key);
}
@@ -80,7 +77,6 @@
{
if (isInit)
{
- Debug.LogError("閲嶅鍔犺浇琛ㄦ牸 绫诲瀷 " + typeof(T).Name);
return;
}
diff --git a/Main/Core/GameEngine/Launch/LaunchInHot.cs b/Main/Core/GameEngine/Launch/LaunchInHot.cs
index db9c737..1356eee 100644
--- a/Main/Core/GameEngine/Launch/LaunchInHot.cs
+++ b/Main/Core/GameEngine/Launch/LaunchInHot.cs
@@ -28,11 +28,11 @@
InitSystemMgr();
- SDKUtils.Instance.Init(); //鍘焥dk鎺ュ彛
-
- // 杩欓噷杩樻病寮�濮嬪姞杞介厤缃� 浣嗘槸鎻愬墠鍔犺浇浜嗕緵LaunchWin浣跨敤
- PriorLanguageConfig.ForceInit();
- InitialFunctionConfig.ForceInit();
+ SDKUtils.Instance.Init(); //鍘焥dk鎺ュ彛
+
+ // 杩欓噷杩樻病寮�濮嬪姞杞介厤缃� 浣嗘槸鎻愬墠鍔犺浇浜嗕緵LaunchWin浣跨敤
+ PriorLanguageConfig.LazyInit();
+ InitialFunctionConfig.LazyInit();
UIManager.Instance.OpenWindow<LaunchWin>();
--
Gitblit v1.8.0