update runtime code
重构了OperationSystem的机制。从列表模式修改为链模式
This commit is contained in:
@@ -25,7 +25,7 @@ namespace YooAsset
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOpB;
|
||||
private FSClearCacheFilesOperation _clearCacheFilesOpC;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
|
||||
internal ClearCacheFilesImplOperation(IPlayMode impl, IFileSystem fileSystemA, IFileSystem fileSystemB, IFileSystem fileSystemC, string clearMode, object clearParam)
|
||||
{
|
||||
_impl = impl;
|
||||
@@ -53,8 +53,13 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpA == null)
|
||||
{
|
||||
_clearCacheFilesOpA = _fileSystemA.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpA.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpA);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpA.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpA.Progress;
|
||||
if (_clearCacheFilesOpA.IsDone == false)
|
||||
return;
|
||||
@@ -80,8 +85,13 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpB == null)
|
||||
{
|
||||
_clearCacheFilesOpB = _fileSystemB.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpB.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpB);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpB.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpB.Progress;
|
||||
if (_clearCacheFilesOpB.IsDone == false)
|
||||
return;
|
||||
@@ -108,8 +118,13 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
if (_clearCacheFilesOpC == null)
|
||||
{
|
||||
_clearCacheFilesOpC = _fileSystemC.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
|
||||
_clearCacheFilesOpC.StartOperation();
|
||||
AddChildOperation(_clearCacheFilesOpC);
|
||||
}
|
||||
|
||||
_clearCacheFilesOpC.UpdateOperation();
|
||||
Progress = _clearCacheFilesOpC.Progress;
|
||||
if (_clearCacheFilesOpC.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -63,8 +63,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.UnloadAllAssets)
|
||||
{
|
||||
if (_unloadAllAssetsOp == null)
|
||||
{
|
||||
_unloadAllAssetsOp = _resourcePackage.UnloadAllAssetsAsync();
|
||||
_unloadAllAssetsOp.StartOperation();
|
||||
AddChildOperation(_unloadAllAssetsOp);
|
||||
}
|
||||
|
||||
_unloadAllAssetsOp.UpdateOperation();
|
||||
if (_unloadAllAssetsOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -62,8 +62,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitFileSystem)
|
||||
{
|
||||
if (_initFileSystemOp == null)
|
||||
{
|
||||
_initFileSystemOp = _impl.EditorFileSystem.InitializeFileSystemAsync();
|
||||
_initFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initFileSystemOp);
|
||||
}
|
||||
|
||||
_initFileSystemOp.UpdateOperation();
|
||||
Progress = _initFileSystemOp.Progress;
|
||||
if (_initFileSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -99,8 +104,6 @@ namespace YooAsset
|
||||
private readonly OfflinePlayModeImpl _impl;
|
||||
private readonly OfflinePlayModeParameters _parameters;
|
||||
private FSInitializeFileSystemOperation _initFileSystemOp;
|
||||
private FSRequestPackageVersionOperation _requestPackageVersionOp;
|
||||
private FSLoadPackageManifestOperation _loadPackageManifestOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal OfflinePlayModeInitializationOperation(OfflinePlayModeImpl impl, OfflinePlayModeParameters parameters)
|
||||
@@ -142,8 +145,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitFileSystem)
|
||||
{
|
||||
if (_initFileSystemOp == null)
|
||||
{
|
||||
_initFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
||||
_initFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initFileSystemOp);
|
||||
}
|
||||
|
||||
_initFileSystemOp.UpdateOperation();
|
||||
Progress = _initFileSystemOp.Progress;
|
||||
if (_initFileSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -221,8 +229,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitBuildinFileSystem)
|
||||
{
|
||||
if (_initBuildinFileSystemOp == null)
|
||||
{
|
||||
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
|
||||
_initBuildinFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initBuildinFileSystemOp);
|
||||
}
|
||||
|
||||
_initBuildinFileSystemOp.UpdateOperation();
|
||||
Progress = _initBuildinFileSystemOp.Progress;
|
||||
if (_initBuildinFileSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -264,8 +277,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitCacheFileSystem)
|
||||
{
|
||||
if (_initCacheFileSystemOp == null)
|
||||
{
|
||||
_initCacheFileSystemOp = _impl.CacheFileSystem.InitializeFileSystemAsync();
|
||||
_initCacheFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initCacheFileSystemOp);
|
||||
}
|
||||
|
||||
_initCacheFileSystemOp.UpdateOperation();
|
||||
Progress = _initCacheFileSystemOp.Progress;
|
||||
if (_initCacheFileSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -344,8 +362,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitWebServerFileSystem)
|
||||
{
|
||||
if (_initWebServerFileSystemOp == null)
|
||||
{
|
||||
_initWebServerFileSystemOp = _impl.WebServerFileSystem.InitializeFileSystemAsync();
|
||||
_initWebServerFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initWebServerFileSystemOp);
|
||||
}
|
||||
|
||||
_initWebServerFileSystemOp.UpdateOperation();
|
||||
Progress = _initWebServerFileSystemOp.Progress;
|
||||
if (_initWebServerFileSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -385,8 +408,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitWebRemoteFileSystem)
|
||||
{
|
||||
if (_initWebRemoteFileSystemOp == null)
|
||||
{
|
||||
_initWebRemoteFileSystemOp = _impl.WebRemoteFileSystem.InitializeFileSystemAsync();
|
||||
_initWebRemoteFileSystemOp.StartOperation();
|
||||
AddChildOperation(_initWebRemoteFileSystemOp);
|
||||
}
|
||||
|
||||
_initWebRemoteFileSystemOp.UpdateOperation();
|
||||
Progress = _initWebRemoteFileSystemOp.Progress;
|
||||
if (_initWebRemoteFileSystemOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -197,8 +197,11 @@ namespace YooAsset
|
||||
if (_loadPackageManifestOp == null)
|
||||
{
|
||||
_loadPackageManifestOp = _impl.CacheFileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
_loadPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadPackageManifestOp.UpdateOperation();
|
||||
if (_loadPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -44,8 +44,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.RequestPackageVersion)
|
||||
{
|
||||
if (_requestPackageVersionOp == null)
|
||||
{
|
||||
_requestPackageVersionOp = _fileSystem.RequestPackageVersionAsync(_appendTimeTicks, _timeout);
|
||||
_requestPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestPackageVersionOp);
|
||||
}
|
||||
|
||||
_requestPackageVersionOp.UpdateOperation();
|
||||
if (_requestPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -73,8 +73,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.LoadPackageManifest)
|
||||
{
|
||||
if (_loadPackageManifestOp == null)
|
||||
{
|
||||
_loadPackageManifestOp = _fileSystem.LoadPackageManifestAsync(_packageVersion, _timeout);
|
||||
_loadPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadPackageManifestOp.UpdateOperation();
|
||||
if (_loadPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user