private void OnMergePatchUpdate(FSMState currentState) { if (this.ApkMerging) { string newApkPath = this.GetNewApkPath(); FileInfo fileInfo = new FileInfo(newApkPath); if (fileInfo.get_Exists()) { PreloadingUIView.SetProgress((float)fileInfo.get_Length() / (float)this.CurrentPatchInfo.ApkFileInfo.FileSize); } } }
private void ProgressCallback(float downloadedSize, float TotalSize) { string progressName = string.Concat(new string[] { GameDataUtils.GetChineseContent(621268, false), downloadedSize.ToString("0.00"), "MB /", this.fileSize.ToString("0.00"), " MB" }); PreloadingUIView.SetProgressName(progressName); PreloadingUIView.SetProgress(downloadedSize / this.fileSize); }
private void DownloadSeverVersion() { List <string> list = new List <string>(); List <string> list2 = new List <string>(); string text = string.Format(AppConst.ServerUrl, SerializeUtility.GetRuntimePlatformFolderName(Application.get_platform())); list.Add(text); list2.Add(Path.Combine(GameManager.AssetBundleBuildRoot, "server_version.txt")); string progressName = string.Format(GameDataUtils.GetChineseContent(621301, false), new object[0]); PreloadingUIView.SetProgressName(progressName); PreloadingUIView.SetProgress(0.1f); Downloader.Instance.Download(list, list2, null, null, null, new Action <bool>(this.CheckVersion)); }
private void ReplaceUpdateFiles() { int j; for (j = 0; j <= this.finishNum; j++) { string text = this.ExtTemp + j.ToString(); Debug.LogError("GetFiles ext:*" + text); string[] files = Directory.GetFiles(this.dataPath, "*" + text, 1); if (files != null) { Debug.Log(string.Concat(new object[] { "Replace ", text, "files.Length", files.Length })); } try { int i; for (i = 0; i < files.Length; i++) { File.Copy(files[i], files[i].Replace(text, string.Empty), true); File.Delete(files[i]); Loom.Current.QueueOnMainThread(delegate { PreloadingUIView.SetProgress((float)(i + 1) / (float)(files.Length + 1) / (float)this.finishNum * (float)j); }); } } catch (Exception ex) { Debug.LogError("ReplaceUpdateFiles Exception has been thrown!"); Debug.LogError(ex.ToString()); Loom.Current.QueueOnMainThread(delegate { NewContinueUI.OpenAsNormal(GameDataUtils.GetChineseContent(621293, false), GameDataUtils.GetChineseContent(621294, false), new Action(ClientApp.QuitApp), new Action(this.DownloadInstallPackage), GameDataUtils.GetChineseContent(621286, false), GameDataUtils.GetChineseContent(621295, false)); }); return; } } Loom.Current.QueueOnMainThread(delegate { this.ReplaceUpdateFilesFinish(); }); }
private void ShowState(int downloadedSize, int fileSize, string tips) { this.ShowSpeed(); this.tm = TimerHeap.AddTimer(0u, 1000, delegate { string progressName = string.Concat(new string[] { GameDataUtils.GetChineseContent(621303, false), ((float)Downloader.Instance.localFileSize / 1024f / 1024f).ToString("0.00"), "MB /", ((float)fileSize / 1024f / 1024f).ToString("0.00"), " MB" }); PreloadingUIView.SetProgressName(progressName); PreloadingUIView.SetProgress((float)Downloader.Instance.localFileSize / (float)fileSize); }); }