三国卡牌客户端基础资源仓库
yyl
2025-05-13 346ca3658a3a2c6c48a7ca2f11bdf03ee59ffc11
配置跟资源的一些问题修改
2个文件已修改
10 ■■■■ 已修改文件
Assets/Editor/ConfigGen/ConfigGenerater.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Manager/ResManager.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/ConfigGen/ConfigGenerater.cs
@@ -194,11 +194,15 @@
        sb.AppendLine("    private async UniTask 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("        TextAsset textAsset = await ResManager.Instance.LoadAsset<TextAsset>(\"Config\", configName);");
        sb.AppendLine("        if (textAsset != null)");
        sb.AppendLine("        {");
        sb.AppendLine("            string[] lines = textAsset.text.Split('\\n');");
        sb.AppendLine("            var methodInfo = configType.GetMethod(\"Init\", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);");
        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 });");
@@ -234,7 +238,7 @@
        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, new object[] { lines });");
        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)");
Assets/Launch/Manager/ResManager.cs
@@ -161,7 +161,7 @@
            }
            else if (tp == typeof(TextAsset))
            {
                path += ".txt";
                path += "txt";
            }
            Debug.Log($"[ResManager] 编辑器加载路径: {path}");
            retAsset = AssetDatabase.LoadAssetAtPath<T>(path);