Compare commits

..

No commits in common. "61afb70cb9cacda7e3505f9b1654f45f57924a95" and "64e9734bbeb46c4a8b50cfcc20aa5cec9864213b" have entirely different histories.

135 changed files with 585 additions and 716 deletions

View File

@ -2,20 +2,6 @@
All notable changes to this package will be documented in this file. All notable changes to this package will be documented in this file.
## [2.3.1-preview] - 2025-02-25
**资源加载依赖计算方式还原为了1.5x版本的模式,只加载资源对象实际依赖的资源包,不再以资源对象所在资源包的依赖关系为加载标准**。
### Improvements
- 优化OperationSystem的更新机制异步加载的耗时降低了50%。
- 优化了Debugger窗口的显示页面BundleView页面增加资源包的引用列表。
- 优化了Reporter窗口的显示页面。
### Fixed
- 修复了怀旧依赖模式下TAG传染不正确的问题。
## [2.3.0-preview] - 2025-02-19 ## [2.3.0-preview] - 2025-02-19
### Improvements ### Improvements

View File

@ -16,11 +16,11 @@ namespace YooAsset
internal UnityWebDataRequestOperation(string url, int timeout = 60) : base(url, timeout) internal UnityWebDataRequestOperation(string url, int timeout = 60) : base(url, timeout)
{ {
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateRequest; _steps = ESteps.CreateRequest;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -59,7 +59,7 @@ namespace YooAsset
DisposeRequest(); DisposeRequest();
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeRequest(); DisposeRequest();

View File

@ -12,11 +12,11 @@ namespace YooAsset
{ {
_fileSavePath = fileSavePath; _fileSavePath = fileSavePath;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateRequest; _steps = ESteps.CreateRequest;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -54,7 +54,7 @@ namespace YooAsset
DisposeRequest(); DisposeRequest();
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeRequest(); DisposeRequest();

View File

@ -16,11 +16,11 @@ namespace YooAsset
internal UnityWebTextRequestOperation(string url, int timeout = 60) : base(url, timeout) internal UnityWebTextRequestOperation(string url, int timeout = 60) : base(url, timeout)
{ {
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateRequest; _steps = ESteps.CreateRequest;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -59,7 +59,7 @@ namespace YooAsset
DisposeRequest(); DisposeRequest();
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeRequest(); DisposeRequest();

View File

@ -48,21 +48,25 @@ namespace YooAsset
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo) public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
{ {
var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo); var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo) public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo); var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo) public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo); var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad) public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
{ {
var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad); var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
} }

View File

@ -25,11 +25,11 @@ namespace YooAsset
_assetBundle = assetBundle; _assetBundle = assetBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -25,11 +25,11 @@ namespace YooAsset
_assetBundle = assetBundle; _assetBundle = assetBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -25,11 +25,11 @@ namespace YooAsset
_loadParams = loadParams; _loadParams = loadParams;
_suspendLoad = suspendLoad; _suspendLoad = suspendLoad;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadScene; _steps = ESteps.LoadScene;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -107,7 +107,7 @@ namespace YooAsset
internal override void InternalWaitForAsyncComplete() internal override void InternalWaitForAsyncComplete()
{ {
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法! //TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
InternalUpdate(); InternalOnUpdate();
} }
public override void UnSuspendLoad() public override void UnSuspendLoad()
{ {

View File

@ -25,11 +25,11 @@ namespace YooAsset
_assetBundle = assetBundle; _assetBundle = assetBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -3,12 +3,12 @@ namespace YooAsset
{ {
internal class RawBundleLoadAllAssetsOperation : FSLoadAllAssetsOperation internal class RawBundleLoadAllAssetsOperation : FSLoadAllAssetsOperation
{ {
internal override void InternalStart() internal override void InternalOnStart()
{ {
Error = $"{nameof(RawBundleLoadAllAssetsOperation)} not support load all assets !"; Error = $"{nameof(RawBundleLoadAllAssetsOperation)} not support load all assets !";
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -3,12 +3,12 @@ namespace YooAsset
{ {
internal class RawBundleLoadAssetOperation : FSLoadAssetOperation internal class RawBundleLoadAssetOperation : FSLoadAssetOperation
{ {
internal override void InternalStart() internal override void InternalOnStart()
{ {
Error = $"{nameof(RawBundleLoadAssetOperation)} not support load asset !"; Error = $"{nameof(RawBundleLoadAssetOperation)} not support load asset !";
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -3,12 +3,12 @@ namespace YooAsset
{ {
internal class RawBundleLoadSceneOperation : FSLoadSceneOperation internal class RawBundleLoadSceneOperation : FSLoadSceneOperation
{ {
internal override void InternalStart() internal override void InternalOnStart()
{ {
Error = $"{nameof(RawBundleLoadSceneOperation)} not support load scene !"; Error = $"{nameof(RawBundleLoadSceneOperation)} not support load scene !";
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
public override void UnSuspendLoad() public override void UnSuspendLoad()

View File

@ -3,12 +3,12 @@ namespace YooAsset
{ {
internal class RawBundleLoadSubAssetsOperation : FSLoadSubAssetsOperation internal class RawBundleLoadSubAssetsOperation : FSLoadSubAssetsOperation
{ {
internal override void InternalStart() internal override void InternalOnStart()
{ {
Error = $"{nameof(RawBundleLoadSubAssetsOperation)} not support load sub assets !"; Error = $"{nameof(RawBundleLoadSubAssetsOperation)} not support load sub assets !";
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -32,21 +32,25 @@ namespace YooAsset
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo) public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
{ {
var operation = new RawBundleLoadAssetOperation(); var operation = new RawBundleLoadAssetOperation();
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo) public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new RawBundleLoadAllAssetsOperation(); var operation = new RawBundleLoadAllAssetsOperation();
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo) public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new RawBundleLoadSubAssetsOperation(); var operation = new RawBundleLoadSubAssetsOperation();
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad) public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
{ {
var operation = new RawBundleLoadSceneOperation(); var operation = new RawBundleLoadSceneOperation();
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
} }

View File

@ -22,7 +22,7 @@ namespace YooAsset
_packageBundle = packageBundle; _packageBundle = packageBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
@ -32,7 +32,7 @@ namespace YooAsset
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)

View File

@ -21,7 +21,7 @@ namespace YooAsset
_packageBundle = packageBundle; _packageBundle = packageBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
@ -31,7 +31,7 @@ namespace YooAsset
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)

View File

@ -25,7 +25,7 @@ namespace YooAsset
_loadParams = loadParams; _loadParams = loadParams;
_suspendLoad = suspendLoad; _suspendLoad = suspendLoad;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
_steps = ESteps.LoadScene; _steps = ESteps.LoadScene;
@ -35,7 +35,7 @@ namespace YooAsset
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
@ -113,7 +113,7 @@ namespace YooAsset
internal override void InternalWaitForAsyncComplete() internal override void InternalWaitForAsyncComplete()
{ {
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法! //TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
InternalUpdate(); InternalOnUpdate();
} }
public override void UnSuspendLoad() public override void UnSuspendLoad()
{ {

View File

@ -22,7 +22,7 @@ namespace YooAsset
_packageBundle = packageBundle; _packageBundle = packageBundle;
_assetInfo = assetInfo; _assetInfo = assetInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
_steps = ESteps.CheckBundle; _steps = ESteps.CheckBundle;
@ -32,7 +32,7 @@ namespace YooAsset
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)

View File

@ -32,21 +32,25 @@ namespace YooAsset
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo) public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
{ {
var operation = new VirtualBundleLoadAssetOperation(_packageBundle, assetInfo); var operation = new VirtualBundleLoadAssetOperation(_packageBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo) public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new VirtualBundleLoadAllAssetsOperation(_packageBundle, assetInfo); var operation = new VirtualBundleLoadAllAssetsOperation(_packageBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo) public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
{ {
var operation = new VirtualBundleLoadSubAssetsOperation(_packageBundle, assetInfo); var operation = new VirtualBundleLoadSubAssetsOperation(_packageBundle, assetInfo);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad) public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
{ {
var operation = new VirtualBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad); var operation = new VirtualBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
return operation; return operation;
} }
} }

View File

@ -92,16 +92,19 @@ namespace YooAsset
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync() public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{ {
var operation = new DBFSInitializeOperation(this); var operation = new DBFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout) public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{ {
var operation = new DBFSLoadPackageManifestOperation(this, packageVersion); var operation = new DBFSLoadPackageManifestOperation(this, packageVersion);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout) public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new DBFSRequestPackageVersionOperation(this); var operation = new DBFSRequestPackageVersionOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam) public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
@ -124,17 +127,20 @@ namespace YooAsset
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle) if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{ {
var operation = new DBFSLoadAssetBundleOperation(this, bundle); var operation = new DBFSLoadAssetBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle) else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
{ {
var operation = new DBFSLoadRawBundleOperation(this, bundle); var operation = new DBFSLoadRawBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"{nameof(DefaultBuildinFileSystem)} not support load bundle type : {bundle.BundleType}"; string error = $"{nameof(DefaultBuildinFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error); var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
@ -188,8 +194,9 @@ namespace YooAsset
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices); _unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
_unpackFileSystem.OnCreate(packageName, null); _unpackFileSystem.OnCreate(packageName, null);
} }
public virtual void OnDestroy() public virtual void OnUpdate()
{ {
_unpackFileSystem.OnUpdate();
} }
public virtual bool Belong(PackageBundle bundle) public virtual bool Belong(PackageBundle bundle)
@ -339,12 +346,9 @@ namespace YooAsset
return false; return false;
#if UNITY_ANDROID #if UNITY_ANDROID
if (bundle.Encrypted) if (bundle.BundleType == (int)EBuildBundleType.RawBundle || bundle.Encrypted)
return true; return true;
else
if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
return true;
return false; return false;
#else #else
return false; return false;

View File

@ -24,7 +24,7 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
_steps = ESteps.Done; _steps = ESteps.Done;
@ -37,7 +37,7 @@ namespace YooAsset
_steps = ESteps.InitUnpackFileSystem; _steps = ESteps.InitUnpackFileSystem;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -47,11 +47,9 @@ namespace YooAsset
if (_copyBuildinPackageManifestOp == null) if (_copyBuildinPackageManifestOp == null)
{ {
_copyBuildinPackageManifestOp = new CopyBuildinPackageManifestOperation(_fileSystem); _copyBuildinPackageManifestOp = new CopyBuildinPackageManifestOperation(_fileSystem);
_copyBuildinPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _copyBuildinPackageManifestOp);
AddChildOperation(_copyBuildinPackageManifestOp);
} }
_copyBuildinPackageManifestOp.UpdateOperation();
if (_copyBuildinPackageManifestOp.IsDone == false) if (_copyBuildinPackageManifestOp.IsDone == false)
return; return;
@ -70,13 +68,8 @@ namespace YooAsset
if (_steps == ESteps.InitUnpackFileSystem) if (_steps == ESteps.InitUnpackFileSystem)
{ {
if (_initUnpackFIleSystemOp == null) if (_initUnpackFIleSystemOp == null)
{
_initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem(); _initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem();
_initUnpackFIleSystemOp.StartOperation();
AddChildOperation(_initUnpackFIleSystemOp);
}
_initUnpackFIleSystemOp.UpdateOperation();
Progress = _initUnpackFIleSystemOp.Progress; Progress = _initUnpackFIleSystemOp.Progress;
if (_initUnpackFIleSystemOp.IsDone == false) if (_initUnpackFIleSystemOp.IsDone == false)
return; return;
@ -120,11 +113,9 @@ namespace YooAsset
#endif #endif
_loadCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem); _loadCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem);
_loadCatalogFileOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadCatalogFileOp);
AddChildOperation(_loadCatalogFileOp);
} }
_loadCatalogFileOp.UpdateOperation();
if (_loadCatalogFileOp.IsDone == false) if (_loadCatalogFileOp.IsDone == false)
return; return;

View File

@ -29,13 +29,13 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
DownloadProgress = 1f; DownloadProgress = 1f;
DownloadedBytes = _bundle.FileSize; DownloadedBytes = _bundle.FileSize;
_steps = ESteps.LoadAssetBundle; _steps = ESteps.LoadAssetBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -139,6 +139,9 @@ namespace YooAsset
} }
} }
} }
public override void AbortDownloadOperation()
{
}
} }
/// <summary> /// <summary>
@ -163,13 +166,13 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
DownloadProgress = 1f; DownloadProgress = 1f;
DownloadedBytes = _bundle.FileSize; DownloadedBytes = _bundle.FileSize;
_steps = ESteps.LoadBuildinRawBundle; _steps = ESteps.LoadBuildinRawBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -203,5 +206,8 @@ namespace YooAsset
} }
} }
} }
public override void AbortDownloadOperation()
{
}
} }
} }

