public static async ETTask StartCheckUpdate(this UIUpdateView self) { //TODO 网络检查 await self.CheckIsInWhiteList(); await self.CheckUpdateList(); var Over = await self.CheckAppUpdate(); if (Over) { return; } var isUpdateDone = await self.CheckResUpdate(); if (isUpdateDone) { Log.Info("更新完成,准备进入游戏"); self.UpdateFinishAndStartGame().Coroutine(); } else { Log.Info("不需要更新,直接进入游戏"); self.OnOver?.Invoke(); await self.CloseSelf(); } }
async static ETTask <bool> CheckAppUpdate(this UIUpdateView self) { var app_channel = PlatformUtil.GetAppChannel(); var channel_app_update_list = ServerConfigComponent.Instance.GetAppUpdateListByChannel(app_channel); if (channel_app_update_list == null || channel_app_update_list.app_ver == null) { Log.Info("CheckAppUpdate channel_app_update_list or app_ver is nil, so return"); return(false); } var maxVer = ServerConfigComponent.Instance.FindMaxUpdateAppVer(app_channel); if (string.IsNullOrEmpty(maxVer)) { Log.Info("CheckAppUpdate maxVer is nil"); return(false); } var app_ver = Application.version; var flag = VersionCompare.Compare(app_ver, maxVer); Log.Info(string.Format("CoCheckAppUpdate AppVer:{0} maxVer:{1}", app_ver, maxVer)); if (flag >= 0) { Log.Info("CheckAppUpdate AppVer is Most Max Version, so return; flag = " + flag); return(false); } var app_url = channel_app_update_list.app_url; var verInfo = channel_app_update_list.app_ver[app_ver]; Log.Info("CheckAppUpdate app_url = " + app_url); self.force_update = Define.ForceUpdate; if (Define.ForceUpdate)//默认强更 { if (verInfo != null && verInfo.force_update == 0) { self.force_update = false; } } else { if (verInfo != null && verInfo.force_update != 0) { self.force_update = true; } } var cancelBtnText = self.force_update ? "Btn_Exit" : "Btn_Enter_Game"; var content_updata = self.force_update ? "Update_ReDownload" : "Update_SuDownload"; var btnState = await self.ShowMsgBoxView(content_updata, "Global_Btn_Confirm", cancelBtnText); if (btnState == self.BTN_CONFIRM) { GameUtility.OpenURL(app_url); //为了防止切换到网页后回来进入了游戏,所以这里需要继续进入该流程 return(await self.CheckAppUpdate()); } else if (self.force_update) { Log.Info("CheckAppUpdate Need Force Update And User Choose Exit Game!"); GameUtility.Quit(); return(true); } return(false); }