From f85fb61db25e46f25bbab5e9cd524a90d71baa6d Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 02 七月 2025 19:42:27 +0800
Subject: [PATCH] 130 子 【战斗】战斗系统 / 【战斗】战斗系统-客户端 飘血 配置优化

---
 Assets/fastConfig.txt                      |   48 ++++++++++++++++
 Assets/Editor/ConfigGen/ConfigGenerater.cs |   84 ++++++++++++++++++++++++++--
 Assets/fastConfig.txt.meta                 |    7 ++
 Assets/Editor/Tool/WindowTool.cs           |   10 +++
 4 files changed, 143 insertions(+), 6 deletions(-)

diff --git a/Assets/Editor/ConfigGen/ConfigGenerater.cs b/Assets/Editor/ConfigGen/ConfigGenerater.cs
index 20238f9..12fce6b 100644
--- a/Assets/Editor/ConfigGen/ConfigGenerater.cs
+++ b/Assets/Editor/ConfigGen/ConfigGenerater.cs
@@ -18,8 +18,59 @@
     
     private static List<string> ExcludeClassList = new List<string>()
     {
+        //  鐗规畩琛ㄦ牸
         "InitialFunctionConfig",
         "PriorLanguageConfig",
+
+        //  姝e父璇诲彇灏忎簬5ms鐨勮〃 浣跨敤lazyload
+        "AppointItemConfig",
+        "AudioConfig",
+        "ChatBubbleBoxConfig",
+        "ChestsConfig",
+        "CTGSelectItemConfig",
+        "DailyLivenessRewardConfig",
+        "DailyQuestConfig",
+        "DailyQuestOpenTimeConfig",
+        "DienstgradConfig",
+        "DirtyNameConfig",
+        "EffectConfig",
+        "EmojiPackConfig",
+        "EquipPlaceMapConfig",
+        "FamilyConfig",
+        "FamilyEmblemConfig",
+        "FirstGoldConfig",
+        "FrameAnimationConfig",
+        "FuncConfigConfig",
+        "FuncOpenLVConfig",
+        "FunctionTeamSetConfig",
+        "GetItemWaysConfig",
+        "GmCmdConfig",
+        "GuideConfig",
+        "HeroAwakeConfig",
+        "HeroBreakConfig",
+        "HeroConfig",
+        "HeroFetterConfig",
+        "HeroQualityAwakeConfig",
+        "HeroQualityBreakConfig",
+        "HeroQualityConfig",
+        "HeroSkinConfig",
+        "HeroTalentConfig",
+        "IconConfig",
+        "ItemConfig",
+        "KickOutReasonConfig",
+        "LanguageConfig",
+        "MailConfig",
+        "PlayerFaceConfig",
+        "PlayerFacePicConfig",
+        "PlayerPropertyConfig",
+        "priorbundleConfig",
+        "RealmConfig",
+        "RealmLVUPTaskConfig",
+        "RichTextMsgReplaceConfig",
+        "RuleConfig",
+        "SkillConfig",
+        "TaskConfig",
+        "TreasureCntAwardConfig",
     };
 
     [MenuItem("Tools/鎵嬪姩鍒锋柊")]
@@ -186,10 +237,28 @@
             }
             sb.AppendLine("        };");
             sb.AppendLine();
+            sb.AppendLine("#if UNITY_EDITOR");
+            sb.AppendLine("        List<string> fastName = new List<string>();");
+            sb.AppendLine("#endif");
+
+
             sb.AppendLine("        // 閫愪釜鍔犺浇閰嶇疆骞舵洿鏂拌繘搴�");
             sb.AppendLine("        for (int i = 0; i < configTypes.Length; i++)");
             sb.AppendLine("        {");
+            sb.AppendLine("            var sw = System.Diagnostics.Stopwatch.StartNew();");
             sb.AppendLine("            await LoadConfigByType(configTypes[i]);");
+            sb.AppendLine("            sw.Stop();");
+            sb.AppendLine("#if UNITY_EDITOR");
+            sb.AppendLine("            if (sw.ElapsedMilliseconds >= 100)");
+            sb.AppendLine("            {");
+            sb.AppendLine("                Debug.LogError($\"鍔犺浇閰嶇疆 {configTypes[i].Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms\");");
+            sb.AppendLine("            }");
+            sb.AppendLine("            else if (sw.ElapsedMilliseconds <= 5)");
+            sb.AppendLine("            {");
+            sb.AppendLine("                fastName.Add(configTypes[i].Name);");
+            sb.AppendLine("            }");
+            sb.AppendLine("            Debug.Log($\"鍔犺浇閰嶇疆: {configTypes[i].Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms\");");
+            sb.AppendLine("#endif");
             sb.AppendLine("            loadingProgress = (float)(i + 1) / totalConfigs;");
             sb.AppendLine("        }");
         }
@@ -198,6 +267,9 @@
             Debug.LogError("娌℃湁鎵惧埌閰嶇疆绫� : " + configClasses.Count);
         }
         