View File

@ -23,11 +23,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_packageVersion = packageVersion; _packageVersion = packageVersion;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestBuildinPackageHash; _steps = ESteps.RequestBuildinPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -37,11 +37,9 @@ namespace YooAsset
if (_requestBuildinPackageHashOp == null) if (_requestBuildinPackageHashOp == null)
{ {
_requestBuildinPackageHashOp = new RequestBuildinPackageHashOperation(_fileSystem, _packageVersion); _requestBuildinPackageHashOp = new RequestBuildinPackageHashOperation(_fileSystem, _packageVersion);
_requestBuildinPackageHashOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageHashOp);
AddChildOperation(_requestBuildinPackageHashOp);
} }
_requestBuildinPackageHashOp.UpdateOperation();
if (_requestBuildinPackageHashOp.IsDone == false) if (_requestBuildinPackageHashOp.IsDone == false)
return; return;
@ -63,11 +61,9 @@ namespace YooAsset
{ {
string packageHash = _requestBuildinPackageHashOp.PackageHash; string packageHash = _requestBuildinPackageHashOp.PackageHash;
_loadBuildinPackageManifestOp = new LoadBuildinPackageManifestOperation(_fileSystem, _packageVersion, packageHash); _loadBuildinPackageManifestOp = new LoadBuildinPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
_loadBuildinPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadBuildinPackageManifestOp);
AddChildOperation(_loadBuildinPackageManifestOp);
} }
_loadBuildinPackageManifestOp.UpdateOperation();
if (_loadBuildinPackageManifestOp.IsDone == false) if (_loadBuildinPackageManifestOp.IsDone == false)
return; return;

View File

@ -19,11 +19,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -33,11 +33,9 @@ namespace YooAsset
if (_requestBuildinPackageVersionOp == null) if (_requestBuildinPackageVersionOp == null)
{ {
_requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem); _requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem);
_requestBuildinPackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageVersionOp);
AddChildOperation(_requestBuildinPackageVersionOp);
} }
_requestBuildinPackageVersionOp.UpdateOperation();
if (_requestBuildinPackageVersionOp.IsDone == false) if (_requestBuildinPackageVersionOp.IsDone == false)
return; return;

View File

@ -29,11 +29,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -43,11 +43,9 @@ namespace YooAsset
if (_requestBuildinPackageVersionOp == null) if (_requestBuildinPackageVersionOp == null)
{ {
_requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem); _requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem);
_requestBuildinPackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageVersionOp);
AddChildOperation(_requestBuildinPackageVersionOp);
} }
_requestBuildinPackageVersionOp.UpdateOperation();
if (_requestBuildinPackageVersionOp.IsDone == false) if (_requestBuildinPackageVersionOp.IsDone == false)
return; return;
@ -84,11 +82,9 @@ namespace YooAsset
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion); string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath); string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath); _hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
_hashFileRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _hashFileRequestOp);
AddChildOperation(_hashFileRequestOp);
} }
_hashFileRequestOp.UpdateOperation();
if (_hashFileRequestOp.IsDone == false) if (_hashFileRequestOp.IsDone == false)
return; return;
@ -125,11 +121,9 @@ namespace YooAsset
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion); string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath); string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath); _manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
_manifestFileRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _manifestFileRequestOp);
AddChildOperation(_manifestFileRequestOp);
} }
_manifestFileRequestOp.UpdateOperation();
if (_manifestFileRequestOp.IsDone == false) if (_manifestFileRequestOp.IsDone == false)
return; return;

View File

@ -19,11 +19,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadCatalog; _steps = ESteps.LoadCatalog;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -31,11 +31,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_packageHash = packageHash; _packageHash = packageHash;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestFileData; _steps = ESteps.RequestFileData;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -47,11 +47,9 @@ namespace YooAsset
string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion); string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webDataRequestOp = new UnityWebDataRequestOperation(url); _webDataRequestOp = new UnityWebDataRequestOperation(url);
_webDataRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
AddChildOperation(_webDataRequestOp);
} }
_webDataRequestOp.UpdateOperation();
if (_webDataRequestOp.IsDone == false) if (_webDataRequestOp.IsDone == false)
return; return;
@ -87,11 +85,9 @@ namespace YooAsset
if (_deserializer == null) if (_deserializer == null)
{ {
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result); _deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
_deserializer.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
AddChildOperation(_deserializer);
} }
_deserializer.UpdateOperation();
Progress = _deserializer.Progress; Progress = _deserializer.Progress;
if (_deserializer.IsDone == false) if (_deserializer.IsDone == false)
return; return;

View File

