Patch DownLoader added a method to download all resources.

补丁下载器新增下载全部资源的方法。
This commit is contained in:
hevinci
2022-05-01 15:26:48 +08:00
parent b0397981ce
commit 47af58bb5b
2 changed files with 63 additions and 18 deletions

View File

@@ -59,6 +59,38 @@ namespace YooAsset
return LocalPatchManifest.ResourceVersion;
}
/// <summary>
/// 创建下载器
/// </summary>
public DownloaderOperation CreateDownloaderByAll(int fileLoadingMaxNumber, int failedTryAgain)
{
List<BundleInfo> downloadList = GetDownloadListByAll();
var operation = new DownloaderOperation(downloadList, fileLoadingMaxNumber, failedTryAgain);
return operation;
}
private List<BundleInfo> GetDownloadListByAll()
{
List<PatchBundle> downloadList = new List<PatchBundle>(1000);
foreach (var patchBundle in LocalPatchManifest.BundleList)
{
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.Hash))
continue;
// 忽略APP资源
// 注意如果是APP资源并且哈希值相同则不需要下载
if (AppPatchManifest.Bundles.TryGetValue(patchBundle.BundleName, out PatchBundle appPatchBundle))
{
if (appPatchBundle.IsBuildin && appPatchBundle.Hash == patchBundle.Hash)
continue;
}
downloadList.Add(patchBundle);
}
return ConvertToDownloadList(downloadList);
}
/// <summary>
/// 创建下载器
/// </summary>