mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 09:10:11 +00:00
Update CacheSystem
优化缓存系统代码结构
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建文件
|
||||
/// 创建文件(如果已经存在则删除旧文件)
|
||||
/// </summary>
|
||||
public static void CreateFile(string filePath, string content)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user