@ -26,11 +26,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_packageVersion = packageVersion; _packageVersion = packageVersion;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageHash; _steps = ESteps.RequestPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -42,11 +42,9 @@ namespace YooAsset
string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion); string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webTextRequestOp = new UnityWebTextRequestOperation(url); _webTextRequestOp = new UnityWebTextRequestOperation(url);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -24,11 +24,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -40,11 +40,9 @@ namespace YooAsset
string filePath = _fileSystem.GetBuildinPackageVersionFilePath(); string filePath = _fileSystem.GetBuildinPackageVersionFilePath();
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webTextRequestOp = new UnityWebTextRequestOperation(url); _webTextRequestOp = new UnityWebTextRequestOperation(url);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -3,33 +3,33 @@ using System.Collections.Generic;
namespace YooAsset namespace YooAsset
{ {
internal class DownloadCenterOperation : AsyncOperationBase internal class DefaultCacheDownloadCenter
{ {
private readonly DefaultCacheFileSystem _fileSystem; private readonly DefaultCacheFileSystem _fileSystem;
protected readonly Dictionary<string, DefaultDownloadFileOperation> _downloaders = new Dictionary<string, DefaultDownloadFileOperation>(1000); protected readonly Dictionary<string, DefaultDownloadFileOperation> _downloaders = new Dictionary<string, DefaultDownloadFileOperation>(1000);
protected readonly List<string> _removeDownloadList = new List<string>(1000); protected readonly List<string> _removeDownloadList = new List<string>(1000);
public DownloadCenterOperation(DefaultCacheFileSystem fileSystem) public DefaultCacheDownloadCenter(DefaultCacheFileSystem fileSystem)
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart()
{ /// <summary>
} /// 更新下载中心
internal override void InternalUpdate() /// </summary>
public void Update()
{ {
// 获取可移除的下载器集合 // 获取可移除的下载器集合
_removeDownloadList.Clear(); _removeDownloadList.Clear();
foreach (var valuePair in _downloaders) foreach (var valuePair in _downloaders)
{ {
var downloader = valuePair.Value; var downloader = valuePair.Value;
downloader.UpdateOperation();
// 注意:主动终止引用计数为零的下载任务 // 注意:主动终止引用计数为零的下载任务
if (downloader.RefCount <= 0) if (downloader.RefCount <= 0)
{ {
_removeDownloadList.Add(valuePair.Key); _removeDownloadList.Add(valuePair.Key);
downloader.AbortOperation(); downloader.SetAbort();
continue; continue;
} }
@ -61,7 +61,7 @@ namespace YooAsset
var operation = operationPair.Value; var operation = operationPair.Value;
if (operation.Status == EOperationStatus.None) if (operation.Status == EOperationStatus.None)
{ {
operation.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, operation);
startCount--; startCount--;
if (startCount <= 0) if (startCount <= 0)
break; break;
@ -79,6 +79,7 @@ namespace YooAsset
// 查询旧的下载器 // 查询旧的下载器
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader)) if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
{ {
oldDownloader.Reference();
return oldDownloader; return oldDownloader;
} }
@ -100,13 +101,13 @@ namespace YooAsset
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize) if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
{ {
newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, param); newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, param);
AddChildOperation(newDownloader); newDownloader.Reference();
_downloaders.Add(bundle.BundleGUID, newDownloader); _downloaders.Add(bundle.BundleGUID, newDownloader);
} }
else else
{ {
newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, param); newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, param);
AddChildOperation(newDownloader); newDownloader.Reference();
_downloaders.Add(bundle.BundleGUID, newDownloader); _downloaders.Add(bundle.BundleGUID, newDownloader);
} }
return newDownloader; return newDownloader;

View File

@ -15,18 +15,13 @@ namespace YooAsset
protected readonly Dictionary<string, string> _bundleDataFilePathMapping = new Dictionary<string, string>(10000); protected readonly Dictionary<string, string> _bundleDataFilePathMapping = new Dictionary<string, string>(10000);
protected readonly Dictionary<string, string> _bundleInfoFilePathMapping = new Dictionary<string, string>(10000); protected readonly Dictionary<string, string> _bundleInfoFilePathMapping = new Dictionary<string, string>(10000);
protected readonly Dictionary<string, string> _tempFilePathMapping = new Dictionary<string, string>(10000); protected readonly Dictionary<string, string> _tempFilePathMapping = new Dictionary<string, string>(10000);
protected DefaultCacheDownloadCenter _downloadCenter;
protected string _packageRoot; protected string _packageRoot;
protected string _tempFilesRoot; protected string _tempFilesRoot;
protected string _cacheBundleFilesRoot; protected string _cacheBundleFilesRoot;
protected string _cacheManifestFilesRoot; protected string _cacheManifestFilesRoot;
/// <summary>
/// 下载中心
/// 说明:当异步操作任务终止的时候,所有下载子任务都会一同被终止!
/// </summary>
public DownloadCenterOperation DownloadCenter { set; get; }
/// <summary> /// <summary>
/// 包裹名称 /// 包裹名称
/// </summary> /// </summary>
@ -103,16 +98,19 @@ namespace YooAsset
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync() public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{ {
var operation = new DCFSInitializeOperation(this); var operation = new DCFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout) public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{ {
var operation = new DCFSLoadPackageManifestOperation(this, packageVersion, timeout); var operation = new DCFSLoadPackageManifestOperation(this, packageVersion, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout) public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout); var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam) public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
@ -120,57 +118,64 @@ namespace YooAsset
if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString()) if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{ {
var operation = new ClearAllCacheBundleFilesOperation(this); var operation = new ClearAllCacheBundleFilesOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString()) else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
{ {
var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest); var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (clearMode == EFileClearMode.ClearBundleFilesByTags.ToString()) else if (clearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
{ {
var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, clearParam); var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, clearParam);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (clearMode == EFileClearMode.ClearAllManifestFiles.ToString()) else if (clearMode == EFileClearMode.ClearAllManifestFiles.ToString())
{ {
var operation = new ClearAllCacheManifestFilesOperation(this); var operation = new ClearAllCacheManifestFilesOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (clearMode == EFileClearMode.ClearUnusedManifestFiles.ToString()) else if (clearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
{ {
var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest); var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"Invalid clear mode : {clearMode}"; string error = $"Invalid clear mode : {clearMode}";
var operation = new FSClearCacheFilesCompleteOperation(error); var operation = new FSClearCacheFilesCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param) public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
{ {
var downloader = DownloadCenter.DownloadFileAsync(bundle, param); return _downloadCenter.DownloadFileAsync(bundle, param);
downloader.Reference(); //增加下载器的引用计数
return downloader;
} }
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle) public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{ {
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle) if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{ {
var operation = new DCFSLoadAssetBundleOperation(this, bundle); var operation = new DCFSLoadAssetBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle) else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
{ {
var operation = new DCFSLoadRawBundleOperation(this, bundle); var operation = new DCFSLoadRawBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"{nameof(DefaultCacheFileSystem)} not support load bundle type : {bundle.BundleType}"; string error = $"{nameof(DefaultCacheFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error); var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
@ -226,14 +231,11 @@ namespace YooAsset
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName); _cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName);
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName); _tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName); _cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
_downloadCenter = new DefaultCacheDownloadCenter(this);
} }
public virtual void OnDestroy() public virtual void OnUpdate()
{ {
if (DownloadCenter != null) _downloadCenter.Update();
{
DownloadCenter.AbortOperation();
DownloadCenter = null;
}
} }
public virtual bool Belong(PackageBundle bundle) public virtual bool Belong(PackageBundle bundle)

View File

@ -9,7 +9,6 @@ namespace YooAsset
CheckAppFootPrint, CheckAppFootPrint,
SearchCacheFiles, SearchCacheFiles,
VerifyCacheFiles, VerifyCacheFiles,
CreateDownloadCenter,
Done, Done,
} }
@ -23,7 +22,7 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
#if UNITY_WEBGL #if UNITY_WEBGL
_steps = ESteps.Done; _steps = ESteps.Done;
@ -33,7 +32,7 @@ namespace YooAsset
_steps = ESteps.CheckAppFootPrint; _steps = ESteps.CheckAppFootPrint;
#endif #endif
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -59,11 +58,9 @@ namespace YooAsset
if (_searchCacheFilesOp == null) if (_searchCacheFilesOp == null)
{ {
_searchCacheFilesOp = new SearchCacheFilesOperation(_fileSystem); _searchCacheFilesOp = new SearchCacheFilesOperation(_fileSystem);
_searchCacheFilesOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _searchCacheFilesOp);
AddChildOperation(_searchCacheFilesOp);
} }
_searchCacheFilesOp.UpdateOperation();
Progress = _searchCacheFilesOp.Progress; Progress = _searchCacheFilesOp.Progress;
if (_searchCacheFilesOp.IsDone == false) if (_searchCacheFilesOp.IsDone == false)
return; return;
@ -76,18 +73,17 @@ namespace YooAsset
if (_verifyCacheFilesOp == null) if (_verifyCacheFilesOp == null)
{ {
_verifyCacheFilesOp = new VerifyCacheFilesOperation(_fileSystem, _searchCacheFilesOp.Result); _verifyCacheFilesOp = new VerifyCacheFilesOperation(_fileSystem, _searchCacheFilesOp.Result);
_verifyCacheFilesOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _verifyCacheFilesOp);
AddChildOperation(_verifyCacheFilesOp);
} }
_verifyCacheFilesOp.UpdateOperation();
Progress = _verifyCacheFilesOp.Progress; Progress = _verifyCacheFilesOp.Progress;
if (_verifyCacheFilesOp.IsDone == false) if (_verifyCacheFilesOp.IsDone == false)
return; return;
if (_verifyCacheFilesOp.Status == EOperationStatus.Succeed) if (_verifyCacheFilesOp.Status == EOperationStatus.Succeed)
{ {
_steps = ESteps.CreateDownloadCenter; _steps = ESteps.Done;
Status = EOperationStatus.Succeed;
YooLogger.Log($"Package '{_fileSystem.PackageName}' cached files count : {_fileSystem.FileCount}"); YooLogger.Log($"Package '{_fileSystem.PackageName}' cached files count : {_fileSystem.FileCount}");
} }
else else
@ -97,18 +93,6 @@ namespace YooAsset
Error = _verifyCacheFilesOp.Error; Error = _verifyCacheFilesOp.Error;
} }
} }
if (_steps == ESteps.CreateDownloadCenter)
{
if (_fileSystem.DownloadCenter == null)
{
_fileSystem.DownloadCenter = new DownloadCenterOperation(_fileSystem);
OperationSystem.StartOperation(_fileSystem.PackageName, _fileSystem.DownloadCenter);
}
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
} }
} }
} }

View File

@ -29,11 +29,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckExist; _steps = ESteps.CheckExist;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -54,9 +54,6 @@ namespace YooAsset
if (_steps == ESteps.DownloadFile) if (_steps == ESteps.DownloadFile)
{ {
// 注意:下载的异步任务由管理器驱动
// 注意不加到子任务列表里防止Abort的时候将下载器直接关闭
// 注意边玩边下下载器引用计数没有Release
if (_downloadFileOp == null) if (_downloadFileOp == null)
{ {
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60); DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
@ -222,6 +219,14 @@ namespace YooAsset
} }
} }
} }
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadFile)
{
if (_downloadFileOp != null)
_downloadFileOp.SetAbort();
}
}
} }
internal class DCFSLoadRawBundleOperation : FSLoadBundleOperation internal class DCFSLoadRawBundleOperation : FSLoadBundleOperation
@ -246,11 +251,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckExist; _steps = ESteps.CheckExist;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -271,9 +276,6 @@ namespace YooAsset
if (_steps == ESteps.DownloadFile) if (_steps == ESteps.DownloadFile)
{ {
// 注意:下载的异步任务由管理器驱动
// 注意不加到子任务列表里防止Abort的时候将下载器直接关闭
// 注意边玩边下下载器引用计数没有Release
if (_downloadFileOp == null) if (_downloadFileOp == null)
{ {
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60); DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
@ -333,5 +335,13 @@ namespace YooAsset
} }
} }
} }
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadFile)
{
if (_downloadFileOp != null)
_downloadFileOp.SetAbort();
}
}
} }
} }

View File

@ -30,11 +30,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.DownloadPackageHash; _steps = ESteps.DownloadPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -44,11 +44,9 @@ namespace YooAsset
if (_downloadPackageHashOp == null) if (_downloadPackageHashOp == null)
{ {
_downloadPackageHashOp = new DownloadPackageHashOperation(_fileSystem, _packageVersion, _timeout); _downloadPackageHashOp = new DownloadPackageHashOperation(_fileSystem, _packageVersion, _timeout);
_downloadPackageHashOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadPackageHashOp);
AddChildOperation(_downloadPackageHashOp);
} }
_downloadPackageHashOp.UpdateOperation();
if (_downloadPackageHashOp.IsDone == false) if (_downloadPackageHashOp.IsDone == false)
return; return;
@ -69,11 +67,9 @@ namespace YooAsset
if (_downloadPackageManifestOp == null) if (_downloadPackageManifestOp == null)
{ {
_downloadPackageManifestOp = new DownloadPackageManifestOperation(_fileSystem, _packageVersion, _timeout); _downloadPackageManifestOp = new DownloadPackageManifestOperation(_fileSystem, _packageVersion, _timeout);
_downloadPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadPackageManifestOp);
AddChildOperation(_downloadPackageManifestOp);
} }
_downloadPackageManifestOp.UpdateOperation();
if (_downloadPackageManifestOp.IsDone == false) if (_downloadPackageManifestOp.IsDone == false)
return; return;
@ -94,11 +90,9 @@ namespace YooAsset
if (_loadCachePackageHashOp == null) if (_loadCachePackageHashOp == null)
{ {
_loadCachePackageHashOp = new LoadCachePackageHashOperation(_fileSystem, _packageVersion); _loadCachePackageHashOp = new LoadCachePackageHashOperation(_fileSystem, _packageVersion);
_loadCachePackageHashOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadCachePackageHashOp);
AddChildOperation(_loadCachePackageHashOp);
} }
_loadCachePackageHashOp.UpdateOperation();
if (_loadCachePackageHashOp.IsDone == false) if (_loadCachePackageHashOp.IsDone == false)
return; return;
@ -121,11 +115,9 @@ namespace YooAsset
{ {
string packageHash = _loadCachePackageHashOp.PackageHash; string packageHash = _loadCachePackageHashOp.PackageHash;
_loadCachePackageManifestOp = new LoadCachePackageManifestOperation(_fileSystem, _packageVersion, packageHash); _loadCachePackageManifestOp = new LoadCachePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
_loadCachePackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadCachePackageManifestOp);
AddChildOperation(_loadCachePackageManifestOp);
} }
_loadCachePackageManifestOp.UpdateOperation();
Progress = _loadCachePackageManifestOp.Progress; Progress = _loadCachePackageManifestOp.Progress;
if (_loadCachePackageManifestOp.IsDone == false) if (_loadCachePackageManifestOp.IsDone == false)
return; return;

View File

@ -23,11 +23,11 @@ namespace YooAsset
_appendTimeTicks = appendTimeTicks; _appendTimeTicks = appendTimeTicks;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.GetPackageVersion; _steps = ESteps.GetPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -37,11 +37,9 @@ namespace YooAsset
if (_requestRemotePackageVersionOp == null) if (_requestRemotePackageVersionOp == null)
{ {
_requestRemotePackageVersionOp = new RequestRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout); _requestRemotePackageVersionOp = new RequestRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
_requestRemotePackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestRemotePackageVersionOp);
AddChildOperation(_requestRemotePackageVersionOp);
} }
_requestRemotePackageVersionOp.UpdateOperation();
Progress = _requestRemotePackageVersionOp.Progress; Progress = _requestRemotePackageVersionOp.Progress;
if (_requestRemotePackageVersionOp.IsDone == false) if (_requestRemotePackageVersionOp.IsDone == false)
return; return;

View File

