update cache system

优化了缓存系统初始化逻辑,支持分帧获取所有缓存文件。
This commit is contained in:
hevinci
2023-02-28 18:25:27 +08:00
parent 7c4dbb1f38
commit ebcb05cc55
8 changed files with 257 additions and 67 deletions
@@ -46,7 +46,7 @@ namespace YooAsset
/// </summary>
public int[] ReferenceIDs;
/// <summary>
/// 所属的包裹名称
/// </summary>
@@ -71,8 +71,16 @@ namespace YooAsset
if (string.IsNullOrEmpty(_cachedDataFilePath) == false)
return _cachedDataFilePath;
string cacheRoot = PersistentHelper.GetCacheFolderPath(PackageName);
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
if (IsRawFile)
{
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
}
else
{
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
}
return _cachedDataFilePath;
}
}
@@ -88,8 +96,16 @@ namespace YooAsset
if (string.IsNullOrEmpty(_cachedInfoFilePath) == false)
return _cachedInfoFilePath;
string cacheRoot = PersistentHelper.GetCacheFolderPath(PackageName);
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
if (IsRawFile)
{
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
}
else
{
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
}
return _cachedInfoFilePath;
}
}