From 136be959f92596c5717d2642c9fcbb51501fe005 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 11 五月 2026 16:09:33 +0800
Subject: [PATCH] WEBGL跟安卓混合开发 资源加载异步

---
 Assets/Editor/ConfigGen/ConfigGenerater.cs |  400 +++++++++-----------------------------------------------
 1 files changed, 66 insertions(+), 334 deletions(-)

diff --git a/Assets/Editor/ConfigGen/ConfigGenerater.cs b/Assets/Editor/ConfigGen/ConfigGenerater.cs
index 60414a2..9119f3e 100644
--- a/Assets/Editor/ConfigGen/ConfigGenerater.cs
+++ b/Assets/Editor/ConfigGen/ConfigGenerater.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -12,14 +12,16 @@
 public static class ConfigGenerater
 {
     // 甯搁噺瀹氫箟
-    private const string ConfigsPath = "Assets/Scripts/Main/Config/Configs";
+    private const string ResourcesOutConfigPath = "Assets/ResourcesOut/Config";
+    private const string ConfigClassesPath = "Assets/Scripts/Main/Config/Configs";
     private const string ConfigManagerPath = "Assets/Scripts/Main/Config/ConfigManager.cs";
-    
+
     public static List<string> ExcludeClassList = new List<string>()
     {
-        //  鐗规畩琛ㄦ牸
+        //  鐗规畩琛ㄦ牸锛堢敱 preInitConfig 鍗曠嫭鍔犺浇锛屼笉杩涘叆 configTypes锛�
         "InitialFunctionConfig",
         "PriorLanguageConfig",
+        "FuncConfigConfig",
 
         //  鏆傛椂鏃犵敤鐨勮〃
         "PlayerFacePicStarConfig",
@@ -46,25 +48,19 @@
                 .Where(c => !string.IsNullOrEmpty(c) && char.IsUpper(c[0]))
                 .ToList();
 
-            // 2. 鑷姩鐢熸垚 ConfigManager.cs 鐨� LoadConfigs 鏂规硶锛屽叏閮ㄥ紓姝ュ姞杞�
             string configManagerPath = Path.Combine(Application.dataPath, ConfigManagerPath.Replace("Assets/", ""));
             var lines = File.ReadAllLines(configManagerPath).ToList();
 
-            // 鏌ユ壘 LoadConfigs 鏂规硶璧锋琛�
-            int startIdx = lines.FindIndex(l => l.Contains("protected async UniTask LoadConfigs()"));
-            int openBrace = lines.FindIndex(startIdx, l => l.Trim() == "{");
-            int endIdx = openBrace;
-            int braceCount = 1;
-            for (int i = openBrace + 1; i < lines.Count; i++)
+            // --- 鏇存柊 configTypes HashSet ---
+            int loadConfigsIdx = lines.FindIndex(l => l.Contains("protected async UniTask LoadConfigs()"));
+            if (loadConfigsIdx < 0)
             {
-                if (lines[i].Contains("{")) braceCount++;
-                if (lines[i].Contains("}")) braceCount--;
-                if (braceCount == 0) { endIdx = i; break; }
+                Debug.LogError("鏈壘鍒� 'protected async UniTask LoadConfigs()'锛岃妫�鏌� ConfigManager.cs 缁撴瀯銆�");
+                return;
             }
 
-            // 鐢熸垚 configTypes 鍒濆鍖栦唬鐮�
             var configTypeLines = new List<string>();
-            configTypeLines.Add("        // 鑷姩鐢熸垚锛氭敹闆嗘墍鏈夐厤缃被鍨�");
+            configTypeLines.Add("        // 鍔犺浇閰嶇疆鏂囦欢");
             configTypeLines.Add("        HashSet<Type> configTypes = new HashSet<Type>() {");
             for (int i = 0; i < configClasses.Count; i++)
             {
@@ -72,55 +68,88 @@
             }
             configTypeLines.Add("        };");
 
-            // 鏇挎崲鍘熸湁 configTypes 鍒濆鍖栨
-            int configTypesStart = lines.FindIndex(startIdx, l => l.Contains("HashSet<Type> configTypes"));
+            int configTypesStart = lines.FindIndex(loadConfigsIdx, l => l.Contains("HashSet<Type> configTypes"));
             int configTypesEnd = configTypesStart;
             while (configTypesEnd < lines.Count && !lines[configTypesEnd].Trim().EndsWith("};")) configTypesEnd++;
             configTypesEnd++;
             lines.RemoveRange(configTypesStart, configTypesEnd - configTypesStart);
             lines.InsertRange(configTypesStart, configTypeLines);
 
+            // --- 鏇存柊 Release() 鏂规硶浣� ---
+            int releaseIdx = lines.FindIndex(l => l.TrimStart().StartsWith("public override void Release()"));
+            if (releaseIdx >= 0)
+            {
+                int releaseOpen = lines.FindIndex(releaseIdx, l => l.Trim() == "{");
+                int releaseClose = releaseOpen;
+                int braceCount = 1;
+                for (int i = releaseOpen + 1; i < lines.Count; i++)
+                {
+                    foreach (char ch in lines[i])
+                    {
+                        if (ch == '{') braceCount++;
+                        if (ch == '}') braceCount--;
+                    }
+                    if (braceCount == 0) { releaseClose = i; break; }
+                }
+
+                var releaseLines = new List<string>();
+                foreach (string className in configClasses)
+                {
+                    releaseLines.Add($"        // 娓呯┖ {className} 瀛楀吀");
+                    releaseLines.Add($"        ClearConfigDictionary<{className}>();");
+                }
+                lines.RemoveRange(releaseOpen + 1, releaseClose - releaseOpen - 1);
+                lines.InsertRange(releaseOpen + 1, releaseLines);
+            }
+
             // 淇濆瓨鏂囦欢
             File.WriteAllLines(configManagerPath, lines);
 
-            Debug.Log($"ConfigManager.cs 鑷姩鐢熸垚 LoadConfigs 閰嶇疆绫诲瀷鎴愬姛锛屽叡 {configClasses.Count} 涓被鍨嬨��");
+            Debug.Log($"ConfigManager.cs 鑷姩鐢熸垚鎴愬姛锛屽叡 {configClasses.Count} 涓被鍨嬨��");
             AssetDatabase.Refresh();
         }
         catch (Exception ex)
         {
-            Debug.LogError($"鑷姩鐢熸垚 ConfigManager.LoadConfigs 鏃跺彂鐢熼敊璇�: {ex.Message}\n{ex.StackTrace}");
+            Debug.LogError($"鑷姩鐢熸垚 ConfigManager 鏃跺彂鐢熼敊璇�: {ex.Message}\n{ex.StackTrace}");
         }
     }
