Update PatchSystem

增加清理缓存资源的异步操作类
This commit is contained in:
hevinci
2022-09-06 18:19:50 +08:00
parent f112f18723
commit 3f518ec321
5 changed files with 167 additions and 13 deletions

View File

@@ -203,7 +203,7 @@ namespace YooAsset
{
var hostPlayModeParameters = parameters as HostPlayModeParameters;
CacheSystem.Initialize(hostPlayModeParameters.VerifyLevel);
DownloadSystem.Initialize(hostPlayModeParameters.BreakpointResumeFileSize);
DownloadSystem.Initialize(hostPlayModeParameters.BreakpointResumeFileSize);
}
else
{
@@ -1040,10 +1040,31 @@ namespace YooAsset
/// <summary>
/// 清空未被使用的缓存文件
/// </summary>
public static void ClearUnusedCacheFiles()
public static ClearUnusedCacheFilesOperation ClearUnusedCacheFiles()
{
if (_playMode == EPlayMode.HostPlayMode)
_hostPlayModeImpl.ClearUnusedCacheFiles();
DebugCheckInitialize();
if (_playMode == EPlayMode.EditorSimulateMode)
{
var operation = new EditorPlayModeClearUnusedCacheFilesOperation();
OperationSystem.StartOperation(operation);
return operation;
}
else if (_playMode == EPlayMode.OfflinePlayMode)
{
var operation = new OfflinePlayModeClearUnusedCacheFilesOperation();
OperationSystem.StartOperation(operation);
return operation;
}
else if (_playMode == EPlayMode.HostPlayMode)
{
var operation = new HostPlayModeClearUnusedCacheFilesOperation(_hostPlayModeImpl);
OperationSystem.StartOperation(operation);
return operation;
}
else
{
throw new NotImplementedException();
}
}
#endregion