@ -23,11 +23,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.GetAllCacheFiles; _steps = ESteps.GetAllCacheFiles;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -20,11 +20,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.ClearAllCacheFiles; _steps = ESteps.ClearAllCacheFiles;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -27,11 +27,11 @@ namespace YooAsset
_manifest = manifest; _manifest = manifest;
_clearParam = clearParam; _clearParam = clearParam;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckArgs; _steps = ESteps.CheckArgs;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -25,11 +25,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_manifest = manifest; _manifest = manifest;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.GetUnusedCacheFiles; _steps = ESteps.GetUnusedCacheFiles;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -22,11 +22,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_manifest = manifest; _manifest = manifest;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.ClearUnusedCacheFiles; _steps = ESteps.ClearUnusedCacheFiles;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -16,13 +16,13 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL); _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
_tempFilePath = _fileSystem.GetTempFilePath(Bundle); _tempFilePath = _fileSystem.GetTempFilePath(Bundle);
_steps = ESteps.CheckExists; _steps = ESteps.CheckExists;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -89,8 +89,7 @@ namespace YooAsset
{ {
var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize); var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize);
_verifyOperation = new VerifyTempFileOperation(element); _verifyOperation = new VerifyTempFileOperation(element);
_verifyOperation.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _verifyOperation);
AddChildOperation(_verifyOperation);
_steps = ESteps.CheckVerifyTempFile; _steps = ESteps.CheckVerifyTempFile;
} }
@ -100,7 +99,6 @@ namespace YooAsset
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_verifyOperation.WaitForAsyncComplete(); _verifyOperation.WaitForAsyncComplete();
_verifyOperation.UpdateOperation();
if (_verifyOperation.IsDone == false) if (_verifyOperation.IsDone == false)
return; return;
@ -159,7 +157,7 @@ namespace YooAsset
} }
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeWebRequest(); DisposeWebRequest();
@ -169,7 +167,7 @@ namespace YooAsset
//TODO 防止下载器挂起陷入无限死循环! //TODO 防止下载器挂起陷入无限死循环!
if (_steps == ESteps.None) if (_steps == ESteps.None)
{ {
InternalStart(); InternalOnStart();
} }
while (true) while (true)
@ -177,7 +175,7 @@ namespace YooAsset
//TODO 如果是导入或解压本地文件,执行等待完毕 //TODO 如果是导入或解压本地文件,执行等待完毕
if (_isReuqestLocalFile) if (_isReuqestLocalFile)
{ {
InternalUpdate(); InternalOnUpdate();
if (IsDone) if (IsDone)
break; break;
} }

View File

@ -26,12 +26,12 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageHashOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageHashOperation));
_steps = ESteps.CheckExist; _steps = ESteps.CheckExist;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -58,11 +58,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion); string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
string webURL = GetWebRequestURL(fileName); string webURL = GetWebRequestURL(fileName);
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout); _webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
_webFileRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
AddChildOperation(_webFileRequestOp);
} }
_webFileRequestOp.UpdateOperation();
if (_webFileRequestOp.IsDone == false) if (_webFileRequestOp.IsDone == false)
return; return;

View File

@ -26,12 +26,12 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageManifestOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageManifestOperation));
_steps = ESteps.CheckExist; _steps = ESteps.CheckExist;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -58,11 +58,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion); string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
string webURL = GetDownloadRequestURL(fileName); string webURL = GetDownloadRequestURL(fileName);
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout); _webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
_webFileRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
AddChildOperation(_webFileRequestOp);
} }
_webFileRequestOp.UpdateOperation();
if (_webFileRequestOp.IsDone == false) if (_webFileRequestOp.IsDone == false)
return; return;

View File

@ -20,13 +20,13 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL); _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
_tempFilePath = _fileSystem.GetTempFilePath(Bundle); _tempFilePath = _fileSystem.GetTempFilePath(Bundle);
_steps = ESteps.CheckExists; _steps = ESteps.CheckExists;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -110,8 +110,7 @@ namespace YooAsset
{ {
var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize); var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize);
_verifyOperation = new VerifyTempFileOperation(element); _verifyOperation = new VerifyTempFileOperation(element);
_verifyOperation.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _verifyOperation);
AddChildOperation(_verifyOperation);
_steps = ESteps.CheckVerifyTempFile; _steps = ESteps.CheckVerifyTempFile;
} }
@ -121,7 +120,6 @@ namespace YooAsset
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_verifyOperation.WaitForAsyncComplete(); _verifyOperation.WaitForAsyncComplete();
_verifyOperation.UpdateOperation();
if (_verifyOperation.IsDone == false) if (_verifyOperation.IsDone == false)
return; return;
@ -179,7 +177,7 @@ namespace YooAsset
} }
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeWebRequest(); DisposeWebRequest();
@ -189,7 +187,7 @@ namespace YooAsset
//TODO 防止下载器挂起陷入无限死循环! //TODO 防止下载器挂起陷入无限死循环!
if (_steps == ESteps.None) if (_steps == ESteps.None)
{ {
InternalStart(); InternalOnStart();
} }
while (true) while (true)
@ -197,7 +195,7 @@ namespace YooAsset
//TODO 如果是导入或解压本地文件,执行等待完毕 //TODO 如果是导入或解压本地文件,执行等待完毕
if (_isReuqestLocalFile) if (_isReuqestLocalFile)
{ {
InternalUpdate(); InternalOnUpdate();
if (IsDone) if (IsDone)
break; break;
} }

View File

@ -26,11 +26,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_packageVersion = packageVersion; _packageVersion = packageVersion;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadPackageHash; _steps = ESteps.LoadPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -32,11 +32,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_packageHash = packageHash; _packageHash = packageHash;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadFileData; _steps = ESteps.LoadFileData;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -77,11 +77,9 @@ namespace YooAsset
if (_deserializer == null) if (_deserializer == null)
{ {
_deserializer = new DeserializeManifestOperation(_fileData); _deserializer = new DeserializeManifestOperation(_fileData);
_deserializer.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
AddChildOperation(_deserializer);
} }
_deserializer.UpdateOperation();
Progress = _deserializer.Progress; Progress = _deserializer.Progress;
if (_deserializer.IsDone == false) if (_deserializer.IsDone == false)
return; return;

View File

@ -29,12 +29,12 @@ namespace YooAsset
_appendTimeTicks = appendTimeTicks; _appendTimeTicks = appendTimeTicks;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestRemotePackageVersionOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestRemotePackageVersionOperation));
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -46,11 +46,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName); string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
string url = GetWebRequestURL(fileName); string url = GetWebRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout); _webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress; Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -30,12 +30,12 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.Prepare; _steps = ESteps.Prepare;
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup; _verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -37,12 +37,12 @@ namespace YooAsset
_waitingList = elements; _waitingList = elements;
_fileVerifyLevel = fileSystem.FileVerifyLevel; _fileVerifyLevel = fileSystem.FileVerifyLevel;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.InitVerify; _steps = ESteps.InitVerify;
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup; _verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -29,11 +29,11 @@ namespace YooAsset
{ {
_element = element; _element = element;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.VerifyFile; _steps = ESteps.VerifyFile;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -72,7 +72,7 @@ namespace YooAsset
while (true) while (true)
{ {
//TODO 等待子线程验证文件完毕,该操作会挂起主线程 //TODO 等待子线程验证文件完毕,该操作会挂起主线程
InternalUpdate(); InternalOnUpdate();
if (IsDone) if (IsDone)
break; break;
} }

View File

@ -54,21 +54,25 @@ namespace YooAsset
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync() public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{ {
var operation = new DEFSInitializeOperation(this); var operation = new DEFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout) public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{ {
var operation = new DEFSLoadPackageManifestOperation(this, packageVersion); var operation = new DEFSLoadPackageManifestOperation(this, packageVersion);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout) public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new DEFSRequestPackageVersionOperation(this); var operation = new DEFSRequestPackageVersionOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam) public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{ {
var operation = new FSClearCacheFilesCompleteOperation(); var operation = new FSClearCacheFilesCompleteOperation();
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param) public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
@ -80,12 +84,14 @@ namespace YooAsset
if (bundle.BundleType == (int)EBuildBundleType.VirtualBundle) if (bundle.BundleType == (int)EBuildBundleType.VirtualBundle)
{ {
var operation = new DEFSLoadBundleOperation(this, bundle); var operation = new DEFSLoadBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"{nameof(DefaultEditorFileSystem)} not support load bundle type : {bundle.BundleType}"; string error = $"{nameof(DefaultEditorFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error); var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
@ -114,7 +120,7 @@ namespace YooAsset
_packageRoot = packageRoot; _packageRoot = packageRoot;
} }
public virtual void OnDestroy() public virtual void OnUpdate()
{ {
} }

View File

@ -9,11 +9,11 @@ namespace YooAsset
{ {
_fileSytem = fileSystem; _fileSytem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -22,11 +22,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.DownloadFile; _steps = ESteps.DownloadFile;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -72,5 +72,8 @@ namespace YooAsset
} }
} }
} }
public override void AbortDownloadOperation()
{
}
} }
} }

View File

@ -23,11 +23,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_packageVersion = packageVersion; _packageVersion = packageVersion;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadEditorPackageHash; _steps = ESteps.LoadEditorPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -37,11 +37,9 @@ namespace YooAsset
if (_loadEditorPackageHashOpe == null) if (_loadEditorPackageHashOpe == null)
{ {
_loadEditorPackageHashOpe = new LoadEditorPackageHashOperation(_fileSystem, _packageVersion); _loadEditorPackageHashOpe = new LoadEditorPackageHashOperation(_fileSystem, _packageVersion);
_loadEditorPackageHashOpe.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageHashOpe);
AddChildOperation(_loadEditorPackageHashOpe);
} }
_loadEditorPackageHashOpe.UpdateOperation();
if (_loadEditorPackageHashOpe.IsDone == false) if (_loadEditorPackageHashOpe.IsDone == false)
return; return;
@ -63,11 +61,9 @@ namespace YooAsset
{ {
string packageHash = _loadEditorPackageHashOpe.PackageHash; string packageHash = _loadEditorPackageHashOpe.PackageHash;
_loadEditorPackageManifestOp = new LoadEditorPackageManifestOperation(_fileSystem, _packageVersion, packageHash); _loadEditorPackageManifestOp = new LoadEditorPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
_loadEditorPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageManifestOp);
AddChildOperation(_loadEditorPackageManifestOp);
} }
_loadEditorPackageManifestOp.UpdateOperation();
Progress = _loadEditorPackageManifestOp.Progress; Progress = _loadEditorPackageManifestOp.Progress;
if (_loadEditorPackageManifestOp.IsDone == false) if (_loadEditorPackageManifestOp.IsDone == false)
return; return;

View File

@ -19,11 +19,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadPackageVersion; _steps = ESteps.LoadPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -33,11 +33,9 @@ namespace YooAsset
if (_loadEditorPackageVersionOp == null) if (_loadEditorPackageVersionOp == null)
{ {
_loadEditorPackageVersionOp = new LoadEditorPackageVersionOperation(_fileSystem); _loadEditorPackageVersionOp = new LoadEditorPackageVersionOperation(_fileSystem);
_loadEditorPackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageVersionOp);
AddChildOperation(_loadEditorPackageVersionOp);
} }
_loadEditorPackageVersionOp.UpdateOperation();
if (_loadEditorPackageVersionOp.IsDone == false) if (_loadEditorPackageVersionOp.IsDone == false)
return; return;

