void Start() { _waitHintTextConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.WaitHintTextConfig) as WaitHintTextConfig; StartCoroutine(Rolling()); }
//在联网前,读取Read本地缓存文件,如果没有文件,hashcode为"",第一行是hashcode //加载Load hashcode,数据,到内存 //登录,比较新hashcode,相同则跳过;不同,则申请新的hashcode //申请的结果和运行时动态更新都是收到服务端的ResponseTextConfig,加载hashcode,数据,到内存,组装新文件替换缓存 /// <summary> /// 从硬盘读取bytes加载到内存。每次刚运行时调用 /// </summary> public static void ReadCacheAndLoadAllLargeConfigs() { for (int i = 0; i < Configs.Length; i++) { var configType = (ConfigType)i; var path = GetFilePath(configType); byte[] bytes = null; if (File.Exists(path)) { try { //bytes = File.ReadAllBytes(path); } catch (Exception e) { Debug.LogException(e); } } if (bytes != null) { IReceiveable configCmd = null; switch (configType) { case ConfigType.CoreConfig: configCmd = new CoreConfig(); break; case ConfigType.RechargeConfig: configCmd = new RechargeConfig(); break; case ConfigType.SkillConfig: configCmd = new SkillConfig(); break; case ConfigType.SkillParameterConfig: configCmd = new SkillParameterConfig(); break; case ConfigType.ExchangeConfig: configCmd = new ExchangeConfig(); break; case ConfigType.VegetableConfig: configCmd = new VegetableConfig(); break; case ConfigType.ChallengeLevelConfig: configCmd = new ChallengeLevelConfig(); break; case ConfigType.SkillIntroTextConfig: configCmd = new SkillIntroTextConfig(); break; case ConfigType.SkillLevelDetailTextConfig: configCmd = new SkillLevelDetailTextConfig(); break; case ConfigType.VegetableIntroTextConfig: configCmd = new VegetableIntroTextConfig(); break; case ConfigType.WaitHintTextConfig: configCmd = new WaitHintTextConfig(); break; case ConfigType.CharacterConfig: configCmd = new CharacterConfig(); break; case ConfigType.EquipConfig: configCmd = new EquipConfig(); break; case ConfigType.MajorLevelIntroTextConfig: configCmd = new MajorLevelIntroTextConfig(); break; case ConfigType.EquipIntroTextConfig: configCmd = new EquipIntroTextConfig(); break; case ConfigType.CharacterIntroTextConfig: configCmd = new CharacterIntroTextConfig(); break; case ConfigType.OAuthParamConfig: configCmd = new OAuthParamConfig(); break; default: Debug.LogError("遇到新的ConfigType,需添加代码。type:" + configType); break; } if (configCmd != null) { configCmd.ParseFrom(bytes); SetConfig(configType, configCmd); } } } }