update runtime code

This commit is contained in:
hevinci
2022-12-18 21:55:49 +08:00
parent 08ad68d4a2
commit 5c16171781
20 changed files with 782 additions and 819 deletions
@@ -19,7 +19,7 @@ namespace YooAsset
public delegate void OnDownloadProgress(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes);
public delegate void OnDownloadError(string fileName, string error);
public delegate void OnStartDownloadFile(string fileName, long sizeBytes);
private readonly int _downloadingMaxNumber;
private readonly int _failedTryAgain;
private readonly int _timeout;
@@ -74,7 +74,7 @@ namespace YooAsset
/// 当开始下载某个文件
/// </summary>
public OnStartDownloadFile OnStartDownloadFileCallback { set; get; }
internal DownloaderOperation(List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
{
@@ -183,9 +183,9 @@ namespace YooAsset
{
var failedDownloader = _failedList[0];
string fileName = failedDownloader.GetBundleInfo().Bundle.BundleName;
Error = $"Failed to download file : {fileName}";
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Failed to download file : {fileName}";
OnDownloadErrorCallback?.Invoke(fileName, failedDownloader.GetLastError());
OnDownloadOverCallback?.Invoke(false);
}
@@ -241,19 +241,22 @@ namespace YooAsset
}
}
public sealed class PackageDownloaderOperation : DownloaderOperation
{
internal PackageDownloaderOperation(List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
: base(downloadList, downloadingMaxNumber, failedTryAgain, timeout)
{
}
}
public sealed class PatchDownloaderOperation : DownloaderOperation
{
internal PatchDownloaderOperation(List<BundleInfo> downloadList, int downloadingMaxNumber, int failedTryAgain, int timeout)
: base(downloadList, downloadingMaxNumber, failedTryAgain, timeout)
{
}
/// <summary>
/// 创建空的下载器
/// </summary>
internal static PatchDownloaderOperation CreateEmptyDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> downloadList = new List<BundleInfo>();
var operation = new PatchDownloaderOperation(downloadList, downloadingMaxNumber, failedTryAgain, timeout);
return operation;
}
}
public sealed class PatchUnpackerOperation : DownloaderOperation
{
@@ -261,5 +264,15 @@ namespace YooAsset
: base(downloadList, downloadingMaxNumber, failedTryAgain, timeout)
{
}
/// <summary>
/// 创建空的解压器
/// </summary>
internal static PatchUnpackerOperation CreateEmptyUnpacker(int upackingMaxNumber, int failedTryAgain, int timeout)
{
List<BundleInfo> downloadList = new List<BundleInfo>();
var operation = new PatchUnpackerOperation(downloadList, upackingMaxNumber, failedTryAgain, int.MaxValue);
return operation;
}
}
}