View File

@ -26,11 +26,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_packageVersion = packageVersion; _packageVersion = packageVersion;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadHash; _steps = ESteps.LoadHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -32,11 +32,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_packageHash = packageHash; _packageHash = packageHash;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadFileData; _steps = ESteps.LoadFileData;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -77,11 +77,9 @@ namespace YooAsset
if (_deserializer == null) if (_deserializer == null)
{ {
_deserializer = new DeserializeManifestOperation(_fileData); _deserializer = new DeserializeManifestOperation(_fileData);
_deserializer.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
AddChildOperation(_deserializer);
} }
_deserializer.UpdateOperation();
Progress = _deserializer.Progress; Progress = _deserializer.Progress;
if (_deserializer.IsDone == false) if (_deserializer.IsDone == false)
return; return;

View File

@ -24,11 +24,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadVersion; _steps = ESteps.LoadVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -61,21 +61,25 @@ namespace YooAsset
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync() public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{ {
var operation = new DWRFSInitializeOperation(this); var operation = new DWRFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout) public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{ {
var operation = new DWRFSLoadPackageManifestOperation(this, packageVersion, timeout); var operation = new DWRFSLoadPackageManifestOperation(this, packageVersion, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout) public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new DWRFSRequestPackageVersionOperation(this, appendTimeTicks, timeout); var operation = new DWRFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam) public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{ {
var operation = new FSClearCacheFilesCompleteOperation(); var operation = new FSClearCacheFilesCompleteOperation();
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param) public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
@ -87,12 +91,14 @@ namespace YooAsset
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle) if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{ {
var operation = new DWRFSLoadAssetBundleOperation(this, bundle); var operation = new DWRFSLoadAssetBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"{nameof(DefaultWebRemoteFileSystem)} not support load bundle type : {bundle.BundleType}"; string error = $"{nameof(DefaultWebRemoteFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error); var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
@ -120,7 +126,7 @@ namespace YooAsset
{ {
PackageName = packageName; PackageName = packageName;
} }
public virtual void OnDestroy() public virtual void OnUpdate()
{ {
} }

View File

@ -9,11 +9,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -21,11 +21,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.DownloadAssetBundle; _steps = ESteps.DownloadAssetBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -41,18 +41,15 @@ namespace YooAsset
if (_bundle.Encrypted) if (_bundle.Encrypted)
{ {
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam); _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
_downloadAssetBundleOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
AddChildOperation(_downloadAssetBundleOp);
} }
else else
{ {
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam); _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
_downloadAssetBundleOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
AddChildOperation(_downloadAssetBundleOp);
} }
} }
_downloadAssetBundleOp.UpdateOperation();
DownloadProgress = _downloadAssetBundleOp.DownloadProgress; DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes; DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes;
Progress = _downloadAssetBundleOp.Progress; Progress = _downloadAssetBundleOp.Progress;
@ -93,5 +90,13 @@ namespace YooAsset
UnityEngine.Debug.LogError(Error); UnityEngine.Debug.LogError(Error);
} }
} }
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadAssetBundle)
{
if (_downloadAssetBundleOp != null)
_downloadAssetBundleOp.SetAbort();
}
}
} }
} }

View File

@ -25,11 +25,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestWebPackageHash; _steps = ESteps.RequestWebPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -39,11 +39,9 @@ namespace YooAsset
if (_requestWebPackageHashOp == null) if (_requestWebPackageHashOp == null)
{ {
_requestWebPackageHashOp = new RequestWebRemotePackageHashOperation(_fileSystem, _packageVersion, _timeout); _requestWebPackageHashOp = new RequestWebRemotePackageHashOperation(_fileSystem, _packageVersion, _timeout);
_requestWebPackageHashOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageHashOp);
AddChildOperation(_requestWebPackageHashOp);
} }
_requestWebPackageHashOp.UpdateOperation();
if (_requestWebPackageHashOp.IsDone == false) if (_requestWebPackageHashOp.IsDone == false)
return; return;
@ -65,11 +63,9 @@ namespace YooAsset
{ {
string packageHash = _requestWebPackageHashOp.PackageHash; string packageHash = _requestWebPackageHashOp.PackageHash;
_loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash); _loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
_loadWebPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadWebPackageManifestOp);
AddChildOperation(_loadWebPackageManifestOp);
} }
_loadWebPackageManifestOp.UpdateOperation();
Progress = _loadWebPackageManifestOp.Progress; Progress = _loadWebPackageManifestOp.Progress;
if (_loadWebPackageManifestOp.IsDone == false) if (_loadWebPackageManifestOp.IsDone == false)
return; return;

View File

@ -23,11 +23,11 @@ namespace YooAsset
_appendTimeTicks = appendTimeTicks; _appendTimeTicks = appendTimeTicks;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -37,11 +37,9 @@ namespace YooAsset
if (_requestWebPackageVersionOp == null) if (_requestWebPackageVersionOp == null)
{ {
_requestWebPackageVersionOp = new RequestWebRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout); _requestWebPackageVersionOp = new RequestWebRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
_requestWebPackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
AddChildOperation(_requestWebPackageVersionOp);
} }
_requestWebPackageVersionOp.UpdateOperation();
Progress = _requestWebPackageVersionOp.Progress; Progress = _requestWebPackageVersionOp.Progress;
if (_requestWebPackageVersionOp.IsDone == false) if (_requestWebPackageVersionOp.IsDone == false)
return; return;

View File

@ -32,12 +32,12 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_packageHash = packageHash; _packageHash = packageHash;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadWebRemotePackageManifestOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadWebRemotePackageManifestOperation));
_steps = ESteps.RequestFileData; _steps = ESteps.RequestFileData;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -49,11 +49,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion); string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
string url = GetWebRequestURL(fileName); string url = GetWebRequestURL(fileName);
_webDataRequestOp = new UnityWebDataRequestOperation(url); _webDataRequestOp = new UnityWebDataRequestOperation(url);
_webDataRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
AddChildOperation(_webDataRequestOp);
} }
_webDataRequestOp.UpdateOperation();
if (_webDataRequestOp.IsDone == false) if (_webDataRequestOp.IsDone == false)
return; return;
@ -90,11 +88,9 @@ namespace YooAsset
if (_deserializer == null) if (_deserializer == null)
{ {
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result); _deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
_deserializer.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
AddChildOperation(_deserializer);
} }
_deserializer.UpdateOperation();
Progress = _deserializer.Progress; Progress = _deserializer.Progress;
if (_deserializer.IsDone == false) if (_deserializer.IsDone == false)
return; return;

View File

@ -29,12 +29,12 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageHashOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageHashOperation));
_steps = ESteps.RequestPackageHash; _steps = ESteps.RequestPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -46,11 +46,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion); string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
string url = GetWebRequestURL(fileName); string url = GetWebRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout); _webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress; Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -29,12 +29,12 @@ namespace YooAsset
_appendTimeTicks = appendTimeTicks; _appendTimeTicks = appendTimeTicks;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageVersionOperation)); _requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageVersionOperation));
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -46,11 +46,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName); string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
string url = GetWebRequestURL(fileName); string url = GetWebRequestURL(fileName);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout); _webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress; Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -70,21 +70,25 @@ namespace YooAsset
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync() public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
{ {
var operation = new DWSFSInitializeOperation(this); var operation = new DWSFSInitializeOperation(this);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout) public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
{ {
var operation = new DWSFSLoadPackageManifestOperation(this, packageVersion, timeout); var operation = new DWSFSLoadPackageManifestOperation(this, packageVersion, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout) public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
{ {
var operation = new DWSFSRequestPackageVersionOperation(this, timeout); var operation = new DWSFSRequestPackageVersionOperation(this, timeout);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam) public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
{ {
var operation = new FSClearCacheFilesCompleteOperation(); var operation = new FSClearCacheFilesCompleteOperation();
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param) public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
@ -96,12 +100,14 @@ namespace YooAsset
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle) if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{ {
var operation = new DWSFSLoadAssetBundleOperation(this, bundle); var operation = new DWSFSLoadAssetBundleOperation(this, bundle);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
else else
{ {
string error = $"{nameof(DefaultWebServerFileSystem)} not support load bundle type : {bundle.BundleType}"; string error = $"{nameof(DefaultWebServerFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error); var operation = new FSLoadBundleCompleteOperation(error);
OperationSystem.StartOperation(PackageName, operation);
return operation; return operation;
} }
} }
@ -130,7 +136,7 @@ namespace YooAsset
else else
_webPackageRoot = packageRoot; _webPackageRoot = packageRoot;
} }
public virtual void OnDestroy() public virtual void OnUpdate()
{ {
} }

View File

@ -1,4 +1,6 @@
 
using static UnityEngine.Networking.UnityWebRequest;
namespace YooAsset namespace YooAsset
{ {
internal class DWSFSInitializeOperation : FSInitializeFileSystemOperation internal class DWSFSInitializeOperation : FSInitializeFileSystemOperation
@ -19,11 +21,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadCatalogFile; _steps = ESteps.LoadCatalogFile;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -47,11 +49,9 @@ namespace YooAsset
#endif #endif
_loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem); _loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem);
_loadCatalogFileOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadCatalogFileOp);
AddChildOperation(_loadCatalogFileOp);
} }
_loadCatalogFileOp.UpdateOperation();
if (_loadCatalogFileOp.IsDone == false) if (_loadCatalogFileOp.IsDone == false)
return; return;

View File

@ -21,11 +21,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_bundle = bundle; _bundle = bundle;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.DownloadAssetBundle; _steps = ESteps.DownloadAssetBundle;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -42,18 +42,15 @@ namespace YooAsset
if (_bundle.Encrypted) if (_bundle.Encrypted)
{ {
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam); _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
_downloadAssetBundleOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
AddChildOperation(_downloadAssetBundleOp);
} }
else else
{ {
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam); _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
_downloadAssetBundleOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
AddChildOperation(_downloadAssetBundleOp);
} }
} }
_downloadAssetBundleOp.UpdateOperation();
DownloadProgress = _downloadAssetBundleOp.DownloadProgress; DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes; DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes;
Progress = _downloadAssetBundleOp.Progress; Progress = _downloadAssetBundleOp.Progress;
@ -94,5 +91,13 @@ namespace YooAsset
UnityEngine.Debug.LogError(Error); UnityEngine.Debug.LogError(Error);
} }
} }
public override void AbortDownloadOperation()
{
if (_steps == ESteps.DownloadAssetBundle)
{
if (_downloadAssetBundleOp != null)
_downloadAssetBundleOp.SetAbort();
}
}
} }
} }

View File