-    
+
     /// <summary>
     /// 鑾峰彇鎵�鏈夐厤缃被
     /// </summary>
     /// <returns>閰嶇疆绫诲悕绉板垪琛�</returns>
     public static List<string> GetAllConfigClasses()
     {
-        // 鑾峰彇閰嶇疆鐩綍鐨勫畬鏁磋矾寰�
-        string fullConfigsPath = Path.Combine(Application.dataPath, ConfigsPath.Replace("Assets/", ""));
-        
-        // 妫�鏌ョ洰褰曟槸鍚﹀瓨鍦�
-        if (!Directory.Exists(fullConfigsPath))
+        // 浠� ResourcesOut/Config 涓烘潈濞佹潵婧愶紝鎵弿 .txt 鏂囦欢鐢熸垚绫诲悕
+        string fullResPath = Path.Combine(Application.dataPath, ResourcesOutConfigPath.Replace("Assets/", ""));
+        string fullCsPath  = Path.Combine(Application.dataPath, ConfigClassesPath.Replace("Assets/", ""));
+
+        if (!Directory.Exists(fullResPath))
         {
-            Debug.LogError($"閰嶇疆鐩綍涓嶅瓨鍦�: {fullConfigsPath}");
+            Debug.LogError($"ResourcesOut/Config 鐩綍涓嶅瓨鍦�: {fullResPath}");
             return new List<string>();
         }
-        
+
         try
         {
             List<string> configClasses = new List<string>();
-            
-            // 鑾峰彇鎵�鏈塁#鏂囦欢
-            string[] files = Directory.GetFiles(fullConfigsPath, "*.cs", SearchOption.TopDirectoryOnly);
-            
-            for (int i = 0; i < files.Length; i++)
+
+            // 鎵弿 ResourcesOut/Config 涓嬬殑 .txt 鏂囦欢锛屾瀯閫犵被鍚� = 鏂囦欢鍚� + "Config"
+            string[] txtFiles = Directory.GetFiles(fullResPath, "*.txt", SearchOption.TopDirectoryOnly);
+
+            foreach (string file in txtFiles)
             {
-                string file = files[i];
-                configClasses.Add(Path.GetFileNameWithoutExtension(file));
+                string baseName  = Path.GetFileNameWithoutExtension(file);
+                string className = baseName + "Config";
+
+                // 浜ゅ弶楠岃瘉锛氬搴旂殑 C# 绫绘枃浠跺繀椤诲瓨鍦�
+                string csFile = Path.Combine(fullCsPath, className + ".cs");
+                if (!File.Exists(csFile))
+                    continue;
+
+                configClasses.Add(className);
             }
-            
+
             return configClasses;
         }
         catch (Exception ex)
@@ -129,301 +158,4 @@
             return new List<string>();
         }
     }
