/** 读取配置 */ IEnumerator ReadConst(bool final) { string url = ""; string file = PathUtil.DataPath + GameConst.GameConstFileName; // if(Application.isEditor) // { // file = Application.dataPath + "/../res/" + GameConst.GameConstFileName; // } Debug.Log("File.Exists(" + file + ")=" + File.Exists(file)); if (File.Exists(file)) { url = PathUtil.DataUrl + GameConst.GameConstFileName; } else { url = PathUtil.AppDataUrl + GameConst.GameConstFileName; } WWW www = new WWW(url); yield return(www); if (string.IsNullOrEmpty(www.error)) { Debug.Log(url); Debug.Log(www.text); GameConstConfig obj = JsonConvert.DeserializeObject(www.text, typeof(GameConstConfig)) as GameConstConfig; obj.Set(); } else { Debug.Log(string.Format("<color=red>[EnterPanel.ReadConst] 读取game_const.json失败 url={0} error={1} text={2}</color>", url, www.error, www.text)); } www.Dispose(); www = null; if (final) { VersionFinal(); } else { CheckConst(); } }
public IEnumerator CheckVersion() { yield return(StartCoroutine(ReadGameConst_Streaming())); #if UNITY_EDITOR appGameConstConfig.Set(); if (appGameConstConfig.DevelopMode) { OnFinal(); AssetManagerSetting.persistentAssetFileList.Save(AssetManagerSetting.PersistentAssetFileListPath); yield break; } if (!AssetManagerSetting.TestVersionMode) { appGameConstConfig.Set(); OnFinal(); yield break; } #endif yield return(StartCoroutine(ReadGameConst_Persistent())); appVer.Parse(appGameConstConfig.Version); bool needInitData = false; if (curGameConstConfig == null) { appGameConstConfig.Set(); needInitData = true; } else { curGameConstConfig.Set(); curVer.Parse(curGameConstConfig.Version); needInitData = VersionCheck.CheckNeedCopy(curVer, appVer); } if (needInitData) { yield return(StartCoroutine(InitData())); curVer.Copy(appVer); } yield return(ReadServerVersionInfo()); Debug.Log("serverVersionInfo=" + serverVersionInfo); if (serverVersionInfo != null) { serverVer.Parse(serverVersionInfo.version); VersionCheckState state = VersionCheck.CheckState(curVer, serverVer); switch (state) { case VersionCheckState.DownApp: OnNeedDownApp(serverVersionInfo.downLoadUrl); yieldbreak = true; break; case VersionCheckState.HotUpdate: yield return(StartCoroutine(UpdateResource(serverVersionInfo.updateLoadUrl))); yield return(StartCoroutine(ReadGameConst_Persistent())); curGameConstConfig.Set(); OnFinal(); break; default: AssetManagerSetting.persistentAssetFileList = AssetFileList.Read(AssetManagerSetting.PersistentAssetFileListPath); OnFinal(); break; } } else { OnFinal(); } }