protected IEnumerator CheckLocalVersionInfo() { //获取本地保存的程序和资源版本 LoadVersionInfo(); var localProgramVn = VersionNumber.ParseString(GameRuntimeInfo.ProgramVersion); var localResourceVn = VersionNumber.ParseString(GameRuntimeInfo.ResourceVersion); //获取打包时候配置的程序和资源版本信息 var versionInfo = Resources.Load("ReadonlyData/VersionConfig") as TextAsset; var versionJsonObj = JsonReader.Deserialize <Dictionary <string, string> >(versionInfo.text); Resources.UnloadAsset(versionInfo); var readonlyProgramVersion = versionJsonObj[UGCoreConfig.ProgramVersion]; var readonlyResourceVersion = versionJsonObj[UGCoreConfig.ResourceVersion]; var readonlyProgramVn = VersionNumber.ParseString(readonlyProgramVersion); var readonlyResourceVn = VersionNumber.ParseString(readonlyResourceVersion); if (readonlyProgramVn == null || readonlyResourceVn == null) { Debug.LogError("version control - check error : check local version info error"); m_CoroutineWorkflow.AddFirst("CheckLocalVersionInfo", CheckLocalVersionErrorNotify); yield break; } if (localProgramVn == null || localResourceVn == null) { SaveVersionInfo(readonlyProgramVersion, readonlyResourceVersion); } else { if (VersionNumber.CompareTo(readonlyProgramVn, localProgramVn) == 0) { if (VersionNumber.CompareTo(readonlyResourceVn, localResourceVn) > 0) { SaveVersionInfo(readonlyProgramVersion, readonlyResourceVersion); } } else { SaveVersionInfo(readonlyProgramVersion, readonlyResourceVersion); } } }
protected IEnumerator CheckResourceVersion() { var localResourceVn = VersionNumber.ParseString(GameRuntimeInfo.ResourceVersion); var remoteResourceVn = VersionNumber.ParseString(GameRuntimeInfo.RemoteControlConfig.ResourceVersion); if (VersionNumber.CompareTo(remoteResourceVn, localResourceVn) > 0) { var www = new WWW(UrlUtility.GetRandomParametersUrl(GameRuntimeInfo.RemoteControlConfig.PatchListPath)); yield return(www); if (www.error != null) { Debug.LogError("version control - download patch list failed:" + www.error); m_CoroutineWorkflow.AddFirst("ShowDownloadPatchListFail", DownloadPatchListErrorNotify); yield break; } else { var parseExcepetion = false; try { m_PatchesMap = JsonReader.Deserialize <Dictionary <string, PatchInfoConfig> >(www.text); } catch (Exception e) { Debug.LogError("version control - parse patch list error:" + e); parseExcepetion = true; } if (parseExcepetion) { m_CoroutineWorkflow.AddFirst("ParsePatchListErrorNotify", ParsePatchListErrorNotify); } else { m_CoroutineWorkflow.AddFirst("CheckPatchList", CheckPatchList); } yield break; } } }
protected IEnumerator CheckProgramVersion() { var localProgramVn = VersionNumber.ParseString(GameRuntimeInfo.ProgramVersion); var remoteProgramVn = VersionNumber.ParseString(GameRuntimeInfo.RemoteControlConfig.ProgramVersion); if (VersionNumber.CompareTo(remoteProgramVn, localProgramVn) > 0) { if (GameRuntimeInfo.RemoteControlConfig.IsPlatformUpdate) { while (true) { SetVersionCheckState(VersionCheckState.WaitDownloadApk); yield return(null); } } else { SetVersionCheckState(VersionCheckState.DownloadApk); m_CoroutineWorkflow.AddFirst("QueryDownlaodApk", QueryDownlaodApk); yield break; } } }
protected IEnumerator CheckPatchList() { var localResourceVn = VersionNumber.ParseString(GameRuntimeInfo.ResourceVersion); m_PatchKeyList = new List <string>(); var enumerator = m_PatchesMap.GetEnumerator(); while (enumerator.MoveNext()) { var index = enumerator.Current.Key.IndexOf("-"); var versionNumber = VersionNumber.ParseString(enumerator.Current.Key.Substring(0, index)); if (VersionNumber.CompareTo(versionNumber, localResourceVn) >= 0) { m_NeedDownloadPathcesSize += enumerator.Current.Value.PatchSize; m_PatchKeyList.Add(enumerator.Current.Key); } } m_PatchKeyList.Sort((obj1, obj2) => { var index = obj1.IndexOf("-"); var vn1 = VersionNumber.ParseString(obj1.Substring(0, index)); index = obj2.IndexOf("-"); var vn2 = VersionNumber.ParseString(obj2.Substring(0, index)); return(VersionNumber.CompareTo(vn1, vn2)); }); if (m_PatchKeyList.Count > 0) { SetVersionCheckState(VersionCheckState.DownloadPatch); m_CoroutineWorkflow.AddFirst("QueryDownlaodPatches", QueryDownlaodPatches); } yield break; }