void Awake() { _updateProgressBar = UIComponent.FindObjectComponent <UpdateProgressBar>("UpdateProgressBar"); _updateNoticeDialog = UIComponent.FindObjectComponent <UpdateNoticeDialog>("UpdateNoticeDialog"); _updateNoticeDialog.Close(); _logoDialog = UIComponent.FindObjectComponent <LogoDialog>("LogoDialog"); GameConfig.VFS = true; GameConfig.Init(); GameConfig.InitLogFile(); ExtSDK.Init(); }
// 2.读取最新更新配置文件 private IEnumerator DownloadUpdateSetting() { if (string.IsNullOrEmpty(_updateConfig.url)) { yield break; } string url = _updateConfig.url + "?spm=" + GetRandomValue() + "&channel_id=" + ExtSDK.GetChannelID() + "&p=" + GameConfig.PLATFORM + "&v=" + GameConfig.VERSION; // Debug.Log("Updater.DownloadUpdateSetting " + url); string text = null; for (int i = 0; i < DOWNLOAD_RETRY_TIMES; i++) { WWW downloader = new WWW(url); yield return(downloader); if (downloader.error == null) { text = downloader.text; break; } yield return(new WaitForSeconds(DOWNLOAD_RETRY_DELAY)); // Debug.Log("Updater.DownloadUpdateSetting try agin"); } if (string.IsNullOrEmpty(text)) { yield break; } try { char[] _LINE_SEPARATORS = { '\r', '\n' }; string[] lines = text.Split(_LINE_SEPARATORS, StringSplitOptions.RemoveEmptyEntries); _updateSetting = new UpdateSetting(); _updateSetting.resUrl = lines[0]; _updateSetting.svrUrl = lines[1]; _updateSetting.giftUrl = lines[2]; _updateSetting.eventUrl = lines[3]; for (int i = 4; i < lines.Length; ++i) { if (string.IsNullOrEmpty(lines[i])) { continue; } string[] cols = lines[i].Split(','); VersionStatus vs = new VersionStatus(); vs.version = VersionHelper.StringToCode(cols[0]); if (vs.version == 0) { continue; } vs.platform = cols[1].Trim(); vs.status = int.Parse(cols[2]); _updateSetting.versions.Add(vs); } } catch (Exception e) { Debug.Log("DownloadUpdateSetting: " + e.Message); _updateSetting = null; } }