@ -25,11 +25,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestWebPackageHash; _steps = ESteps.RequestWebPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -39,11 +39,9 @@ namespace YooAsset
if (_requestWebPackageHashOp == null) if (_requestWebPackageHashOp == null)
{ {
_requestWebPackageHashOp = new RequestWebServerPackageHashOperation(_fileSystem, _packageVersion, _timeout); _requestWebPackageHashOp = new RequestWebServerPackageHashOperation(_fileSystem, _packageVersion, _timeout);
_requestWebPackageHashOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageHashOp);
AddChildOperation(_requestWebPackageHashOp);
} }
_requestWebPackageHashOp.UpdateOperation();
if (_requestWebPackageHashOp.IsDone == false) if (_requestWebPackageHashOp.IsDone == false)
return; return;
@ -65,11 +63,9 @@ namespace YooAsset
{ {
string packageHash = _requestWebPackageHashOp.PackageHash; string packageHash = _requestWebPackageHashOp.PackageHash;
_loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash); _loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
_loadWebPackageManifestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _loadWebPackageManifestOp);
AddChildOperation(_loadWebPackageManifestOp);
} }
_loadWebPackageManifestOp.UpdateOperation();
Progress = _loadWebPackageManifestOp.Progress; Progress = _loadWebPackageManifestOp.Progress;
if (_loadWebPackageManifestOp.IsDone == false) if (_loadWebPackageManifestOp.IsDone == false)
return; return;

View File

@ -21,11 +21,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -35,11 +35,9 @@ namespace YooAsset
if (_requestWebPackageVersionOp == null) if (_requestWebPackageVersionOp == null)
{ {
_requestWebPackageVersionOp = new RequestWebServerPackageVersionOperation(_fileSystem, _timeout); _requestWebPackageVersionOp = new RequestWebServerPackageVersionOperation(_fileSystem, _timeout);
_requestWebPackageVersionOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
AddChildOperation(_requestWebPackageVersionOp);
} }
_requestWebPackageVersionOp.UpdateOperation();
Progress = _requestWebPackageVersionOp.Progress; Progress = _requestWebPackageVersionOp.Progress;
if (_requestWebPackageVersionOp.IsDone == false) if (_requestWebPackageVersionOp.IsDone == false)
return; return;

View File

@ -27,11 +27,11 @@ namespace YooAsset
{ {
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadCatalog; _steps = ESteps.LoadCatalog;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -31,11 +31,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_packageHash = packageHash; _packageHash = packageHash;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestFileData; _steps = ESteps.RequestFileData;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -47,11 +47,9 @@ namespace YooAsset
string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion); string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webDataRequestOp = new UnityWebDataRequestOperation(url); _webDataRequestOp = new UnityWebDataRequestOperation(url);
_webDataRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
AddChildOperation(_webDataRequestOp);
} }
_webDataRequestOp.UpdateOperation();
if (_webDataRequestOp.IsDone == false) if (_webDataRequestOp.IsDone == false)
return; return;
@ -87,11 +85,9 @@ namespace YooAsset
if (_deserializer == null) if (_deserializer == null)
{ {
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result); _deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
_deserializer.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
AddChildOperation(_deserializer);
} }
_deserializer.UpdateOperation();
Progress = _deserializer.Progress; Progress = _deserializer.Progress;
if (_deserializer.IsDone == false) if (_deserializer.IsDone == false)
return; return;

View File

@ -28,11 +28,11 @@ namespace YooAsset
_packageVersion = packageVersion; _packageVersion = packageVersion;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageHash; _steps = ESteps.RequestPackageHash;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -44,11 +44,9 @@ namespace YooAsset
string filePath = _fileSystem.GetWebPackageHashFilePath(_packageVersion); string filePath = _fileSystem.GetWebPackageHashFilePath(_packageVersion);
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout); _webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
Progress = _webTextRequestOp.Progress; Progress = _webTextRequestOp.Progress;
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -26,11 +26,11 @@ namespace YooAsset
_fileSystem = fileSystem; _fileSystem = fileSystem;
_timeout = timeout; _timeout = timeout;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.RequestPackageVersion; _steps = ESteps.RequestPackageVersion;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -42,11 +42,9 @@ namespace YooAsset
string filePath = _fileSystem.GetWebPackageVersionFilePath(); string filePath = _fileSystem.GetWebPackageVersionFilePath();
string url = DownloadSystemHelper.ConvertToWWWPath(filePath); string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout); _webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
_webTextRequestOp.StartOperation(); OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
AddChildOperation(_webTextRequestOp);
} }
_webTextRequestOp.UpdateOperation();
if (_webTextRequestOp.IsDone == false) if (_webTextRequestOp.IsDone == false)
return; return;

View File

@ -56,14 +56,14 @@ namespace YooAsset
void SetParameter(string name, object value); void SetParameter(string name, object value);
/// <summary> /// <summary>
/// 创建文件系统 /// 创建缓存系统
/// </summary> /// </summary>
void OnCreate(string packageName, string packageRoot); void OnCreate(string packageName, string packageRoot);
/// <summary> /// <summary>
/// 销毁文件系统 /// 更新文件系统
/// </summary> /// </summary>
void OnDestroy(); void OnUpdate();
/// <summary> /// <summary>

View File

@ -17,7 +17,7 @@ namespace YooAsset
{ {
_error = error; _error = error;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
if (string.IsNullOrEmpty(_error)) if (string.IsNullOrEmpty(_error))
{ {
@ -29,7 +29,7 @@ namespace YooAsset
Error = _error; Error = _error;
} }
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
} }
} }

View File

@ -1,4 +1,5 @@
 using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
internal abstract class FSLoadBundleOperation : AsyncOperationBase internal abstract class FSLoadBundleOperation : AsyncOperationBase
@ -17,6 +18,11 @@ namespace YooAsset
/// 下载大小 /// 下载大小
/// </summary> /// </summary>
public long DownloadedBytes { protected set; get; } = 0; public long DownloadedBytes { protected set; get; } = 0;
/// <summary>
/// 终止下载任务
/// </summary>
public abstract void AbortDownloadOperation();
} }
internal sealed class FSLoadBundleCompleteOperation : FSLoadBundleOperation internal sealed class FSLoadBundleCompleteOperation : FSLoadBundleOperation
@ -27,12 +33,15 @@ namespace YooAsset
{ {
_error = error; _error = error;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = _error; Error = _error;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{
}
public override void AbortDownloadOperation()
{ {
} }
} }

View File

@ -15,11 +15,11 @@ namespace YooAsset
_checkTimeout = checkTimeout; _checkTimeout = checkTimeout;
_decryptionServices = decryptionServices; _decryptionServices = decryptionServices;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateRequest; _steps = ESteps.CreateRequest;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -117,7 +117,7 @@ namespace YooAsset
} }
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeWebRequest(); DisposeWebRequest();

View File

@ -13,11 +13,11 @@ namespace YooAsset
{ {
_disableUnityWebCache = disableUnityWebCache; _disableUnityWebCache = disableUnityWebCache;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateRequest; _steps = ESteps.CreateRequest;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -95,7 +95,7 @@ namespace YooAsset
} }
} }
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
_steps = ESteps.Done; _steps = ESteps.Done;
DisposeWebRequest(); DisposeWebRequest();

View File

@ -8,7 +8,6 @@ namespace YooAsset
{ {
public abstract class AsyncOperationBase : IEnumerator, IComparable<AsyncOperationBase> public abstract class AsyncOperationBase : IEnumerator, IComparable<AsyncOperationBase>
{ {
private readonly List<AsyncOperationBase> _childs = new List<AsyncOperationBase>(10);
private Action<AsyncOperationBase> _callback; private Action<AsyncOperationBase> _callback;
private string _packageName = null; private string _packageName = null;
private int _whileFrame = 1000; private int _whileFrame = 1000;
@ -16,12 +15,12 @@ namespace YooAsset
/// <summary> /// <summary>
/// 等待异步执行完成 /// 等待异步执行完成
/// </summary> /// </summary>
internal bool IsWaitForAsyncComplete { private set; get; } = false; internal bool IsWaitForAsyncComplete = false;
/// <summary> /// <summary>
/// 是否已经完成 /// 是否已经完成
/// </summary> /// </summary>
internal bool IsFinish { private set; get; } = false; internal bool IsFinish = false;
/// <summary> /// <summary>
/// 优先级 /// 优先级
@ -100,9 +99,9 @@ namespace YooAsset
} }
} }
internal abstract void InternalStart(); internal abstract void InternalOnStart();
internal abstract void InternalUpdate(); internal abstract void InternalOnUpdate();
internal virtual void InternalAbort() internal virtual void InternalOnAbort()
{ {
} }
internal virtual void InternalWaitForAsyncComplete() internal virtual void InternalWaitForAsyncComplete()
@ -110,49 +109,16 @@ namespace YooAsset
throw new System.NotImplementedException(this.GetType().Name); throw new System.NotImplementedException(this.GetType().Name);
} }
/// <summary>
/// 设置包裹名称
/// </summary>
/// <param name="packageName"></param>
internal void SetPackageName(string packageName) internal void SetPackageName(string packageName)
{ {
_packageName = packageName; _packageName = packageName;
} }
internal void SetStart()
/// <summary>
/// 添加子任务
/// </summary>
internal void AddChildOperation(AsyncOperationBase child)
{
#if UNITY_EDITOR
if (_childs.Contains(child))
throw new Exception($"The child node {child.GetType().Name} already exists !");
#endif
_childs.Add(child);
}
/// <summary>
/// 开始异步操作
/// </summary>
internal void StartOperation()
{
if (Status == EOperationStatus.None)
{ {
Status = EOperationStatus.Processing; Status = EOperationStatus.Processing;
InternalStart(); InternalOnStart();
} }
} internal void SetFinish()
/// <summary>
/// 更新异步操作
/// </summary>
internal void UpdateOperation()
{
if (IsDone == false)
InternalUpdate();
if (IsDone && IsFinish == false)
{ {
IsFinish = true; IsFinish = true;
@ -165,24 +131,14 @@ namespace YooAsset
if (_taskCompletionSource != null) if (_taskCompletionSource != null)
_taskCompletionSource.TrySetResult(null); _taskCompletionSource.TrySetResult(null);
} }
} internal void SetAbort()
/// <summary>
/// 终止异步任务
/// </summary>
internal void AbortOperation()
{ {
foreach (var child in _childs)
{
child.AbortOperation();
}
if (IsDone == false) if (IsDone == false)
{ {
Status = EOperationStatus.Failed; Status = EOperationStatus.Failed;
Error = "user abort"; Error = "user abort";
YooLogger.Warning($"Async operaiton {this.GetType().Name} has been abort !"); YooLogger.Warning($"Async operaiton {this.GetType().Name} has been abort !");
InternalAbort(); InternalOnAbort();
} }
} }
@ -194,7 +150,7 @@ namespace YooAsset
if (IsDone == false) if (IsDone == false)
{ {
// 执行更新逻辑 // 执行更新逻辑
InternalUpdate(); InternalOnUpdate();
// 当执行次数用完时 // 当执行次数用完时
_whileFrame--; _whileFrame--;
@ -228,9 +184,6 @@ namespace YooAsset
InternalWaitForAsyncComplete(); InternalWaitForAsyncComplete();
} }
#region 调试信息
#endregion
#region 排序接口实现 #region 排序接口实现
public int CompareTo(AsyncOperationBase other) public int CompareTo(AsyncOperationBase other)
{ {

View File

@ -3,15 +3,15 @@ namespace YooAsset
{ {
public abstract class GameAsyncOperation : AsyncOperationBase public abstract class GameAsyncOperation : AsyncOperationBase
{ {
internal override void InternalStart() internal override void InternalOnStart()
{ {
OnStart(); OnStart();
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
OnUpdate(); OnUpdate();
} }
internal override void InternalAbort() internal override void InternalOnAbort()
{ {
OnAbort(); OnAbort();
} }
@ -53,7 +53,7 @@ namespace YooAsset
/// </summary> /// </summary>
protected void Abort() protected void Abort()
{ {
AbortOperation(); SetAbort();
} }
} }
} }

View File

@ -13,6 +13,11 @@ namespace YooAsset
private static Stopwatch _watch; private static Stopwatch _watch;
private static long _frameTime; private static long _frameTime;
/// <summary>
/// 快速启动模式
/// </summary>
public static bool QuickStartMode = true;
/// <summary> /// <summary>
/// 异步操作的最小时间片段 /// 异步操作的最小时间片段
/// </summary> /// </summary>
@ -43,6 +48,8 @@ namespace YooAsset
/// </summary> /// </summary>
public static void Update() public static void Update()
{ {
_frameTime = _watch.ElapsedMilliseconds;
// 添加新增的异步操作 // 添加新增的异步操作
if (_newList.Count > 0) if (_newList.Count > 0)
{ {
@ -65,7 +72,6 @@ namespace YooAsset
} }
// 更新进行中的异步操作 // 更新进行中的异步操作
_frameTime = _watch.ElapsedMilliseconds;
for (int i = 0; i < _operations.Count; i++) for (int i = 0; i < _operations.Count; i++)
{ {
if (IsBusy) if (IsBusy)
@ -75,7 +81,11 @@ namespace YooAsset
if (operation.IsFinish) if (operation.IsFinish)
continue; continue;
operation.UpdateOperation(); if (operation.IsDone == false)
operation.InternalOnUpdate();
if (operation.IsDone)
operation.SetFinish();
} }
// 移除已经完成的异步操作 // 移除已经完成的异步操作
@ -109,7 +119,7 @@ namespace YooAsset
{ {
if (operation.PackageName == packageName) if (operation.PackageName == packageName)
{ {
operation.AbortOperation(); operation.SetAbort();
} }
} }
@ -118,7 +128,7 @@ namespace YooAsset
{ {
if (operation.PackageName == packageName) if (operation.PackageName == packageName)
{ {
operation.AbortOperation(); operation.SetAbort();
} }
} }
} }
@ -130,7 +140,12 @@ namespace YooAsset
{ {
_newList.Add(operation); _newList.Add(operation);
operation.SetPackageName(packageName); operation.SetPackageName(packageName);
operation.StartOperation(); operation.SetStart();
if (QuickStartMode)
{
operation.InternalOnUpdate();
}
} }
} }
} }