+        sb.AppendLine("#if UNITY_EDITOR");
+        sb.AppendLine("        System.IO.File.WriteAllText(Application.dataPath + \"/fastConfig.txt\", string.Join(\"\\n\", fastName));");
+        sb.AppendLine("#endif");
         sb.AppendLine();
         sb.AppendLine("        // 鍔犺浇瀹屾垚鍚庤缃甶sLoadFinished涓簍rue");
         sb.AppendLine("        loadingProgress = 1f;");
@@ -213,10 +285,10 @@
         sb.AppendLine("        {");
         sb.AppendLine("            configName = configName.Substring(0, configName.Length - 6);");
         sb.AppendLine("        }");
-        sb.AppendLine("        TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>(\"Config\", configName);");
-        sb.AppendLine("        if (textAsset != null)");
+        sb.AppendLine("        string[] texts = ResManager.Instance.LoadConfig(configName);");
+        sb.AppendLine("        if (texts != null)");
         sb.AppendLine("        {");
-        sb.AppendLine("            string[] lines = textAsset.text.Split('\\n');");
+        sb.AppendLine("            string[] lines = texts;");
         sb.AppendLine("            var methodInfo = configType.GetMethod(\"Init\", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);");
         sb.AppendLine("            if (methodInfo != null)");
         sb.AppendLine("            {");
@@ -246,10 +318,10 @@
         sb.AppendLine("    {");
         sb.AppendLine("        string configName = typeof(T).Name;");
         sb.AppendLine();
-        sb.AppendLine("        TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>(\"Config\", configName);");
-        sb.AppendLine("        if (textAsset != null)");
+        sb.AppendLine("        string[] texts = ResManager.Instance.LoadConfig(configName);");
+        sb.AppendLine("        if (texts != null)");
         sb.AppendLine("        {");
-        sb.AppendLine("            string[] lines = textAsset.text.Split('\\n');");
+        sb.AppendLine("            string[] lines = texts;");
         sb.AppendLine("            var methodInfo = typeof(T).GetMethod(\"Init\", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);");
         sb.AppendLine("            if (methodInfo != null)");
         sb.AppendLine("            {");
diff --git a/Assets/Editor/Tool/WindowTool.cs b/Assets/Editor/Tool/WindowTool.cs
index d274c69..7cc3384 100644
--- a/Assets/Editor/Tool/WindowTool.cs
+++ b/Assets/Editor/Tool/WindowTool.cs
@@ -66,6 +66,16 @@
             // 鍏抽棴绐楀彛閫昏緫
             UIManager.Instance.CloseWindow(windowName);
         }
+        if (GUILayout.Button("鍏抽棴鎵�鏈夌獥鍙e啀鎵撳紑BattleWin"))
+        {
+            foreach (var win in uiNameList)
+            {
+                UIManager.Instance.CloseWindow(win);
+            }
+
+            UIManager.Instance.OpenWindow("BattleWin");
+        }
+
         EditorGUILayout.EndHorizontal();
     }
 }
\ No newline at end of file
diff --git a/Assets/fastConfig.txt b/Assets/fastConfig.txt
new file mode 100644
index 0000000..db949cd
--- /dev/null
+++ b/Assets/fastConfig.txt
@@ -0,0 +1,48 @@
+AppointItemConfig
+AudioConfig
+ChatBubbleBoxConfig
+ChestsConfig
+CTGSelectItemConfig
+DailyLivenessRewardConfig
+DailyQuestConfig
+DailyQuestOpenTimeConfig
+DienstgradConfig
+DirtyNameConfig
+EffectConfig
+EmojiPackConfig
+EquipPlaceMapConfig
+FamilyConfig
+FamilyEmblemConfig
+FirstGoldConfig
+FrameAnimationConfig
+FuncConfigConfig
+FuncOpenLVConfig
+FunctionTeamSetConfig
+GetItemWaysConfig
+GmCmdConfig
+GuideConfig
+HeroAwakeConfig
+HeroBreakConfig
+HeroConfig
+HeroFetterConfig
+HeroQualityAwakeConfig
+HeroQualityBreakConfig
+HeroQualityConfig
+HeroSkinConfig
+HeroTalentConfig
+IconConfig
+ItemConfig
+KickOutReasonConfig
+LanguageConfig
+MailConfig
+PlayerFaceConfig
+PlayerFacePicConfig
+PlayerPropertyConfig
+priorbundleConfig
+RealmConfig
+RealmLVUPTaskConfig
+RichTextMsgReplaceConfig
+RuleConfig
+SkillConfig
+TaskConfig
+TreasureCntAwardConfig
\ No newline at end of file
diff --git a/Assets/fastConfig.txt.meta b/Assets/fastConfig.txt.meta
new file mode 100644
index 0000000..9e61a60
--- /dev/null
+++ b/Assets/fastConfig.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 7b3f592d4b2538c4fab144f9e7e31202
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

--
Gitblit v1.8.0