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

View File

@@ -109,14 +109,6 @@ namespace YooAsset
{
return PathHelper.MakePersistentLoadPath(CacheFolderName);
}
/// <summary>
/// 获取缓存文件的存储路径
/// </summary>
public static string MakeCacheFilePath(string fileName)
{
return PathHelper.MakePersistentLoadPath($"{CacheFolderName}/{fileName}");
}
}
/// <summary>
@@ -140,5 +132,26 @@ namespace YooAsset
}
return result.ToArray();
}
/// <summary>
/// 资源解压相关
/// </summary>
public static List<BundleInfo> ConvertToUnpackList(List<PatchBundle> unpackList)
{
List<BundleInfo> result = new List<BundleInfo>(unpackList.Count);
foreach (var patchBundle in unpackList)
{
var bundleInfo = ConvertToUnpackInfo(patchBundle);
result.Add(bundleInfo);
}
return result;
}
public static BundleInfo ConvertToUnpackInfo(PatchBundle patchBundle)
{
// 注意:我们把流加载路径指定为远端下载地址
string streamingPath = PathHelper.ConvertToWWWPath(patchBundle.StreamingFilePath);
BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming, streamingPath, streamingPath);
return bundleInfo;
}
}
}

View File

@@ -127,7 +127,7 @@ namespace YooAsset
}
/// <summary>
/// 创建文件
/// 创建文件(如果已经存在则删除旧文件)
/// </summary>
public static void CreateFile(string filePath, string content)
{