-    
-    /// <summary>
-    /// 鐢熸垚閰嶇疆绠$悊鍣ㄤ唬鐮�
-    /// </summary>
-    /// <param name="configClasses">閰嶇疆绫诲垪琛�</param>
-    private static void GenerateConfigManager(List<string> configClasses)
-    {
-        // 鑾峰彇閰嶇疆绠$悊鍣ㄧ殑瀹屾暣璺緞
-        string fullConfigManagerPath = Path.Combine(Application.dataPath, ConfigManagerPath.Replace("Assets/", ""));
-        
-        try
-        {
-            // 鐢熸垚瀹屾暣鐨勯厤缃鐞嗗櫒浠g爜
-            string configManagerCode = GenerateFullConfigManagerCode(configClasses);
-            
-            // 鍐欏叆鏂囦欢
-            File.WriteAllText(fullConfigManagerPath, configManagerCode);
-            
-            Debug.Log($"鎴愬姛鐢熸垚閰嶇疆绠$悊鍣�: {fullConfigManagerPath}");
-        }
-        catch (Exception ex)
-        {
-            Debug.LogError($"鐢熸垚閰嶇疆绠$悊鍣ㄦ枃浠舵椂鍙戠敓閿欒: {ex.Message}");
-        }
-    }
-    
-    /// <summary>
-    /// 鐢熸垚瀹屾暣鐨勯厤缃鐞嗗櫒浠g爜
-    /// </summary>
-    /// <param name="configClasses">閰嶇疆绫诲垪琛�</param>
-    /// <returns>瀹屾暣鐨勯厤缃鐞嗗櫒浠g爜</returns>
-    private static string GenerateFullConfigManagerCode(List<string> configClasses)
-    {
-        StringBuilder sb = new StringBuilder();
-
-        // 澶撮儴鍛藉悕绌洪棿
-        sb.AppendLine("using System;");
-        sb.AppendLine("using System.Collections.Generic;");
-        sb.AppendLine("using UnityEngine;");
-        sb.AppendLine("using Cysharp.Threading.Tasks;");
-        sb.AppendLine("using System.Reflection;");
-        sb.AppendLine("using System.Linq;");
-        sb.AppendLine();
-        sb.AppendLine("#if UNITY_EDITOR");
-        sb.AppendLine("using UnityEditor;");
-        sb.AppendLine("#endif");
-        sb.AppendLine();
-        sb.AppendLine("public class ConfigManager : ManagerBase<ConfigManager>");
-        sb.AppendLine("{");
-        sb.AppendLine("    public bool isLoadFinished");
-        sb.AppendLine("    {");
-        sb.AppendLine("        get;");
-        sb.AppendLine("        private set;");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    private float loadingProgress = 0f;");
-        sb.AppendLine();
-        sb.AppendLine("    public override void Init()");
-        sb.AppendLine("    {");
-        sb.AppendLine("        base.Init();");
-        sb.AppendLine("        InitConfigs();");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    public virtual async UniTask InitConfigs()");
-        sb.AppendLine("    {");
-        sb.AppendLine("        // 鍔犺浇閰嶇疆鏂囦欢");
-        sb.AppendLine("        await LoadConfigs();");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    protected async UniTask LoadConfigs()");
-        sb.AppendLine("    {");
-        sb.AppendLine("        loadingProgress = 0f;");
-        sb.AppendLine("        isLoadFinished = false;");
-        sb.AppendLine();
-        sb.AppendLine("        // 鍔犺浇閰嶇疆鏂囦欢");
-        sb.AppendLine("        HashSet<Type> configTypes = new HashSet<Type>() {");
-        for (int i = 0; i < configClasses.Count; i++)
-        {
-            sb.Append($"            typeof({configClasses[i]})");
-            sb.AppendLine(i < configClasses.Count - 1 ? "," : "");
-        }
-        sb.AppendLine("        };");
-        sb.AppendLine();
-        sb.AppendLine("        int iterator = 0;");
-        sb.AppendLine("        int totalConfigs = configTypes.Count;");
-        sb.AppendLine();
-        sb.AppendLine("        // 閫愪釜鍔犺浇閰嶇疆骞舵洿鏂拌繘搴�");
-        sb.AppendLine("        foreach (var configType in configTypes)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            var sw = System.Diagnostics.Stopwatch.StartNew();");
-        sb.AppendLine("            LoadConfigByType(configType);");
-        sb.AppendLine("            sw.Stop();");
-        sb.AppendLine("#if UNITY_EDITOR");
-        sb.AppendLine("            if (sw.ElapsedMilliseconds >= 500)");
-        sb.AppendLine("            {");
-        sb.AppendLine("                Debug.LogError($\"鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("            Debug.Log($\"鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms\");");
-        sb.AppendLine("#endif");
-        sb.AppendLine("            loadingProgress = (float)(iterator++ + 1) / totalConfigs;");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        // 鍔犺浇瀹屾垚鍚庤缃甶sLoadFinished涓簍rue");
-        sb.AppendLine("        loadingProgress = 1f;");
-        sb.AppendLine("        isLoadFinished = true;");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    public void LoadConfigByType(Type configType)");
-        sb.AppendLine("    {");
-        sb.AppendLine("        string configName = configType.Name;");
-        sb.AppendLine("        if (configName.EndsWith(\"Config\"))");
-        sb.AppendLine("        {");
-        sb.AppendLine("            configName = configName.Substring(0, configName.Length - 6);");
-        sb.AppendLine("        }");
-        sb.AppendLine("        string[] texts = ResManager.Instance.LoadConfig(configName);");
-        sb.AppendLine("        if (texts != null)");
-        sb.AppendLine("        {");
-        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("            {");
-        sb.AppendLine("                methodInfo.Invoke(null, new object[] { lines });");
-        sb.AppendLine("                // 璁剧疆鍒濆鍖栨爣蹇�");
-        sb.AppendLine("                var isInitField = configType.GetField(\"isInit\", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);");
-        sb.AppendLine("                if (isInitField != null)");
-        sb.AppendLine("                {");
-        sb.AppendLine("                    isInitField.SetValue(null, true);");
-        sb.AppendLine("                }");
-        sb.AppendLine("                Debug.Log($\"鍔犺浇閰嶇疆: {configType.Name} 鎴愬姛\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("            else");
-        sb.AppendLine("            {");
-        sb.AppendLine("                Debug.LogError($\"閰嶇疆绫� {configType.Name} 娌℃湁闈欐�両nit鏂规硶\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("        }");
-        sb.AppendLine("        else");
-        sb.AppendLine("        {");
-        sb.AppendLine("            Debug.LogError($\"鎵句笉鍒伴厤缃枃浠�: {configName}\");");
-        sb.AppendLine("        }");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    private async UniTask LoadConfig<T>() where T : class");
-        sb.AppendLine("    {");
-        sb.AppendLine("        string configName = typeof(T).Name;");
-        sb.AppendLine();
-        sb.AppendLine("        string[] texts = ResManager.Instance.LoadConfig(configName);");
-        sb.AppendLine("        if (texts != null)");
-        sb.AppendLine("        {");
-        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("            {");
-        sb.AppendLine("                methodInfo.Invoke(null, lines);");
-        sb.AppendLine("                // 璁剧疆鍒濆鍖栨爣蹇�");
-        sb.AppendLine("                var isInitField = typeof(T).GetField(\"isInit\", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);");
-        sb.AppendLine("                if (isInitField != null)");
-        sb.AppendLine("                {");
-        sb.AppendLine("                    isInitField.SetValue(null, true);");
-        sb.AppendLine("                }");
-        sb.AppendLine("                Debug.Log($\"鍔犺浇閰嶇疆: {typeof(T).Name} 鎴愬姛\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("            else");
-        sb.AppendLine("            {");
-        sb.AppendLine("                Debug.LogError($\"閰嶇疆绫� {typeof(T).Name} 娌℃湁闈欐�両nit鏂规硶\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("        }");
-        sb.AppendLine("        else");
-        sb.AppendLine("        {");
-        sb.AppendLine("            Debug.LogError($\"鎵句笉鍒伴厤缃枃浠�: {configName}\");");
-        sb.AppendLine("        }");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    public float GetLoadingProgress()");
-        sb.AppendLine("    {");
-        sb.AppendLine("        return loadingProgress;");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    private void ClearConfigDictionary<T>() where T : class");
-        sb.AppendLine("    {");
-        sb.AppendLine("        // 閲嶇疆 T 鍒濆鍖栫姸鎬�");
-        sb.AppendLine("        var isInitField = typeof(T).GetField(\"isInit\", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);");
-        sb.AppendLine("        if (isInitField != null)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            isInitField.SetValue(null, false);");
-        sb.AppendLine("        }");
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("    public override void Release()");
-        sb.AppendLine("    {");
-        foreach (string className in configClasses)
-        {
-            sb.AppendLine($"        // 娓呯┖ {className} 瀛楀吀");
-            sb.AppendLine($"        ClearConfigDictionary<{className}>();");
-        }
-        sb.AppendLine("    }");
-        sb.AppendLine();
-        sb.AppendLine("#if UNITY_EDITOR");
-        sb.AppendLine("    [MenuItem(\"Tools/Config/鑷\")]");
-        sb.AppendLine("    public static void CheckAndGenerateFastConfig()");
-        sb.AppendLine("    {");
-        sb.AppendLine("        // 鑾峰彇 Editor Assembly");
-        sb.AppendLine("        var editorAsm = System.AppDomain.CurrentDomain.GetAssemblies()");
-        sb.AppendLine("            .FirstOrDefault(a => a.FullName.Contains(\"Editor\"));");
-        sb.AppendLine();
-        sb.AppendLine("        if (editorAsm == null)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            Debug.LogError(\"[鑷] 鏈壘鍒� Editor Assembly锛屾棤娉曡嚜妫�銆俓");");
-        sb.AppendLine("            return;");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        // 鍙嶅皠鑾峰彇 ConfigGenerater 绫诲瀷");
-        sb.AppendLine("        var configGeneraterType = editorAsm.GetType(\"ConfigGenerater\");");
-        sb.AppendLine("        if (configGeneraterType == null)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            Debug.LogError(\"[鑷] 鏈壘鍒� ConfigGenerater 绫诲瀷銆俓");");
-        sb.AppendLine("            return;");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        // 璋冪敤 GetAllConfigClasses 闈欐�佹柟娉�");
-        sb.AppendLine("        var getAllConfigClassesMethod = configGeneraterType.GetMethod(\"GetAllConfigClasses\", BindingFlags.Public | BindingFlags.Static);");
-        sb.AppendLine("        var allConfigClasses = getAllConfigClassesMethod?.Invoke(null, null) as List<string>;");
-        sb.AppendLine("        if (allConfigClasses == null)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            Debug.LogError(\"[鑷] 鑾峰彇鍏ㄩ儴閰嶇疆绫诲け璐ャ�俓");");
-        sb.AppendLine("            return;");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        // 鑾峰彇 ExcludeClassList 瀛楁");
-        sb.AppendLine("        var excludeField = configGeneraterType.GetField(\"ExcludeClassList\", BindingFlags.Public | BindingFlags.Static);");
-        sb.AppendLine("        var excludeClassList = excludeField?.GetValue(null) as List<string> ?? new List<string>();");
-        sb.AppendLine();
-        sb.AppendLine("        // 鎺掗櫎涓嶉渶瑕佺殑绫�");
-        sb.AppendLine("        var checkClasses = allConfigClasses.Where(c => !excludeClassList.Contains(c)).ToList();");
-        sb.AppendLine();
-        sb.AppendLine("        List<string> fastName = new List<string>();");
-        sb.AppendLine();
-        sb.AppendLine("        foreach (var className in checkClasses)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            // 杩欓噷涔熻鐢� Editor Assembly 鑾峰彇绫诲瀷");
-        sb.AppendLine("            var configType = editorAsm.GetType(className) ?? Type.GetType(className);");
-        sb.AppendLine("            if (configType == null)");
-        sb.AppendLine("            {");
-        sb.AppendLine("                Debug.LogWarning($\"[鑷] 鏈壘鍒扮被鍨�: {className}\");");
-        sb.AppendLine("                continue;");
-        sb.AppendLine("            }");
-        sb.AppendLine();
-        sb.AppendLine("            var sw = System.Diagnostics.Stopwatch.StartNew();");
-        sb.AppendLine();
-        sb.AppendLine("            // 鍙嶅皠璋冪敤闈欐�両nit鏂规硶");
-        sb.AppendLine("            string configName = configType.Name;");
-        sb.AppendLine("            if (configName.EndsWith(\"Config\"))");
-        sb.AppendLine("                configName = configName.Substring(0, configName.Length - 6);");
-        sb.AppendLine();
-        sb.AppendLine("            string[] texts = ResManager.Instance.LoadConfig(configName);");
-        sb.AppendLine("            if (texts != null)");
-        sb.AppendLine("            {");
-        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("                {");
-        sb.AppendLine("                    methodInfo.Invoke(null, new object[] { lines });");
-        sb.AppendLine("                }");
-        sb.AppendLine("            }");
-        sb.AppendLine();
-        sb.AppendLine("            sw.Stop();");
-        sb.AppendLine();
-        sb.AppendLine("            if (sw.ElapsedMilliseconds >= 500)");
-        sb.AppendLine("            {");
-        sb.AppendLine("                Debug.LogError($\"[鑷] 鍔犺浇閰嶇疆 {configType.Name} 鑰楁椂杈冮暱: {sw.ElapsedMilliseconds} ms\");");
-        sb.AppendLine("            }");
-        sb.AppendLine("            else if (sw.ElapsedMilliseconds <= 5)");
-        sb.AppendLine("            {");
-        sb.AppendLine("                fastName.Add(configType.Name);");
-        sb.AppendLine("            }");
-        sb.AppendLine("            Debug.Log($\"[鑷] 鍔犺浇閰嶇疆: {configType.Name} 鐢ㄦ椂: {sw.ElapsedMilliseconds} ms\");");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        // 閲婃斁鎵�鏈夊凡鍔犺浇鐨勯厤缃�");
-        sb.AppendLine("        foreach (var className in checkClasses)");
-        sb.AppendLine("        {");
-        sb.AppendLine("            var configType = editorAsm.GetType(className) ?? Type.GetType(className);");
-        sb.AppendLine("            if (configType == null) continue;");
-        sb.AppendLine("            var methodInfo = configType.GetMethod(\"ForceRelease\", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);");
-        sb.AppendLine("            if (methodInfo != null)");
-        sb.AppendLine("            {");
-        sb.AppendLine("                methodInfo.Invoke(null, null);");
-        sb.AppendLine("            }");
-        sb.AppendLine("        }");
-        sb.AppendLine();
-        sb.AppendLine("        System.IO.File.WriteAllText(Application.dataPath + \"/fastConfig.txt\", string.Join(\"\\n\", fastName));");
-        sb.AppendLine("        Debug.Log($\"[鑷] fastConfig.txt 鐢熸垚瀹屾瘯锛屽揩閫熻〃鏈夛細{string.Join(\", \", fastName)}\");");
-        sb.AppendLine("    }");
-        sb.AppendLine("#endif");
-        sb.AppendLine("}");
-
-        return sb.ToString();
-    }
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0