Update package update method

pull/9/head
hevinci 2022-05-01 20:43:00 +08:00
parent ce70eebda6
commit 2c9819762a
1 changed files with 8 additions and 12 deletions

View File

@ -8,11 +8,11 @@ namespace YooAsset
public abstract class UpdatePackageOperation : AsyncOperationBase public abstract class UpdatePackageOperation : AsyncOperationBase
{ {
/// <summary> /// <summary>
/// 开始下载 /// 创建包裹下载器
/// </summary> /// </summary>
/// <param name="downloadingMaxNumber">同时下载的最大文件数</param> /// <param name="downloadingMaxNumber">同时下载的最大文件数</param>
/// <param name="failedTryAgain">下载失败的重试次数</param> /// <param name="failedTryAgain">下载失败的重试次数</param>
public abstract PackageDownloaderOperation BeginDownloadPackage(int downloadingMaxNumber, int failedTryAgain); public abstract PackageDownloaderOperation CreatePackageDownloader(int downloadingMaxNumber, int failedTryAgain);
} }
/// <summary> /// <summary>
@ -29,13 +29,12 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 开始下载 /// 创建包裹下载器
/// </summary> /// </summary>
public override PackageDownloaderOperation BeginDownloadPackage(int downloadingMaxNumber, int failedTryAgain) public override PackageDownloaderOperation CreatePackageDownloader(int downloadingMaxNumber, int failedTryAgain)
{ {
List<BundleInfo> downloadList = new List<BundleInfo>(); List<BundleInfo> downloadList = new List<BundleInfo>();
var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain); var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
operation.BeginDownload();
return operation; return operation;
} }
} }
@ -54,13 +53,12 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 开始下载 /// 创建包裹下载器
/// </summary> /// </summary>
public override PackageDownloaderOperation BeginDownloadPackage(int downloadingMaxNumber, int failedTryAgain) public override PackageDownloaderOperation CreatePackageDownloader(int downloadingMaxNumber, int failedTryAgain)
{ {
List<BundleInfo> downloadList = new List<BundleInfo>(); List<BundleInfo> downloadList = new List<BundleInfo>();
var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain); var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
operation.BeginDownload();
return operation; return operation;
} }
} }
@ -143,22 +141,20 @@ namespace YooAsset
} }
/// <summary> /// <summary>
/// 开始下载 /// 创建包裹下载器
/// </summary> /// </summary>
public override PackageDownloaderOperation BeginDownloadPackage(int downloadingMaxNumber, int failedTryAgain) public override PackageDownloaderOperation CreatePackageDownloader(int downloadingMaxNumber, int failedTryAgain)
{ {
if (Status == EOperationStatus.Succeed) if (Status == EOperationStatus.Succeed)
{ {
List<BundleInfo> downloadList = GetDownloadList(); List<BundleInfo> downloadList = GetDownloadList();
var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain); var operation = new PackageDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain);
operation.BeginDownload();
return operation; return operation;
} }
else else
{ {
YooLogger.Error($"{nameof(UpdatePackageOperation)} status is failed !"); YooLogger.Error($"{nameof(UpdatePackageOperation)} status is failed !");
var operation = new PackageDownloaderOperation(null, downloadingMaxNumber, failedTryAgain); var operation = new PackageDownloaderOperation(null, downloadingMaxNumber, failedTryAgain);
operation.BeginDownload();
return operation; return operation;
} }
} }