Update CacheSystem

This commit is contained in:
hevinci
2022-08-06 16:23:38 +08:00
parent dcd4475617
commit a1ad7acb3d
16 changed files with 202 additions and 131 deletions
@@ -12,7 +12,7 @@ namespace YooAsset
LoadFromEditor,
}
private readonly PatchBundle _patchBundle;
public readonly PatchBundle LoadBundle;
public readonly ELoadMode LoadMode;
private string _streamingPath;
@@ -50,10 +50,10 @@ namespace YooAsset
{
get
{
if (_patchBundle == null)
if (LoadBundle == null)
return string.Empty;
else
return _patchBundle.FileHash;
return LoadBundle.FileHash;
}
}
@@ -64,10 +64,10 @@ namespace YooAsset
{
get
{
if (_patchBundle == null)
if (LoadBundle == null)
return string.Empty;
else
return _patchBundle.FileCRC;
return LoadBundle.FileCRC;
}
}
@@ -78,10 +78,10 @@ namespace YooAsset
{
get
{
if (_patchBundle == null)
if (LoadBundle == null)
return 0;
else
return _patchBundle.FileSize;
return LoadBundle.FileSize;
}
}
@@ -92,10 +92,10 @@ namespace YooAsset
{
get
{
if (_patchBundle == null)
if (LoadBundle == null)
return false;
else
return _patchBundle.IsEncrypted;
return LoadBundle.IsEncrypted;
}
}
@@ -106,10 +106,10 @@ namespace YooAsset
{
get
{
if (_patchBundle == null)
if (LoadBundle == null)
return false;
else
return _patchBundle.IsRawFile;
return LoadBundle.IsRawFile;
}
}
@@ -120,7 +120,7 @@ namespace YooAsset
{
get
{
return _patchBundle == null;
return LoadBundle == null;
}
}
@@ -130,7 +130,7 @@ namespace YooAsset
}
public BundleInfo(PatchBundle patchBundle, ELoadMode loadMode, string mainURL, string fallbackURL)
{
_patchBundle = patchBundle;
LoadBundle = patchBundle;
LoadMode = loadMode;
BundleName = patchBundle.BundleName;
FileName = patchBundle.FileName;
@@ -140,7 +140,7 @@ namespace YooAsset
}
public BundleInfo(PatchBundle patchBundle, ELoadMode loadMode, string editorAssetPath)
{
_patchBundle = patchBundle;
LoadBundle = patchBundle;
LoadMode = loadMode;
BundleName = patchBundle.BundleName;
FileName = patchBundle.FileName;
@@ -150,7 +150,7 @@ namespace YooAsset
}
public BundleInfo(PatchBundle patchBundle, ELoadMode loadMode)
{
_patchBundle = patchBundle;
LoadBundle = patchBundle;
LoadMode = loadMode;
BundleName = patchBundle.BundleName;
FileName = patchBundle.FileName;
@@ -164,11 +164,11 @@ namespace YooAsset
/// </summary>
public string GetStreamingLoadPath()
{
if (_patchBundle == null)
if (LoadBundle == null)
return string.Empty;
if (string.IsNullOrEmpty(_streamingPath))
_streamingPath = PathHelper.MakeStreamingLoadPath(_patchBundle.FileName);
_streamingPath = PathHelper.MakeStreamingLoadPath(LoadBundle.FileName);
return _streamingPath;
}
@@ -177,11 +177,11 @@ namespace YooAsset
/// </summary>
public string GetCacheLoadPath()
{
if (_patchBundle == null)
if (LoadBundle == null)
return string.Empty;
if (string.IsNullOrEmpty(_cachePath))
_cachePath = SandboxHelper.MakeCacheFilePath(_patchBundle.FileName);
_cachePath = SandboxHelper.MakeCacheFilePath(LoadBundle.FileName);
return _cachePath;
}
@@ -198,7 +198,7 @@ namespace YooAsset
foreach (var patchBundle in _remotePatchManifest.BundleList)
{
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
// 忽略APP资源
@@ -131,7 +131,7 @@ namespace YooAsset
foreach (var patchBundle in LocalPatchManifest.BundleList)
{
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
// 忽略APP资源
@@ -163,7 +163,7 @@ namespace YooAsset
foreach (var patchBundle in LocalPatchManifest.BundleList)
{
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
// 忽略APP资源
@@ -233,7 +233,7 @@ namespace YooAsset
foreach (var patchBundle in checkList)
{
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
// 忽略APP资源
@@ -269,7 +269,7 @@ namespace YooAsset
continue;
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
// 查询DLC资源
@@ -301,7 +301,7 @@ namespace YooAsset
continue;
// 忽略缓存文件
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
continue;
downloadList.Add(patchBundle);
@@ -377,7 +377,7 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 查询沙盒资源
if (DownloadSystem.ContainsVerifyFile(patchBundle.FileHash))
if (CacheSystem.ContainsVerifyFile(patchBundle.FileHash))
{
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromCache);
return bundleInfo;