File was renamed from Main/System/AssetVersion/DownLoadAndDiscompressTask.cs |
| | |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class DownLoadAndDiscompressTask : Singleton<DownLoadAndDiscompressTask> |
| | | public class DownLoadAndDiscompressHotTask : Singleton<DownLoadAndDiscompressHotTask> |
| | | |
| | | { |
| | | public const int BYTE_PER_KILOBYTE = 1024; |
| | | public const int BYTE_PER_MILLIONBYTE = 1048576; |
| | | |
| | | public float progress { get { return Mathf.Clamp01((float)DownloadMgr.Instance.DownloadedBytes / totalSize); } } |
| | | public float progress { get { return Mathf.Clamp01((float)DownloadHotMgr.Instance.DownloadedBytes / totalSize); } } |
| | | |
| | | List<AssetVersion> tasks = new List<AssetVersion>(); |
| | | public bool isDone { get { return step == Step.Completed; } } |
| | |
| | | |
| | | if (totalSize > BYTE_PER_MILLIONBYTE) |
| | | { |
| | | // TODO YYL |
| | | // UIManager.Instance.OpenWindow<DownLoadWin>(); |
| | | // WindowCenter.Instance.OpenFromLocal<DownLoadWin>(); |
| | | UIManager.Instance.OpenWindow<DownLoadWin>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | step = Step.DownLoad; |
| | | |
| | | Co_StartDownLoad(); |
| | | Co_StartDownLoad().Forget(); |
| | | // SnxxzGame.Instance.StartCoroutine(Co_StartDownLoad()); |
| | | |
| | | // TODO YYL |
| | |
| | | { |
| | | while (tasks.Count > 0) |
| | | { |
| | | DownloadMgr.Instance.Prepare(); |
| | | DownloadHotMgr.Instance.Prepare(); |
| | | for (int i = 0; i < tasks.Count; i++) |
| | | { |
| | | var assetVersion = tasks[i]; |
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath); |
| | | var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath); |
| | | DownloadMgr.Instance.AddTask(new DownloadTask(remoteURL, localURL)); |
| | | DownloadHotMgr.Instance.AddTask(new DownloadHotTask(remoteURL, localURL)); |
| | | } |
| | | |
| | | DownloadMgr.Instance.Begin(); |
| | | DownloadHotMgr.Instance.Begin(); |
| | | |
| | | while (!DownloadMgr.Instance.IsFinished) |
| | | while (!DownloadHotMgr.Instance.IsFinished) |
| | | { |
| | | await UniTask.DelayFrame(1); |
| | | } |
| | |
| | | step = Step.Completed; |
| | | |
| | | |
| | | UIManager.Instance.OpenWindow<DownLoadWin>(); |
| | | UIManager.Instance.OpenWindow<InGameDownLoadWin>(); |
| | | UIManager.Instance.CloseWindow<DownLoadWin>(); |
| | | UIManager.Instance.CloseWindow<InGameDownLoadWin>(); |
| | | |
| | | if (downLoadOkCallBack != null) |
| | | { |