Update CacheSystem

优化缓存系统代码结构
This commit is contained in:
hevinci
2022-08-15 11:55:13 +08:00
parent aba68f859f
commit fbbf762e70
26 changed files with 306 additions and 446 deletions
@@ -86,7 +86,7 @@ namespace YooAsset
TotalDownloadCount = downloadList.Count;
foreach (var patchBundle in downloadList)
{
TotalDownloadBytes += patchBundle.FileSize;
TotalDownloadBytes += patchBundle.Bundle.FileSize;
}
}
}
@@ -138,7 +138,7 @@ namespace YooAsset
// 下载成功
_removeList.Add(downloader);
CurrentDownloadCount++;
CurrentDownloadBytes += bundleInfo.FileSize;
CurrentDownloadBytes += bundleInfo.Bundle.FileSize;
}
// 移除已经完成的下载器(无论成功或失败)
@@ -170,7 +170,7 @@ namespace YooAsset
var operation = DownloadSystem.BeginDownload(bundleInfo, _failedTryAgain);
_downloaders.Add(operation);
_downloadList.RemoveAt(index);
OnStartDownloadFileCallback?.Invoke(bundleInfo.BundleName, bundleInfo.FileSize);
OnStartDownloadFileCallback?.Invoke(bundleInfo.Bundle.BundleName, bundleInfo.Bundle.FileSize);
}
}
@@ -180,7 +180,7 @@ namespace YooAsset
if (_failedList.Count > 0)
{
var failedDownloader = _failedList[0];
string fileName = failedDownloader.GetBundleInfo().BundleName;
string fileName = failedDownloader.GetBundleInfo().Bundle.BundleName;
Error = $"Failed to download file : {fileName}";
_steps = ESteps.Done;
Status = EOperationStatus.Failed;