public IEnumerator Download() { // 获取最新的游戏版本号 { string url = _patcher.GetWebServerIP(); string post = _patcher.GetWebPostData(); PatchHelper.Log(ELogLevel.Log, $"Request game version : {url} : {post}"); WebPostRequest download = new WebPostRequest(url, post); yield return(download.DownLoad()); //Check fatal if (download.States != EWebRequestStates.Success) { download.Dispose(); PatchEventDispatcher.SendGameVersionRequestFailedMsg(); yield break; } string responseData = download.GetResponse(); _patcher.ParseResponseData(responseData); download.Dispose(); } int newResourceVersion = _patcher.RequestedResourceVersion; int oldResourceVersion = _patcher.SandboxPatchManifest.Version; // 检测强更安装包 string appInstallURL = _patcher.GetForceInstallAppURL(); if (string.IsNullOrEmpty(appInstallURL) == false) { PatchHelper.Log(ELogLevel.Log, $"Found new APP can be install : {_patcher.GameVersion.ToString()}"); PatchEventDispatcher.SendFoundForceInstallAPPMsg(_patcher.GameVersion.ToString(), appInstallURL); yield break; } // 检测资源版本是否变化 if (newResourceVersion == oldResourceVersion) { PatchHelper.Log(ELogLevel.Log, $"Resource version is not change."); _patcher.Switch(EPatchStates.DownloadOver.ToString()); } else { PatchHelper.Log(ELogLevel.Log, $"Resource version is change : {oldResourceVersion} -> {newResourceVersion}"); _patcher.SwitchNext(); } }