public void Check() { var request = Assets.Initialize(); request.completed = OnInit; progress += OnProgress; state = State.Checking; }
private IEnumerator LoadGameScene() { OnMessage("正在初始化"); var init = Assets.Initialize(); yield return(init); this.Step = Step.Completed; if (string.IsNullOrEmpty(init.error)) { init.Release(); OnProgress(0); OnMessage("XAsset初始化完成"); ResPreparedCompleted?.Invoke(); } else { init.Release(); Debug.LogError($"初始化异常错误:{init.error},请联系技术支持"); } }
private IEnumerator LoadGameScene() { OnMessage("正在初始化"); var init = Assets.Initialize(); yield return(init); if (string.IsNullOrEmpty(init.error)) { init.Release(); OnProgress(0); OnMessage("资源下载完成"); completed(); } else { init.Release(); Debug.LogError("提示!初始化异常错误"); //var mb = MessageBox.Show("提示", "初始化异常错误:" + init.error + "请联系技术支持"); //yield return mb; Quit(); } }
private void Complete() { updateScreen.progressBar.gameObject.SetActive(false); Versions.Save(); if (_downloads.Count > 0) { for (int i = 0; i < _downloads.Count; i++) { var item = _downloads[i]; if (!item.isDone) { break; } else { if (_serverVersions.ContainsKey(item.path)) { _versions[item.path] = _serverVersions[item.path]; } } } StringBuilder sb = new StringBuilder(); foreach (var item in _versions) { sb.AppendLine(string.Format("{0}:{1}", item.Key, item.Value)); } var path = Assets.GetRelativeUpdatePath(versionsTxt); if (File.Exists(path)) { File.Delete(path); } File.WriteAllText(path, sb.ToString()); var request = Assets.Initialize(); request.completed = delegate(AssetRequest req) { if (!string.IsNullOrEmpty(req.error)) { OnError(req.error); } else { if (completed != null) { completed(); } } }; state = State.Completed; message = string.Format("{0} files has update.", _downloads.Count); return; } if (completed != null) { completed(); } message = "nothing to update."; state = State.Completed; }