View File

@ -43,11 +43,11 @@ namespace YooAsset
_worldPositionStays = worldPositionStays; _worldPositionStays = worldPositionStays;
_actived = actived; _actived = actived;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadObject; _steps = ESteps.LoadObject;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -162,7 +162,7 @@ namespace YooAsset
_instantiateAsync.Cancel(); _instantiateAsync.Cancel();
#endif #endif
AbortOperation(); SetAbort();
} }
/// <summary> /// <summary>

View File

@ -55,11 +55,11 @@ namespace YooAsset
_resourceManager = resourceManager; _resourceManager = resourceManager;
LoadBundleInfo = bundleInfo; LoadBundleInfo = bundleInfo;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.LoadFile; _steps = ESteps.LoadFile;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -67,16 +67,11 @@ namespace YooAsset
if (_steps == ESteps.LoadFile) if (_steps == ESteps.LoadFile)
{ {
if (_loadBundleOp == null) if (_loadBundleOp == null)
{
_loadBundleOp = LoadBundleInfo.LoadBundleFile(); _loadBundleOp = LoadBundleInfo.LoadBundleFile();
_loadBundleOp.StartOperation();
AddChildOperation(_loadBundleOp);
}
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_loadBundleOp.WaitForAsyncComplete(); _loadBundleOp.WaitForAsyncComplete();
_loadBundleOp.UpdateOperation();
DownloadProgress = _loadBundleOp.DownloadProgress; DownloadProgress = _loadBundleOp.DownloadProgress;
DownloadedBytes = _loadBundleOp.DownloadedBytes; DownloadedBytes = _loadBundleOp.DownloadedBytes;
if (_loadBundleOp.IsDone == false) if (_loadBundleOp.IsDone == false)
@ -214,5 +209,14 @@ namespace YooAsset
_removeList.Clear(); _removeList.Clear();
} }
} }
/// <summary>
/// 终止下载任务
/// </summary>
public void AbortDownloadOperation()
{
if (_loadBundleOp != null)
_loadBundleOp.AbortDownloadOperation();
}
} }
} }

View File

@ -38,11 +38,11 @@ namespace YooAsset
_resManager = resourceManager; _resManager = resourceManager;
_options = options; _options = options;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckOptions; _steps = ESteps.CheckOptions;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -86,7 +86,7 @@ namespace YooAsset
// 注意:终止所有下载任务 // 注意:终止所有下载任务
foreach (var loader in _resManager.LoaderDic.Values) foreach (var loader in _resManager.LoaderDic.Values)
{ {
loader.AbortOperation(); loader.AbortDownloadOperation();
} }
_steps = ESteps.CheckLoading; _steps = ESteps.CheckLoading;
} }

View File

@ -42,11 +42,11 @@ namespace YooAsset
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckError; _steps = ESteps.CheckError;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -22,11 +22,11 @@ namespace YooAsset
_resManager = resourceManager; _resManager = resourceManager;
_loopCount = loopCount; _loopCount = loopCount;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.UnloadUnused; _steps = ESteps.UnloadUnused;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -13,14 +13,11 @@ namespace YooAsset
if (_loadAllAssetsOp == null) if (_loadAllAssetsOp == null)
{ {
_loadAllAssetsOp = BundleResultObject.LoadAllAssetsAsync(MainAssetInfo); _loadAllAssetsOp = BundleResultObject.LoadAllAssetsAsync(MainAssetInfo);
_loadAllAssetsOp.StartOperation();
AddChildOperation(_loadAllAssetsOp);
} }
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_loadAllAssetsOp.WaitForAsyncComplete(); _loadAllAssetsOp.WaitForAsyncComplete();
_loadAllAssetsOp.UpdateOperation();
Progress = _loadAllAssetsOp.Progress; Progress = _loadAllAssetsOp.Progress;
if (_loadAllAssetsOp.IsDone == false) if (_loadAllAssetsOp.IsDone == false)
return; return;

View File

@ -13,14 +13,11 @@ namespace YooAsset
if (_loadAssetOp == null) if (_loadAssetOp == null)
{ {
_loadAssetOp = BundleResultObject.LoadAssetAsync(MainAssetInfo); _loadAssetOp = BundleResultObject.LoadAssetAsync(MainAssetInfo);
_loadAssetOp.StartOperation();
AddChildOperation(_loadAssetOp);
} }
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_loadAssetOp.WaitForAsyncComplete(); _loadAssetOp.WaitForAsyncComplete();
_loadAssetOp.UpdateOperation();
Progress = _loadAssetOp.Progress; Progress = _loadAssetOp.Progress;
if (_loadAssetOp.IsDone == false) if (_loadAssetOp.IsDone == false)
return; return;

View File

@ -10,8 +10,7 @@ namespace YooAsset
protected enum ESteps protected enum ESteps
{ {
None = 0, None = 0,
StartBundleLoader, LoadBundleFile,
WaitBundleLoader,
ProcessBundleResult, ProcessBundleResult,
Done, Done,
} }
@ -97,27 +96,17 @@ namespace YooAsset
} }
} }
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
DebugBeginRecording(); DebugBeginRecording();
_steps = ESteps.StartBundleLoader; _steps = ESteps.LoadBundleFile;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
if (_steps == ESteps.StartBundleLoader) if (_steps == ESteps.LoadBundleFile)
{
foreach (var bundleLoader in _bundleLoaders)
{
bundleLoader.StartOperation();
AddChildOperation(bundleLoader);
}
_steps = ESteps.WaitBundleLoader;
}
if (_steps == ESteps.WaitBundleLoader)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{ {
@ -127,13 +116,6 @@ namespace YooAsset
} }
} }
// 更新资源包加载器
foreach (var bundleLoader in _bundleLoaders)
{
bundleLoader.UpdateOperation();
}
// 检测加载是否完成
foreach (var bundleLoader in _bundleLoaders) foreach (var bundleLoader in _bundleLoaders)
{ {
if (bundleLoader.IsDone == false) if (bundleLoader.IsDone == false)
@ -146,7 +128,6 @@ namespace YooAsset
} }
} }
// 检测加载结果
BundleResultObject = _mainBundleLoader.Result; BundleResultObject = _mainBundleLoader.Result;
if (BundleResultObject == null) if (BundleResultObject == null)
{ {
@ -339,7 +320,7 @@ namespace YooAsset
} }
[Conditional("DEBUG")] [Conditional("DEBUG")]
private void DebugBeginRecording() protected void DebugBeginRecording()
{ {
if (_watch == null) if (_watch == null)
{ {

View File

@ -23,8 +23,6 @@ namespace YooAsset
if (_loadSceneOp == null) if (_loadSceneOp == null)
{ {
_loadSceneOp = BundleResultObject.LoadSceneOperation(MainAssetInfo, _loadParams, _suspendLoad); _loadSceneOp = BundleResultObject.LoadSceneOperation(MainAssetInfo, _loadParams, _suspendLoad);
_loadSceneOp.StartOperation();
AddChildOperation(_loadSceneOp);
} }
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
@ -34,7 +32,6 @@ namespace YooAsset
if (_suspendLoad == false) if (_suspendLoad == false)
_loadSceneOp.UnSuspendLoad(); _loadSceneOp.UnSuspendLoad();
_loadSceneOp.UpdateOperation();
Progress = _loadSceneOp.Progress; Progress = _loadSceneOp.Progress;
if (_loadSceneOp.IsDone == false) if (_loadSceneOp.IsDone == false)
return; return;

View File

@ -13,14 +13,11 @@ namespace YooAsset
if (_loadSubAssetsOp == null) if (_loadSubAssetsOp == null)
{ {
_loadSubAssetsOp = BundleResultObject.LoadSubAssetsAsync(MainAssetInfo); _loadSubAssetsOp = BundleResultObject.LoadSubAssetsAsync(MainAssetInfo);
_loadSubAssetsOp.StartOperation();
AddChildOperation(_loadSubAssetsOp);
} }
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
_loadSubAssetsOp.WaitForAsyncComplete(); _loadSubAssetsOp.WaitForAsyncComplete();
_loadSubAssetsOp.UpdateOperation();
Progress = _loadSubAssetsOp.Progress; Progress = _loadSubAssetsOp.Progress;
if (_loadSubAssetsOp.IsDone == false) if (_loadSubAssetsOp.IsDone == false)
return; return;

View File

@ -321,6 +321,7 @@ namespace YooAsset
// 新增下载需求 // 新增下载需求
loaderOperation = new LoadBundleFileOperation(this, bundleInfo); loaderOperation = new LoadBundleFileOperation(this, bundleInfo);
OperationSystem.StartOperation(PackageName, loaderOperation);
LoaderDic.Add(bundleName, loaderOperation); LoaderDic.Add(bundleName, loaderOperation);
return loaderOperation; return loaderOperation;
} }

View File

@ -9,9 +9,9 @@ namespace YooAsset
PackageManifest ActiveManifest { set; get; } PackageManifest ActiveManifest { set; get; }
/// <summary> /// <summary>
/// 销毁文件系统 /// 更新游戏模式
/// </summary> /// </summary>
void DestroyFileSystem(); void UpdatePlayMode();
/// <summary> /// <summary>
/// 向网络端请求最新的资源版本 /// 向网络端请求最新的资源版本

View File

@ -35,11 +35,11 @@ namespace YooAsset
_clearMode = clearMode; _clearMode = clearMode;
_clearParam = clearParam; _clearParam = clearParam;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.ClearFileSystemA; _steps = ESteps.ClearFileSystemA;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -53,13 +53,8 @@ namespace YooAsset
} }
if (_clearCacheFilesOpA == null) if (_clearCacheFilesOpA == null)
{
_clearCacheFilesOpA = _fileSystemA.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam); _clearCacheFilesOpA = _fileSystemA.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
_clearCacheFilesOpA.StartOperation();
AddChildOperation(_clearCacheFilesOpA);
}
_clearCacheFilesOpA.UpdateOperation();
Progress = _clearCacheFilesOpA.Progress; Progress = _clearCacheFilesOpA.Progress;
if (_clearCacheFilesOpA.IsDone == false) if (_clearCacheFilesOpA.IsDone == false)
return; return;
@ -85,13 +80,8 @@ namespace YooAsset
} }
if (_clearCacheFilesOpB == null) if (_clearCacheFilesOpB == null)
{
_clearCacheFilesOpB = _fileSystemB.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam); _clearCacheFilesOpB = _fileSystemB.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
_clearCacheFilesOpB.StartOperation();
AddChildOperation(_clearCacheFilesOpB);
}
_clearCacheFilesOpB.UpdateOperation();
Progress = _clearCacheFilesOpB.Progress; Progress = _clearCacheFilesOpB.Progress;
if (_clearCacheFilesOpB.IsDone == false) if (_clearCacheFilesOpB.IsDone == false)
return; return;
@ -118,13 +108,8 @@ namespace YooAsset
} }
if (_clearCacheFilesOpC == null) if (_clearCacheFilesOpC == null)
{
_clearCacheFilesOpC = _fileSystemC.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam); _clearCacheFilesOpC = _fileSystemC.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
_clearCacheFilesOpC.StartOperation();
AddChildOperation(_clearCacheFilesOpC);
}
_clearCacheFilesOpC.UpdateOperation();
Progress = _clearCacheFilesOpC.Progress; Progress = _clearCacheFilesOpC.Progress;
if (_clearCacheFilesOpC.IsDone == false) if (_clearCacheFilesOpC.IsDone == false)
return; return;

