Update DownloadSystem

This commit is contained in:
hevinci
2022-03-29 19:45:20 +08:00
parent 32d422aeaa
commit 2d9cccae6f
5 changed files with 33 additions and 36 deletions
@@ -41,7 +41,7 @@ namespace YooAsset
private readonly List<ProviderBase> _providers = new List<ProviderBase>(100);
private bool _isWaitForAsyncComplete = false;
private bool _isShowWaitForAsyncError = false;
private FileDownloader _fileDownloader;
private DownloaderBase _downloader;
private AssetBundleCreateRequest _cacheRequest;
internal AssetBundle CacheBundle { private set; get; }
@@ -106,19 +106,19 @@ namespace YooAsset
if (Status == EStatus.Download)
{
int failedTryAgain = int.MaxValue;
_fileDownloader = DownloadSystem.BeginDownload(BundleFileInfo, failedTryAgain);
_downloader = DownloadSystem.BeginDownload(BundleFileInfo, failedTryAgain);
Status = EStatus.CheckDownload;
}
// 2. 检测服务器下载结果
if (Status == EStatus.CheckDownload)
{
if (_fileDownloader.IsDone() == false)
if (_downloader.IsDone() == false)
return;
if (_fileDownloader.HasError())
if (_downloader.HasError())
{
_fileDownloader.ReportError();
_downloader.ReportError();
Status = EStatus.Fail;
}
else
@@ -19,7 +19,7 @@ namespace YooAsset
private readonly BundleInfo _bundleInfo;
private readonly string _savePath;
private ESteps _steps = ESteps.None;
private FileDownloader _fileDownloader;
private DownloaderBase _downloader;
private UnityWebFileRequester _fileRequester;
/// <summary>
@@ -67,21 +67,21 @@ namespace YooAsset
if (_steps == ESteps.DownloadFromWeb)
{
int failedTryAgain = int.MaxValue;
_fileDownloader = DownloadSystem.BeginDownload(_bundleInfo, failedTryAgain);
_downloader = DownloadSystem.BeginDownload(_bundleInfo, failedTryAgain);
_steps = ESteps.CheckDownloadFromWeb;
}
// 3. 检测服务器下载结果
if (_steps == ESteps.CheckDownloadFromWeb)
{
if (_fileDownloader.IsDone() == false)
if (_downloader.IsDone() == false)
return;
if (_fileDownloader.HasError())
if (_downloader.HasError())
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = _fileDownloader.GetLastError();
Error = _downloader.GetLastError();
}
else
{