yyl
2025-07-03 8fdbb6eed9040a89b233068eadc32d9b635a162c
18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建 配置表问题
2个文件已修改
44 ■■■■ 已修改文件
Main/Config/ConfigBase.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Config/ConfigManager.cs 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Config/ConfigBase.cs
@@ -32,6 +32,12 @@
        return null;
    }
    public static void ForceRelease()
    {
        m_dic.Clear();
        isInit = false;
    }
    public static void ForceInit()
    {
        ConfigManager.Instance.LoadConfigByType(typeof(T));
Main/Config/ConfigManager.cs
@@ -34,31 +34,43 @@
        // 加载配置文件
        int totalConfigs = 17;
        Type[] configTypes = new Type[] {
        List<Type> configTypes = new List<Type>() {
            typeof(ChestsAwardConfig),
            typeof(CTGConfig),
            typeof(DirtyWordConfig),
            typeof(EquipGSParamConfig),
            typeof(ItemConfig),
            typeof(NPCConfig),
            typeof(NPCExConfig),
            typeof(OrderInfoConfig),
            typeof(PlayerFaceConfig),
            typeof(PlayerFacePicStarConfig),
            typeof(PlayerFaceStarConfig),
            typeof(PlayerLVConfig),
            typeof(StoreConfig),
            typeof(SuccessConfig),
            typeof(SysInfoConfig),
            typeof(TitleStarUpConfig),
            typeof(TreasureItemLibConfig),
            typeof(TreasureSetConfig),
            typeof(XBGetItemConfig)
        };
#if UNITY_EDITOR
        HashSet<Type> configHashSet = new HashSet<Type>();
        if (System.IO.File.Exists(Application.dataPath + "/fastConfig.txt"))
        {
            string[] strConfgsArr = System.IO.File.ReadAllLines(Application.dataPath + "/fastConfig.txt");
            foreach (string str in strConfgsArr)
            {
                Type tpy = Type.GetType(str);
                configHashSet.Add(tpy);
            }
        }
        //  编辑器下加入 评估加载时常
        configTypes.AddRange(configHashSet);
        List<string> fastName = new List<string>();
#endif
        // 逐个加载配置并更新进度
        for (int i = 0; i < configTypes.Length; i++)
        for (int i = 0; i < configTypes.Count; i++)
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();
            LoadConfigByType(configTypes[i]);
@@ -78,6 +90,16 @@
        }
#if UNITY_EDITOR
        System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
        //加载完后卸载
        foreach (var configType in configTypes)
        {
            var methodInfo = configType.GetMethod("ForceRelease", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
            if (methodInfo != null)
            {
                methodInfo.Invoke(null, null);
            }
        }
#endif
        // 加载完成后设置isLoadFinished为true
@@ -175,18 +197,20 @@
        ClearConfigDictionary<DirtyWordConfig>();
        // 清空 EquipGSParamConfig 字典
        ClearConfigDictionary<EquipGSParamConfig>();
        // 清空 ItemConfig 字典
        ClearConfigDictionary<ItemConfig>();
        // 清空 NPCConfig 字典
        ClearConfigDictionary<NPCConfig>();
        // 清空 NPCExConfig 字典
        ClearConfigDictionary<NPCExConfig>();
        // 清空 OrderInfoConfig 字典
        ClearConfigDictionary<OrderInfoConfig>();
        // 清空 PlayerFaceConfig 字典
        ClearConfigDictionary<PlayerFaceConfig>();
        // 清空 PlayerFacePicStarConfig 字典
        ClearConfigDictionary<PlayerFacePicStarConfig>();
        // 清空 PlayerFaceStarConfig 字典
        ClearConfigDictionary<PlayerFaceStarConfig>();
        // 清空 PlayerLVConfig 字典
        ClearConfigDictionary<PlayerLVConfig>();
        // 清空 StoreConfig 字典
        ClearConfigDictionary<StoreConfig>();
        // 清空 SuccessConfig 字典
@@ -195,8 +219,6 @@
        ClearConfigDictionary<SysInfoConfig>();
        // 清空 TitleStarUpConfig 字典
        ClearConfigDictionary<TitleStarUpConfig>();
        // 清空 TreasureItemLibConfig 字典
        ClearConfigDictionary<TreasureItemLibConfig>();
        // 清空 TreasureSetConfig 字典
        ClearConfigDictionary<TreasureSetConfig>();
        // 清空 XBGetItemConfig 字典