| | |
| | | //开始分配任务 |
| | | public void AssignTasks(List<AssetVersion> assets, Action _onDownLoadOk) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL 下文件下载由 YooAsset WebPlayMode 处理,跳过旧的文件下载流程 |
| | | Debug.Log("[InGameDownLoad] WebGL 平台跳过文件下载,YooAsset 负责资源加载"); |
| | | foreach (var asset in assets) |
| | | asset.localValid = true; |
| | | state = State.Completed; |
| | | _onDownLoadOk?.Invoke(); |
| | | return; |
| | | #endif |
| | | |
| | | this.inGameDownLoadAllow = false; |
| | | this.assets = assets; |
| | |
| | | |
| | | DownloadHotMgr.Instance.Prepare(); |
| | | |
| | | var versionConfig = VersionConfig.config; |
| | | |
| | | if (null == versionConfig) |
| | | { |
| | | // 如果前面都没获取到那一定是哪里出问题了 从这里打断 |
| | | throw new Exception("VersionConfig is null when AssignTasks, game will pause here"); |
| | | } |
| | | |
| | | for (int i = 0; i < this.assets.Count; i++) |
| | | { |
| | | var assetVersion = this.assets[i]; |
| | | totalSize += assetVersion.size;//统计资源总大小 |
| | | |
| | | //添加下载任务 |
| | | var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath); |
| | | var remoteURL = StringUtility.Concat(VersionUtility.Instance.versionInfo.GetResourcesURL(versionConfig.branch), Language.fixPath, "/", assetVersion.relativePath); |
| | | var localURL = StringUtility.Concat(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath); |
| | | DownloadHotMgr.Instance.AddTask(new DownloadHotTask(remoteURL, localURL, assetVersion)); |
| | | } |
| | |
| | | state = State.Prepared; |
| | | } |
| | | dominantState = Dominant.Whole; |
| | | UIManager.Instance.OpenWindow<InGameDownLoadWin>(); |
| | | UIManager.Instance.OpenWindowAsync<InGameDownLoadWin>().Forget(); |
| | | break; |
| | | } |
| | | } |