View File

@ -22,11 +22,11 @@ namespace YooAsset
_resourcePackage = resourcePackage; _resourcePackage = resourcePackage;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CheckInitStatus; _steps = ESteps.CheckInitStatus;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -63,13 +63,8 @@ namespace YooAsset
if (_steps == ESteps.UnloadAllAssets) if (_steps == ESteps.UnloadAllAssets)
{ {
if (_unloadAllAssetsOp == null) if (_unloadAllAssetsOp == null)
{
_unloadAllAssetsOp = _resourcePackage.UnloadAllAssetsAsync(); _unloadAllAssetsOp = _resourcePackage.UnloadAllAssetsAsync();
_unloadAllAssetsOp.StartOperation();
AddChildOperation(_unloadAllAssetsOp);
}
_unloadAllAssetsOp.UpdateOperation();
if (_unloadAllAssetsOp.IsDone == false) if (_unloadAllAssetsOp.IsDone == false)
return; return;

View File

@ -116,12 +116,12 @@ namespace YooAsset
// 统计下载信息 // 统计下载信息
CalculatDownloaderInfo(); CalculatDownloaderInfo();
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
YooLogger.Log($"Begine to download {TotalDownloadCount} files and {TotalDownloadBytes} bytes"); YooLogger.Log($"Begine to download {TotalDownloadCount} files and {TotalDownloadBytes} bytes");
_steps = ESteps.Check; _steps = ESteps.Check;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;

View File

@ -31,11 +31,11 @@ namespace YooAsset
_impl = impl; _impl = impl;
_parameters = parameters; _parameters = parameters;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateFileSystem; _steps = ESteps.CreateFileSystem;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.CreateFileSystem) if (_steps == ESteps.CreateFileSystem)
{ {
@ -62,13 +62,8 @@ namespace YooAsset
if (_steps == ESteps.InitFileSystem) if (_steps == ESteps.InitFileSystem)
{ {
if (_initFileSystemOp == null) if (_initFileSystemOp == null)
{
_initFileSystemOp = _impl.EditorFileSystem.InitializeFileSystemAsync(); _initFileSystemOp = _impl.EditorFileSystem.InitializeFileSystemAsync();
_initFileSystemOp.StartOperation();
AddChildOperation(_initFileSystemOp);
}
_initFileSystemOp.UpdateOperation();
Progress = _initFileSystemOp.Progress; Progress = _initFileSystemOp.Progress;
if (_initFileSystemOp.IsDone == false) if (_initFileSystemOp.IsDone == false)
return; return;
@ -104,6 +99,8 @@ namespace YooAsset
private readonly OfflinePlayModeImpl _impl; private readonly OfflinePlayModeImpl _impl;
private readonly OfflinePlayModeParameters _parameters; private readonly OfflinePlayModeParameters _parameters;
private FSInitializeFileSystemOperation _initFileSystemOp; private FSInitializeFileSystemOperation _initFileSystemOp;
private FSRequestPackageVersionOperation _requestPackageVersionOp;
private FSLoadPackageManifestOperation _loadPackageManifestOp;
private ESteps _steps = ESteps.None; private ESteps _steps = ESteps.None;
internal OfflinePlayModeInitializationOperation(OfflinePlayModeImpl impl, OfflinePlayModeParameters parameters) internal OfflinePlayModeInitializationOperation(OfflinePlayModeImpl impl, OfflinePlayModeParameters parameters)
@ -111,11 +108,11 @@ namespace YooAsset
_impl = impl; _impl = impl;
_parameters = parameters; _parameters = parameters;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateFileSystem; _steps = ESteps.CreateFileSystem;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -145,13 +142,8 @@ namespace YooAsset
if (_steps == ESteps.InitFileSystem) if (_steps == ESteps.InitFileSystem)
{ {
if (_initFileSystemOp == null) if (_initFileSystemOp == null)
{
_initFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync(); _initFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
_initFileSystemOp.StartOperation();
AddChildOperation(_initFileSystemOp);
}
_initFileSystemOp.UpdateOperation();
Progress = _initFileSystemOp.Progress; Progress = _initFileSystemOp.Progress;
if (_initFileSystemOp.IsDone == false) if (_initFileSystemOp.IsDone == false)
return; return;
@ -197,11 +189,11 @@ namespace YooAsset
_impl = impl; _impl = impl;
_parameters = parameters; _parameters = parameters;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateBuildinFileSystem; _steps = ESteps.CreateBuildinFileSystem;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -229,13 +221,8 @@ namespace YooAsset
if (_steps == ESteps.InitBuildinFileSystem) if (_steps == ESteps.InitBuildinFileSystem)
{ {
if (_initBuildinFileSystemOp == null) if (_initBuildinFileSystemOp == null)
{
_initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync(); _initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync();
_initBuildinFileSystemOp.StartOperation();
AddChildOperation(_initBuildinFileSystemOp);
}
_initBuildinFileSystemOp.UpdateOperation();
Progress = _initBuildinFileSystemOp.Progress; Progress = _initBuildinFileSystemOp.Progress;
if (_initBuildinFileSystemOp.IsDone == false) if (_initBuildinFileSystemOp.IsDone == false)
return; return;
@ -277,13 +264,8 @@ namespace YooAsset
if (_steps == ESteps.InitCacheFileSystem) if (_steps == ESteps.InitCacheFileSystem)
{ {
if (_initCacheFileSystemOp == null) if (_initCacheFileSystemOp == null)
{
_initCacheFileSystemOp = _impl.CacheFileSystem.InitializeFileSystemAsync(); _initCacheFileSystemOp = _impl.CacheFileSystem.InitializeFileSystemAsync();
_initCacheFileSystemOp.StartOperation();
AddChildOperation(_initCacheFileSystemOp);
}
_initCacheFileSystemOp.UpdateOperation();
Progress = _initCacheFileSystemOp.Progress; Progress = _initCacheFileSystemOp.Progress;
if (_initCacheFileSystemOp.IsDone == false) if (_initCacheFileSystemOp.IsDone == false)
return; return;
@ -330,11 +312,11 @@ namespace YooAsset
_impl = impl; _impl = impl;
_parameters = parameters; _parameters = parameters;
} }
internal override void InternalStart() internal override void InternalOnStart()
{ {
_steps = ESteps.CreateWebServerFileSystem; _steps = ESteps.CreateWebServerFileSystem;
} }
internal override void InternalUpdate() internal override void InternalOnUpdate()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; return;
@ -362,13 +344,8 @@ namespace YooAsset
if (_steps == ESteps.InitWebServerFileSystem) if (_steps == ESteps.InitWebServerFileSystem)
{ {
if (_initWebServerFileSystemOp == null) if (_initWebServerFileSystemOp == null)
{
_initWebServerFileSystemOp = _impl.WebServerFileSystem.InitializeFileSystemAsync(); _initWebServerFileSystemOp = _impl.WebServerFileSystem.InitializeFileSystemAsync();
_initWebServerFileSystemOp.StartOperation();
AddChildOperation(_initWebServerFileSystemOp);
}
_initWebServerFileSystemOp.UpdateOperation();
Progress = _initWebServerFileSystemOp.Progress; Progress = _initWebServerFileSystemOp.Progress;
if (_initWebServerFileSystemOp.IsDone == false) if (_initWebServerFileSystemOp.IsDone == false)
return; return;
@ -408,13 +385,8 @@ namespace YooAsset
if (_steps == ESteps.InitWebRemoteFileSystem) if (_steps == ESteps.InitWebRemoteFileSystem)
{ {
if (_initWebRemoteFileSystemOp == null) if (_initWebRemoteFileSystemOp == null)
{
_initWebRemoteFileSystemOp = _impl.WebRemoteFileSystem.InitializeFileSystemAsync(); _initWebRemoteFileSystemOp = _impl.WebRemoteFileSystem.InitializeFileSystemAsync();
_initWebRemoteFileSystemOp.StartOperation();
AddChildOperation(_initWebRemoteFileSystemOp);
}
_initWebRemoteFileSystemOp.UpdateOperation();
Progress = _initWebRemoteFileSystemOp.Progress; Progress = _initWebRemoteFileSystemOp.Progress;
if (_initWebRemoteFileSystemOp.IsDone == false) if (_initWebRemoteFileSystemOp.IsDone == false)
return; return;

Some files were not shown because too many files have changed in this diff Show More