update file system

This commit is contained in:
何冠峰
2024-07-07 00:52:17 +08:00
parent 481711fd75
commit bafd15571a
68 changed files with 483 additions and 889 deletions
@@ -2,7 +2,7 @@
namespace YooAsset
{
/// <summary>
/// 缓存文件系统
/// 解压文件系统
/// </summary>
internal class DefaultUnpackFileSystem : DefaultCacheFileSystem
{
@@ -17,5 +17,20 @@ namespace YooAsset
_saveFileRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveFilesFolderName);
_tempFileRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.TempFilesFolderName);
}
public override FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{
if (RawFileBuildPipeline)
{
var operation = new DUFSLoadRawBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
else
{
var operation = new DUFSLoadAssetBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
}
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59b123e460757694180175970bf28826
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,57 @@
namespace YooAsset
{
internal class DUFSLoadAssetBundleOperation : DCFSLoadAssetBundleOperation
{
public DUFSLoadAssetBundleOperation(DefaultUnpackFileSystem fileSystem, PackageBundle bundle) : base(fileSystem, bundle)
{
}
public override void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
while (true)
{
// 文件解压
if (_downloadFileOp != null)
{
if (_downloadFileOp.IsDone == false)
_downloadFileOp.WaitForAsyncComplete();
}
// 驱动流程
InternalOnUpdate();
// 完成后退出
if (IsDone)
break;
}
}
}
internal class DUFSLoadRawBundleOperation : DCFSLoadRawBundleOperation
{
public DUFSLoadRawBundleOperation(DefaultUnpackFileSystem fileSystem, PackageBundle bundle) : base(fileSystem, bundle)
{
}
public override void WaitForAsyncComplete()
{
while (true)
{
// 文件解压
if (_downloadFileOp != null)
{
if (_downloadFileOp.IsDone == false)
_downloadFileOp.WaitForAsyncComplete();
}
// 驱动流程
InternalOnUpdate();
// 完成后退出
if (IsDone)
break;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 47f6fe3a815d28e49815db7c09c1fa76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: