yoo2.2,9
This commit is contained in:
Alex-Rachel
2025-01-25 13:46:17 +08:00
parent 634a392a1f
commit 6166fd24c6
584 changed files with 15684 additions and 11714 deletions

View File

@@ -49,8 +49,8 @@ namespace GameMain
var downloader = GameModule.Resource.Downloader;
// 注册下载回调
downloader.OnDownloadErrorCallback = OnDownloadErrorCallback;
downloader.OnDownloadProgressCallback = OnDownloadProgressCallback;
downloader.DownloadErrorCallback = OnDownloadErrorCallback;
downloader.DownloadUpdateCallback = OnDownloadProgressCallback;
downloader.BeginDownload();
await downloader;
@@ -61,23 +61,23 @@ namespace GameMain
ChangeState<ProcedureDownloadOver>(_procedureOwner);
}
private void OnDownloadErrorCallback(string fileName, string error)
private void OnDownloadErrorCallback(DownloadErrorData downloadErrorData)
{
UILoadTip.ShowMessageBox($"Failed to download file : {fileName}", MessageShowType.TwoButton,
UILoadTip.ShowMessageBox($"Failed to download file : {downloadErrorData.FileName}", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Default,
() => { ChangeState<ProcedureCreateDownloader>(_procedureOwner); }, UnityEngine.Application.Quit);
}
private void OnDownloadProgressCallback(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes)
private void OnDownloadProgressCallback(DownloadUpdateData downloadUpdateData/*int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes*/)
{
string currentSizeMb = (currentDownloadBytes / 1048576f).ToString("f1");
string totalSizeMb = (totalDownloadBytes / 1048576f).ToString("f1");
string currentSizeMb = (downloadUpdateData.CurrentDownloadBytes / 1048576f).ToString("f1");
string totalSizeMb = (downloadUpdateData.TotalDownloadBytes / 1048576f).ToString("f1");
float progressPercentage = GameModule.Resource.Downloader.Progress * 100;
string speed = Utility.File.GetLengthString((int)CurrentSpeed);
string line1 = Utility.Text.Format("正在更新,已更新 {0}/{1} ({2:F2}%)", currentDownloadCount, totalDownloadCount, progressPercentage);
string line1 = Utility.Text.Format("正在更新,已更新 {0}/{1} ({2:F2}%)", downloadUpdateData.CurrentDownloadCount, downloadUpdateData.TotalDownloadCount, progressPercentage);
string line2 = Utility.Text.Format("已更新大小 {0}MB/{1}MB", currentSizeMb, totalSizeMb);
string line3 = Utility.Text.Format("当前网速 {0}/s剩余时间 {1}", speed, GetRemainingTime(totalDownloadBytes, currentDownloadBytes, CurrentSpeed));
string line3 = Utility.Text.Format("当前网速 {0}/s剩余时间 {1}", speed, GetRemainingTime(downloadUpdateData.TotalDownloadBytes, downloadUpdateData.CurrentDownloadBytes, CurrentSpeed));
LoadUpdateLogic.Instance.DownProgressAction?.Invoke(GameModule.Resource.Downloader.Progress);
UILoadMgr.Show(UIDefine.UILoadUpdate, $"{line1}\n{line2}\n{line3}");