三国卡牌客户端基础资源仓库
130 子 【战斗】战斗系统 / 【战斗】战斗系统-客户端 飘血 配置优化
2个文件已修改
2个文件已添加
149 ■■■■■ 已修改文件
Assets/Editor/ConfigGen/ConfigGenerater.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/WindowTool.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/fastConfig.txt 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/fastConfig.txt.meta 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/ConfigGen/ConfigGenerater.cs
@@ -18,8 +18,59 @@
    
    private static List<string> ExcludeClassList = new List<string>()
    {
        //  特殊表格
        "InitialFunctionConfig",
        "PriorLanguageConfig",
        //  正常读取小于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("        // 加载完成后设置isLoadFinished为true");
        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("            {");
Assets/Editor/Tool/WindowTool.cs
@@ -66,6 +66,16 @@
            // 关闭窗口逻辑
            UIManager.Instance.CloseWindow(windowName);
        }
        if (GUILayout.Button("关闭所有窗口再打开BattleWin"))
        {
            foreach (var win in uiNameList)
            {
                UIManager.Instance.CloseWindow(win);
            }
            UIManager.Instance.OpenWindow("BattleWin");
        }
        EditorGUILayout.EndHorizontal();
    }
}
Assets/fastConfig.txt
New file
@@ -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
Assets/fastConfig.txt.meta
New file
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7b3f592d4b2538c4fab144f9e7e31202
TextScriptImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant: