| | |
| | | isLoadFinished = false;
|
| | |
|
| | | // 加载配置文件
|
| | | int totalConfigs = 65;
|
| | | int totalConfigs = 17;
|
| | | Type[] configTypes = new Type[] {
|
| | | typeof(AppointItemConfig),
|
| | | typeof(AudioConfig),
|
| | | typeof(ChatBubbleBoxConfig),
|
| | | typeof(ChestsAwardConfig),
|
| | | typeof(ChestsConfig),
|
| | | typeof(CTGConfig),
|
| | | typeof(CTGSelectItemConfig),
|
| | | typeof(DailyLivenessRewardConfig),
|
| | | typeof(DailyQuestConfig),
|
| | | typeof(DailyQuestOpenTimeConfig),
|
| | | typeof(DienstgradConfig),
|
| | | typeof(DirtyNameConfig),
|
| | | typeof(DirtyWordConfig),
|
| | | typeof(EffectConfig),
|
| | | typeof(EmojiPackConfig),
|
| | | typeof(EquipGSParamConfig),
|
| | | typeof(EquipPlaceMapConfig),
|
| | | typeof(FamilyConfig),
|
| | | typeof(FamilyEmblemConfig),
|
| | | typeof(FirstGoldConfig),
|
| | | typeof(FrameAnimationConfig),
|
| | | typeof(FuncConfigConfig),
|
| | | typeof(FuncOpenLVConfig),
|
| | | typeof(FunctionTeamSetConfig),
|
| | | typeof(GetItemWaysConfig),
|
| | | typeof(GmCmdConfig),
|
| | | typeof(GuideConfig),
|
| | | typeof(HeroAwakeConfig),
|
| | | typeof(HeroBreakConfig),
|
| | | typeof(HeroConfig),
|
| | | typeof(HeroFetterConfig),
|
| | | typeof(HeroQualityAwakeConfig),
|
| | | typeof(HeroQualityBreakConfig),
|
| | | typeof(HeroQualityConfig),
|
| | | typeof(HeroSkinConfig),
|
| | | typeof(HeroTalentConfig),
|
| | | typeof(IconConfig),
|
| | | typeof(ItemConfig),
|
| | | typeof(KickOutReasonConfig),
|
| | | typeof(LanguageConfig),
|
| | | typeof(MailConfig),
|
| | | typeof(NPCConfig),
|
| | | typeof(NPCExConfig),
|
| | | typeof(OrderInfoConfig),
|
| | | typeof(PlayerFaceConfig),
|
| | | typeof(PlayerFacePicConfig),
|
| | | typeof(PlayerFacePicStarConfig),
|
| | | typeof(PlayerFaceStarConfig),
|
| | | typeof(PlayerLVConfig),
|
| | | typeof(PlayerPropertyConfig),
|
| | | typeof(priorbundleConfig),
|
| | | typeof(RealmConfig),
|
| | | typeof(RealmLVUPTaskConfig),
|
| | | typeof(RichTextMsgReplaceConfig),
|
| | | typeof(RuleConfig),
|
| | | typeof(SkillConfig),
|
| | | typeof(StoreConfig),
|
| | | typeof(SuccessConfig),
|
| | | typeof(SysInfoConfig),
|
| | | typeof(TaskConfig),
|
| | | typeof(TitleStarUpConfig),
|
| | | typeof(TreasureCntAwardConfig),
|
| | | typeof(TreasureItemLibConfig),
|
| | | typeof(TreasureSetConfig),
|
| | | typeof(XBGetItemConfig)
|
| | | };
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | List<string> fastName = new List<string>();
|
| | | #endif
|
| | | // 逐个加载配置并更新进度
|
| | | for (int i = 0; i < configTypes.Length; i++)
|
| | | {
|
| | | var sw = System.Diagnostics.Stopwatch.StartNew();
|
| | | await LoadConfigByType(configTypes[i]);
|
| | | sw.Stop();
|
| | | #if UNITY_EDITOR
|
| | | if (sw.ElapsedMilliseconds >= 100)
|
| | | {
|
| | | Debug.LogError($"加载配置 {configTypes[i].Name} 耗时较长: {sw.ElapsedMilliseconds} ms");
|
| | | }
|
| | | else if (sw.ElapsedMilliseconds <= 5)
|
| | | {
|
| | | fastName.Add(configTypes[i].Name);
|
| | | }
|
| | | Debug.Log($"加载配置: {configTypes[i].Name} 用时: {sw.ElapsedMilliseconds} ms");
|
| | | #endif
|
| | | loadingProgress = (float)(i + 1) / totalConfigs;
|
| | | }
|
| | | #if UNITY_EDITOR
|
| | | System.IO.File.WriteAllText(Application.dataPath + "/fastConfig.txt", string.Join("\n", fastName));
|
| | | #endif
|
| | |
|
| | | // 加载完成后设置isLoadFinished为true
|
| | | loadingProgress = 1f;
|
| | |
| | | {
|
| | | configName = configName.Substring(0, configName.Length - 6);
|
| | | }
|
| | | TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
|
| | | if (textAsset != null)
|
| | | string[] texts = ResManager.Instance.LoadConfig(configName);
|
| | | if (texts != null)
|
| | | {
|
| | | string[] lines = textAsset.text.Split('\n');
|
| | | string[] lines = texts;
|
| | | var methodInfo = configType.GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
|
| | | if (methodInfo != null)
|
| | | {
|
| | |
| | | {
|
| | | string configName = typeof(T).Name;
|
| | |
|
| | | TextAsset textAsset = ResManager.Instance.LoadAsset<TextAsset>("Config", configName);
|
| | | if (textAsset != null)
|
| | | string[] texts = ResManager.Instance.LoadConfig(configName);
|
| | | if (texts != null)
|
| | | {
|
| | | string[] lines = textAsset.text.Split('\n');
|
| | | string[] lines = texts;
|
| | | var methodInfo = typeof(T).GetMethod("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
|
| | | if (methodInfo != null)
|
| | | {
|
| | |
| | |
|
| | | public override void Release()
|
| | | {
|
| | | // 清空 AppointItemConfig 字典
|
| | | ClearConfigDictionary<AppointItemConfig>();
|
| | | // 清空 AudioConfig 字典
|
| | | ClearConfigDictionary<AudioConfig>();
|
| | | // 清空 ChatBubbleBoxConfig 字典
|
| | | ClearConfigDictionary<ChatBubbleBoxConfig>();
|
| | | // 清空 ChestsAwardConfig 字典
|
| | | ClearConfigDictionary<ChestsAwardConfig>();
|
| | | // 清空 ChestsConfig 字典
|
| | | ClearConfigDictionary<ChestsConfig>();
|
| | | // 清空 CTGConfig 字典
|
| | | ClearConfigDictionary<CTGConfig>();
|
| | | // 清空 CTGSelectItemConfig 字典
|
| | | ClearConfigDictionary<CTGSelectItemConfig>();
|
| | | // 清空 DailyLivenessRewardConfig 字典
|
| | | ClearConfigDictionary<DailyLivenessRewardConfig>();
|
| | | // 清空 DailyQuestConfig 字典
|
| | | ClearConfigDictionary<DailyQuestConfig>();
|
| | | // 清空 DailyQuestOpenTimeConfig 字典
|
| | | ClearConfigDictionary<DailyQuestOpenTimeConfig>();
|
| | | // 清空 DienstgradConfig 字典
|
| | | ClearConfigDictionary<DienstgradConfig>();
|
| | | // 清空 DirtyNameConfig 字典
|
| | | ClearConfigDictionary<DirtyNameConfig>();
|
| | | // 清空 DirtyWordConfig 字典
|
| | | ClearConfigDictionary<DirtyWordConfig>();
|
| | | // 清空 EffectConfig 字典
|
| | | ClearConfigDictionary<EffectConfig>();
|
| | | // 清空 EmojiPackConfig 字典
|
| | | ClearConfigDictionary<EmojiPackConfig>();
|
| | | // 清空 EquipGSParamConfig 字典
|
| | | ClearConfigDictionary<EquipGSParamConfig>();
|
| | | // 清空 EquipPlaceMapConfig 字典
|
| | | ClearConfigDictionary<EquipPlaceMapConfig>();
|
| | | // 清空 FamilyConfig 字典
|
| | | ClearConfigDictionary<FamilyConfig>();
|
| | | // 清空 FamilyEmblemConfig 字典
|
| | | ClearConfigDictionary<FamilyEmblemConfig>();
|
| | | // 清空 FirstGoldConfig 字典
|
| | | ClearConfigDictionary<FirstGoldConfig>();
|
| | | // 清空 FrameAnimationConfig 字典
|
| | | ClearConfigDictionary<FrameAnimationConfig>();
|
| | | // 清空 FuncConfigConfig 字典
|
| | | ClearConfigDictionary<FuncConfigConfig>();
|
| | | // 清空 FuncOpenLVConfig 字典
|
| | | ClearConfigDictionary<FuncOpenLVConfig>();
|
| | | // 清空 FunctionTeamSetConfig 字典
|
| | | ClearConfigDictionary<FunctionTeamSetConfig>();
|
| | | // 清空 GetItemWaysConfig 字典
|
| | | ClearConfigDictionary<GetItemWaysConfig>();
|
| | | // 清空 GmCmdConfig 字典
|
| | | ClearConfigDictionary<GmCmdConfig>();
|
| | | // 清空 GuideConfig 字典
|
| | | ClearConfigDictionary<GuideConfig>();
|
| | | // 清空 HeroAwakeConfig 字典
|
| | | ClearConfigDictionary<HeroAwakeConfig>();
|
| | | // 清空 HeroBreakConfig 字典
|
| | | ClearConfigDictionary<HeroBreakConfig>();
|
| | | // 清空 HeroConfig 字典
|
| | | ClearConfigDictionary<HeroConfig>();
|
| | | // 清空 HeroFetterConfig 字典
|
| | | ClearConfigDictionary<HeroFetterConfig>();
|
| | | // 清空 HeroQualityAwakeConfig 字典
|
| | | ClearConfigDictionary<HeroQualityAwakeConfig>();
|
| | | // 清空 HeroQualityBreakConfig 字典
|
| | | ClearConfigDictionary<HeroQualityBreakConfig>();
|
| | | // 清空 HeroQualityConfig 字典
|
| | | ClearConfigDictionary<HeroQualityConfig>();
|
| | | // 清空 HeroSkinConfig 字典
|
| | | ClearConfigDictionary<HeroSkinConfig>();
|
| | | // 清空 HeroTalentConfig 字典
|
| | | ClearConfigDictionary<HeroTalentConfig>();
|
| | | // 清空 IconConfig 字典
|
| | | ClearConfigDictionary<IconConfig>();
|
| | | // 清空 ItemConfig 字典
|
| | | ClearConfigDictionary<ItemConfig>();
|
| | | // 清空 KickOutReasonConfig 字典
|
| | | ClearConfigDictionary<KickOutReasonConfig>();
|
| | | // 清空 LanguageConfig 字典
|
| | | ClearConfigDictionary<LanguageConfig>();
|
| | | // 清空 MailConfig 字典
|
| | | ClearConfigDictionary<MailConfig>();
|
| | | // 清空 NPCConfig 字典
|
| | | ClearConfigDictionary<NPCConfig>();
|
| | | // 清空 NPCExConfig 字典
|
| | | ClearConfigDictionary<NPCExConfig>();
|
| | | // 清空 OrderInfoConfig 字典
|
| | | ClearConfigDictionary<OrderInfoConfig>();
|
| | | // 清空 PlayerFaceConfig 字典
|
| | | ClearConfigDictionary<PlayerFaceConfig>();
|
| | | // 清空 PlayerFacePicConfig 字典
|
| | | ClearConfigDictionary<PlayerFacePicConfig>();
|
| | | // 清空 PlayerFacePicStarConfig 字典
|
| | | ClearConfigDictionary<PlayerFacePicStarConfig>();
|
| | | // 清空 PlayerFaceStarConfig 字典
|
| | | ClearConfigDictionary<PlayerFaceStarConfig>();
|
| | | // 清空 PlayerLVConfig 字典
|
| | | ClearConfigDictionary<PlayerLVConfig>();
|
| | | // 清空 PlayerPropertyConfig 字典
|
| | | ClearConfigDictionary<PlayerPropertyConfig>();
|
| | | // 清空 priorbundleConfig 字典
|
| | | ClearConfigDictionary<priorbundleConfig>();
|
| | | // 清空 RealmConfig 字典
|
| | | ClearConfigDictionary<RealmConfig>();
|
| | | // 清空 RealmLVUPTaskConfig 字典
|
| | | ClearConfigDictionary<RealmLVUPTaskConfig>();
|
| | | // 清空 RichTextMsgReplaceConfig 字典
|
| | | ClearConfigDictionary<RichTextMsgReplaceConfig>();
|
| | | // 清空 RuleConfig 字典
|
| | | ClearConfigDictionary<RuleConfig>();
|
| | | // 清空 SkillConfig 字典
|
| | | ClearConfigDictionary<SkillConfig>();
|
| | | // 清空 StoreConfig 字典
|
| | | ClearConfigDictionary<StoreConfig>();
|
| | | // 清空 SuccessConfig 字典
|
| | | ClearConfigDictionary<SuccessConfig>();
|
| | | // 清空 SysInfoConfig 字典
|
| | | ClearConfigDictionary<SysInfoConfig>();
|
| | | // 清空 TaskConfig 字典
|
| | | ClearConfigDictionary<TaskConfig>();
|
| | | // 清空 TitleStarUpConfig 字典
|
| | | ClearConfigDictionary<TitleStarUpConfig>();
|
| | | // 清空 TreasureCntAwardConfig 字典
|
| | | ClearConfigDictionary<TreasureCntAwardConfig>();
|
| | | // 清空 TreasureItemLibConfig 字典
|
| | | ClearConfigDictionary<TreasureItemLibConfig>();
|
| | | // 清空 TreasureSetConfig 字典
|