mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-18 05:40:18 +00:00
Compare commits
15 Commits
64e9734bbe
...
2.3.2-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7382afe535 | ||
|
|
af7d4774d6 | ||
|
|
520a8a0623 | ||
|
|
fbd0d8ec40 | ||
|
|
3fea98ce4c | ||
|
|
7c561ce254 | ||
|
|
522ddb5115 | ||
|
|
47f5790507 | ||
|
|
0cdcfe7f52 | ||
|
|
e4d69d869b | ||
|
|
61afb70cb9 | ||
|
|
79580697a1 | ||
|
|
6cb74760b0 | ||
|
|
c758aa81ff | ||
|
|
400c2ccefe |
@@ -2,6 +2,55 @@
|
||||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [2.3.2-preview] - 2025-02-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- (2.3.1) 修复小游戏平台下载器不生效的问题。
|
||||
- (#480) 修复了Unity工程打包导出时的报错。
|
||||
|
||||
### Added
|
||||
|
||||
- 下载器新增参数:recursiveDownload
|
||||
|
||||
```csharp
|
||||
/// <summary>
|
||||
/// 创建资源下载器,用于下载指定的资源依赖的资源包文件
|
||||
/// </summary>
|
||||
/// <param name="recursiveDownload">下载资源对象所属资源包内所有资源对象依赖的资源包
|
||||
public ResourceDownloaderOperation CreateBundleDownloader()
|
||||
```
|
||||
|
||||
- 新增CustomPlayMode模式
|
||||
|
||||
```csharp
|
||||
/// <summary>
|
||||
/// 自定义运行模式的初始化参数
|
||||
/// </summary>
|
||||
public class CustomPlayModeParameters : InitializeParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件系统初始化参数列表
|
||||
/// 注意:列表最后一个元素作为主文件系统!
|
||||
/// </summary>
|
||||
public List<FileSystemParameters> FileSystemParameterList;
|
||||
}
|
||||
```
|
||||
|
||||
## [2.3.1-preview] - 2025-02-25
|
||||
|
||||
**资源加载依赖计算方式还原为了1.5x版本的模式,只加载资源对象实际依赖的资源包,不再以资源对象所在资源包的依赖关系为加载标准**。
|
||||
|
||||
### Improvements
|
||||
|
||||
- 优化OperationSystem的更新机制,异步加载的耗时降低了50%。
|
||||
- 优化了Debugger窗口的显示页面,BundleView页面增加资源包的引用列表。
|
||||
- 优化了Reporter窗口的显示页面。
|
||||
|
||||
### Fixed
|
||||
|
||||
- 修复了怀旧依赖模式下,TAG传染不正确的问题。
|
||||
|
||||
## [2.3.0-preview] - 2025-02-19
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace YooAsset
|
||||
internal UnityWebDataRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
||||
{
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ namespace YooAsset
|
||||
DisposeRequest();
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeRequest();
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSavePath = fileSavePath;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -54,7 +54,7 @@ namespace YooAsset
|
||||
DisposeRequest();
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeRequest();
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace YooAsset
|
||||
internal UnityWebTextRequestOperation(string url, int timeout = 60) : base(url, timeout)
|
||||
{
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ namespace YooAsset
|
||||
DisposeRequest();
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeRequest();
|
||||
|
||||
@@ -48,25 +48,21 @@ namespace YooAsset
|
||||
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new AssetBundleLoadAssetOperation(_packageBundle, _assetBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new AssetBundleLoadAllAssetsOperation(_packageBundle, _assetBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new AssetBundleLoadSubAssetsOperation(_packageBundle, _assetBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
|
||||
{
|
||||
var operation = new AssetBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_assetBundle = assetBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_assetBundle = assetBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_loadParams = loadParams;
|
||||
_suspendLoad = suspendLoad;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadScene;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -107,7 +107,7 @@ namespace YooAsset
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
{
|
||||
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
}
|
||||
public override void UnSuspendLoad()
|
||||
{
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_assetBundle = assetBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -3,12 +3,12 @@ namespace YooAsset
|
||||
{
|
||||
internal class RawBundleLoadAllAssetsOperation : FSLoadAllAssetsOperation
|
||||
{
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadAllAssetsOperation)} not support load all assets !";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ namespace YooAsset
|
||||
{
|
||||
internal class RawBundleLoadAssetOperation : FSLoadAssetOperation
|
||||
{
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadAssetOperation)} not support load asset !";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ namespace YooAsset
|
||||
{
|
||||
internal class RawBundleLoadSceneOperation : FSLoadSceneOperation
|
||||
{
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadSceneOperation)} not support load scene !";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
public override void UnSuspendLoad()
|
||||
|
||||
@@ -3,12 +3,12 @@ namespace YooAsset
|
||||
{
|
||||
internal class RawBundleLoadSubAssetsOperation : FSLoadSubAssetsOperation
|
||||
{
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Error = $"{nameof(RawBundleLoadSubAssetsOperation)} not support load sub assets !";
|
||||
Status = EOperationStatus.Failed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,25 +32,21 @@ namespace YooAsset
|
||||
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new RawBundleLoadAssetOperation();
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new RawBundleLoadAllAssetsOperation();
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new RawBundleLoadSubAssetsOperation();
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
|
||||
{
|
||||
var operation = new RawBundleLoadSceneOperation();
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace YooAsset
|
||||
_packageBundle = packageBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_steps = ESteps.CheckBundle;
|
||||
@@ -32,7 +32,7 @@ namespace YooAsset
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace YooAsset
|
||||
_packageBundle = packageBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_steps = ESteps.CheckBundle;
|
||||
@@ -31,7 +31,7 @@ namespace YooAsset
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace YooAsset
|
||||
_loadParams = loadParams;
|
||||
_suspendLoad = suspendLoad;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_steps = ESteps.LoadScene;
|
||||
@@ -35,7 +35,7 @@ namespace YooAsset
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
@@ -113,7 +113,7 @@ namespace YooAsset
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
{
|
||||
//TODO 场景加载不支持异步转同步,为了支持同步加载方法需要实现该方法!
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
}
|
||||
public override void UnSuspendLoad()
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace YooAsset
|
||||
_packageBundle = packageBundle;
|
||||
_assetInfo = assetInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
_steps = ESteps.CheckBundle;
|
||||
@@ -32,7 +32,7 @@ namespace YooAsset
|
||||
Status = EOperationStatus.Failed;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
|
||||
@@ -32,25 +32,21 @@ namespace YooAsset
|
||||
public override FSLoadAssetOperation LoadAssetAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new VirtualBundleLoadAssetOperation(_packageBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadAllAssetsOperation LoadAllAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new VirtualBundleLoadAllAssetsOperation(_packageBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSubAssetsOperation LoadSubAssetsAsync(AssetInfo assetInfo)
|
||||
{
|
||||
var operation = new VirtualBundleLoadSubAssetsOperation(_packageBundle, assetInfo);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public override FSLoadSceneOperation LoadSceneOperation(AssetInfo assetInfo, LoadSceneParameters loadParams, bool suspendLoad)
|
||||
{
|
||||
var operation = new VirtualBundleLoadSceneOperation(assetInfo, loadParams, suspendLoad);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,19 +92,16 @@ namespace YooAsset
|
||||
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
|
||||
{
|
||||
var operation = new DBFSInitializeOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DBFSLoadPackageManifestOperation(this, packageVersion);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DBFSRequestPackageVersionOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
|
||||
@@ -127,20 +124,17 @@ namespace YooAsset
|
||||
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
|
||||
{
|
||||
var operation = new DBFSLoadAssetBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
|
||||
{
|
||||
var operation = new DBFSLoadRawBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"{nameof(DefaultBuildinFileSystem)} not support load bundle type : {bundle.BundleType}";
|
||||
var operation = new FSLoadBundleCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
@@ -194,9 +188,8 @@ namespace YooAsset
|
||||
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
|
||||
_unpackFileSystem.OnCreate(packageName, null);
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
_unpackFileSystem.OnUpdate();
|
||||
}
|
||||
|
||||
public virtual bool Belong(PackageBundle bundle)
|
||||
@@ -346,10 +339,13 @@ namespace YooAsset
|
||||
return false;
|
||||
|
||||
#if UNITY_ANDROID
|
||||
if (bundle.BundleType == (int)EBuildBundleType.RawBundle || bundle.Encrypted)
|
||||
if (bundle.Encrypted)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@@ -18,9 +18,8 @@ namespace YooAsset
|
||||
YooLogger.Log("Begin to create catalog file !");
|
||||
|
||||
string savePath = YooAssetSettingsData.GetYooResourcesFullPath();
|
||||
DirectoryInfo saveDirectory = new DirectoryInfo(savePath);
|
||||
if (saveDirectory.Exists)
|
||||
saveDirectory.Delete(true);
|
||||
if (UnityEditor.AssetDatabase.DeleteAsset(savePath))
|
||||
UnityEditor.AssetDatabase.Refresh();
|
||||
|
||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_WEBGL
|
||||
_steps = ESteps.Done;
|
||||
@@ -37,7 +37,7 @@ namespace YooAsset
|
||||
_steps = ESteps.InitUnpackFileSystem;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -47,9 +47,11 @@ namespace YooAsset
|
||||
if (_copyBuildinPackageManifestOp == null)
|
||||
{
|
||||
_copyBuildinPackageManifestOp = new CopyBuildinPackageManifestOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _copyBuildinPackageManifestOp);
|
||||
_copyBuildinPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_copyBuildinPackageManifestOp);
|
||||
}
|
||||
|
||||
_copyBuildinPackageManifestOp.UpdateOperation();
|
||||
if (_copyBuildinPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -68,8 +70,13 @@ namespace YooAsset
|
||||
if (_steps == ESteps.InitUnpackFileSystem)
|
||||
{
|
||||
if (_initUnpackFIleSystemOp == null)
|
||||
{
|
||||
_initUnpackFIleSystemOp = _fileSystem.InitializeUpackFileSystem();
|
||||
_initUnpackFIleSystemOp.StartOperation();
|
||||
AddChildOperation(_initUnpackFIleSystemOp);
|
||||
}
|
||||
|
||||
_initUnpackFIleSystemOp.UpdateOperation();
|
||||
Progress = _initUnpackFIleSystemOp.Progress;
|
||||
if (_initUnpackFIleSystemOp.IsDone == false)
|
||||
return;
|
||||
@@ -113,9 +120,11 @@ namespace YooAsset
|
||||
#endif
|
||||
|
||||
_loadCatalogFileOp = new LoadBuildinCatalogFileOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadCatalogFileOp);
|
||||
_loadCatalogFileOp.StartOperation();
|
||||
AddChildOperation(_loadCatalogFileOp);
|
||||
}
|
||||
|
||||
_loadCatalogFileOp.UpdateOperation();
|
||||
if (_loadCatalogFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadAssetBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -139,9 +139,6 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -166,13 +163,13 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
DownloadProgress = 1f;
|
||||
DownloadedBytes = _bundle.FileSize;
|
||||
_steps = ESteps.LoadBuildinRawBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -206,8 +203,5 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestBuildinPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -37,9 +37,11 @@ namespace YooAsset
|
||||
if (_requestBuildinPackageHashOp == null)
|
||||
{
|
||||
_requestBuildinPackageHashOp = new RequestBuildinPackageHashOperation(_fileSystem, _packageVersion);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageHashOp);
|
||||
_requestBuildinPackageHashOp.StartOperation();
|
||||
AddChildOperation(_requestBuildinPackageHashOp);
|
||||
}
|
||||
|
||||
_requestBuildinPackageHashOp.UpdateOperation();
|
||||
if (_requestBuildinPackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -61,9 +63,11 @@ namespace YooAsset
|
||||
{
|
||||
string packageHash = _requestBuildinPackageHashOp.PackageHash;
|
||||
_loadBuildinPackageManifestOp = new LoadBuildinPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadBuildinPackageManifestOp);
|
||||
_loadBuildinPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadBuildinPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadBuildinPackageManifestOp.UpdateOperation();
|
||||
if (_loadBuildinPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -33,9 +33,11 @@ namespace YooAsset
|
||||
if (_requestBuildinPackageVersionOp == null)
|
||||
{
|
||||
_requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageVersionOp);
|
||||
_requestBuildinPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestBuildinPackageVersionOp);
|
||||
}
|
||||
|
||||
_requestBuildinPackageVersionOp.UpdateOperation();
|
||||
if (_requestBuildinPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -43,9 +43,11 @@ namespace YooAsset
|
||||
if (_requestBuildinPackageVersionOp == null)
|
||||
{
|
||||
_requestBuildinPackageVersionOp = new RequestBuildinPackageVersionOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestBuildinPackageVersionOp);
|
||||
_requestBuildinPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestBuildinPackageVersionOp);
|
||||
}
|
||||
|
||||
_requestBuildinPackageVersionOp.UpdateOperation();
|
||||
if (_requestBuildinPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -82,9 +84,11 @@ namespace YooAsset
|
||||
string destPath = GetCopyPackageHashDestPath(_buildinPackageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||
_hashFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _hashFileRequestOp);
|
||||
_hashFileRequestOp.StartOperation();
|
||||
AddChildOperation(_hashFileRequestOp);
|
||||
}
|
||||
|
||||
_hashFileRequestOp.UpdateOperation();
|
||||
if (_hashFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -121,9 +125,11 @@ namespace YooAsset
|
||||
string destPath = GetCopyPackageManifestDestPath(_buildinPackageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(sourcePath);
|
||||
_manifestFileRequestOp = new UnityWebFileRequestOperation(url, destPath);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _manifestFileRequestOp);
|
||||
_manifestFileRequestOp.StartOperation();
|
||||
AddChildOperation(_manifestFileRequestOp);
|
||||
}
|
||||
|
||||
_manifestFileRequestOp.UpdateOperation();
|
||||
if (_manifestFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadCatalog;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -47,9 +47,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetBuildinPackageManifestFilePath(_packageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
|
||||
_webDataRequestOp.StartOperation();
|
||||
AddChildOperation(_webDataRequestOp);
|
||||
}
|
||||
|
||||
_webDataRequestOp.UpdateOperation();
|
||||
if (_webDataRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -85,9 +87,11 @@ namespace YooAsset
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
_deserializer.StartOperation();
|
||||
AddChildOperation(_deserializer);
|
||||
}
|
||||
|
||||
_deserializer.UpdateOperation();
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -42,9 +42,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetBuildinPackageHashFilePath(_packageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -40,9 +40,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetBuildinPackageVersionFilePath();
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -15,13 +15,18 @@ namespace YooAsset
|
||||
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> _tempFilePathMapping = new Dictionary<string, string>(10000);
|
||||
protected DefaultCacheDownloadCenter _downloadCenter;
|
||||
|
||||
protected string _packageRoot;
|
||||
protected string _tempFilesRoot;
|
||||
protected string _cacheBundleFilesRoot;
|
||||
protected string _cacheManifestFilesRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 下载中心
|
||||
/// 说明:当异步操作任务终止的时候,所有下载子任务都会一同被终止!
|
||||
/// </summary>
|
||||
public DownloadCenterOperation DownloadCenter { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 包裹名称
|
||||
/// </summary>
|
||||
@@ -98,19 +103,16 @@ namespace YooAsset
|
||||
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
|
||||
{
|
||||
var operation = new DCFSInitializeOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DCFSLoadPackageManifestOperation(this, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
|
||||
@@ -118,64 +120,60 @@ namespace YooAsset
|
||||
if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
|
||||
{
|
||||
var operation = new ClearAllCacheBundleFilesOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
|
||||
{
|
||||
var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (clearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
|
||||
{
|
||||
var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, clearParam);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (clearMode == EFileClearMode.ClearAllManifestFiles.ToString())
|
||||
{
|
||||
var operation = new ClearAllCacheManifestFilesOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (clearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
|
||||
{
|
||||
var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"Invalid clear mode : {clearMode}";
|
||||
var operation = new FSClearCacheFilesCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
{
|
||||
return _downloadCenter.DownloadFileAsync(bundle, param);
|
||||
var downloader = DownloadCenter.DownloadFileAsync(bundle, param);
|
||||
downloader.Reference(); //增加下载器的引用计数
|
||||
|
||||
// 注意:将下载器进行包裹,可以避免父类任务终止的时候,连带子任务里的下载器也一起被终止!
|
||||
var wrapper = new DownloadFileWrapper(downloader);
|
||||
return wrapper;
|
||||
}
|
||||
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
|
||||
{
|
||||
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
|
||||
{
|
||||
var operation = new DCFSLoadAssetBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
|
||||
{
|
||||
var operation = new DCFSLoadRawBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"{nameof(DefaultCacheFileSystem)} not support load bundle type : {bundle.BundleType}";
|
||||
var operation = new FSLoadBundleCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
@@ -231,11 +229,14 @@ namespace YooAsset
|
||||
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName);
|
||||
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
|
||||
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
|
||||
_downloadCenter = new DefaultCacheDownloadCenter(this);
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
_downloadCenter.Update();
|
||||
if (DownloadCenter != null)
|
||||
{
|
||||
DownloadCenter.AbortOperation();
|
||||
DownloadCenter = null;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Belong(PackageBundle bundle)
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace YooAsset
|
||||
CheckAppFootPrint,
|
||||
SearchCacheFiles,
|
||||
VerifyCacheFiles,
|
||||
CreateDownloadCenter,
|
||||
Done,
|
||||
}
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
#if UNITY_WEBGL
|
||||
_steps = ESteps.Done;
|
||||
@@ -32,7 +33,7 @@ namespace YooAsset
|
||||
_steps = ESteps.CheckAppFootPrint;
|
||||
#endif
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -58,9 +59,11 @@ namespace YooAsset
|
||||
if (_searchCacheFilesOp == null)
|
||||
{
|
||||
_searchCacheFilesOp = new SearchCacheFilesOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _searchCacheFilesOp);
|
||||
_searchCacheFilesOp.StartOperation();
|
||||
AddChildOperation(_searchCacheFilesOp);
|
||||
}
|
||||
|
||||
_searchCacheFilesOp.UpdateOperation();
|
||||
Progress = _searchCacheFilesOp.Progress;
|
||||
if (_searchCacheFilesOp.IsDone == false)
|
||||
return;
|
||||
@@ -73,17 +76,18 @@ namespace YooAsset
|
||||
if (_verifyCacheFilesOp == null)
|
||||
{
|
||||
_verifyCacheFilesOp = new VerifyCacheFilesOperation(_fileSystem, _searchCacheFilesOp.Result);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _verifyCacheFilesOp);
|
||||
_verifyCacheFilesOp.StartOperation();
|
||||
AddChildOperation(_verifyCacheFilesOp);
|
||||
}
|
||||
|
||||
_verifyCacheFilesOp.UpdateOperation();
|
||||
Progress = _verifyCacheFilesOp.Progress;
|
||||
if (_verifyCacheFilesOp.IsDone == false)
|
||||
return;
|
||||
|
||||
if (_verifyCacheFilesOp.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Succeed;
|
||||
_steps = ESteps.CreateDownloadCenter;
|
||||
YooLogger.Log($"Package '{_fileSystem.PackageName}' cached files count : {_fileSystem.FileCount}");
|
||||
}
|
||||
else
|
||||
@@ -93,6 +97,19 @@ namespace YooAsset
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -54,15 +54,19 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
// 注意:边玩边下下载器引用计数没有Release
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
_downloadFileOp.StartOperation();
|
||||
AddChildOperation(_downloadFileOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_downloadFileOp.WaitForAsyncComplete();
|
||||
|
||||
_downloadFileOp.UpdateOperation();
|
||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
||||
if (_downloadFileOp.IsDone == false)
|
||||
@@ -219,14 +223,6 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
if (_downloadFileOp != null)
|
||||
_downloadFileOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DCFSLoadRawBundleOperation : FSLoadBundleOperation
|
||||
@@ -251,11 +247,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -276,15 +272,19 @@ namespace YooAsset
|
||||
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
// 注意:边玩边下下载器引用计数没有Release
|
||||
if (_downloadFileOp == null)
|
||||
{
|
||||
DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
|
||||
_downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
|
||||
_downloadFileOp.StartOperation();
|
||||
AddChildOperation(_downloadFileOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_downloadFileOp.WaitForAsyncComplete();
|
||||
|
||||
_downloadFileOp.UpdateOperation();
|
||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
||||
if (_downloadFileOp.IsDone == false)
|
||||
@@ -335,13 +335,5 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.DownloadFile)
|
||||
{
|
||||
if (_downloadFileOp != null)
|
||||
_downloadFileOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.DownloadPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -44,9 +44,11 @@ namespace YooAsset
|
||||
if (_downloadPackageHashOp == null)
|
||||
{
|
||||
_downloadPackageHashOp = new DownloadPackageHashOperation(_fileSystem, _packageVersion, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadPackageHashOp);
|
||||
_downloadPackageHashOp.StartOperation();
|
||||
AddChildOperation(_downloadPackageHashOp);
|
||||
}
|
||||
|
||||
_downloadPackageHashOp.UpdateOperation();
|
||||
if (_downloadPackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -67,9 +69,11 @@ namespace YooAsset
|
||||
if (_downloadPackageManifestOp == null)
|
||||
{
|
||||
_downloadPackageManifestOp = new DownloadPackageManifestOperation(_fileSystem, _packageVersion, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadPackageManifestOp);
|
||||
_downloadPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_downloadPackageManifestOp);
|
||||
}
|
||||
|
||||
_downloadPackageManifestOp.UpdateOperation();
|
||||
if (_downloadPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -90,9 +94,11 @@ namespace YooAsset
|
||||
if (_loadCachePackageHashOp == null)
|
||||
{
|
||||
_loadCachePackageHashOp = new LoadCachePackageHashOperation(_fileSystem, _packageVersion);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadCachePackageHashOp);
|
||||
_loadCachePackageHashOp.StartOperation();
|
||||
AddChildOperation(_loadCachePackageHashOp);
|
||||
}
|
||||
|
||||
_loadCachePackageHashOp.UpdateOperation();
|
||||
if (_loadCachePackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -115,9 +121,11 @@ namespace YooAsset
|
||||
{
|
||||
string packageHash = _loadCachePackageHashOp.PackageHash;
|
||||
_loadCachePackageManifestOp = new LoadCachePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadCachePackageManifestOp);
|
||||
_loadCachePackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadCachePackageManifestOp);
|
||||
}
|
||||
|
||||
_loadCachePackageManifestOp.UpdateOperation();
|
||||
Progress = _loadCachePackageManifestOp.Progress;
|
||||
if (_loadCachePackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.GetPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -37,9 +37,11 @@ namespace YooAsset
|
||||
if (_requestRemotePackageVersionOp == null)
|
||||
{
|
||||
_requestRemotePackageVersionOp = new RequestRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestRemotePackageVersionOp);
|
||||
_requestRemotePackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestRemotePackageVersionOp);
|
||||
}
|
||||
|
||||
_requestRemotePackageVersionOp.UpdateOperation();
|
||||
Progress = _requestRemotePackageVersionOp.Progress;
|
||||
if (_requestRemotePackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.GetAllCacheFiles;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.ClearAllCacheFiles;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace YooAsset
|
||||
_manifest = manifest;
|
||||
_clearParam = clearParam;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckArgs;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_manifest = manifest;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.GetUnusedCacheFiles;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_manifest = manifest;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.ClearUnusedCacheFiles;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -3,33 +3,33 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DefaultCacheDownloadCenter
|
||||
internal class DownloadCenterOperation : AsyncOperationBase
|
||||
{
|
||||
private readonly DefaultCacheFileSystem _fileSystem;
|
||||
protected readonly Dictionary<string, DefaultDownloadFileOperation> _downloaders = new Dictionary<string, DefaultDownloadFileOperation>(1000);
|
||||
protected readonly List<string> _removeDownloadList = new List<string>(1000);
|
||||
|
||||
public DefaultCacheDownloadCenter(DefaultCacheFileSystem fileSystem)
|
||||
public DownloadCenterOperation(DefaultCacheFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新下载中心
|
||||
/// </summary>
|
||||
public void Update()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
// 获取可移除的下载器集合
|
||||
_removeDownloadList.Clear();
|
||||
foreach (var valuePair in _downloaders)
|
||||
{
|
||||
var downloader = valuePair.Value;
|
||||
downloader.UpdateOperation();
|
||||
|
||||
// 注意:主动终止引用计数为零的下载任务
|
||||
if (downloader.RefCount <= 0)
|
||||
{
|
||||
_removeDownloadList.Add(valuePair.Key);
|
||||
downloader.SetAbort();
|
||||
downloader.AbortOperation();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace YooAsset
|
||||
var operation = operationPair.Value;
|
||||
if (operation.Status == EOperationStatus.None)
|
||||
{
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, operation);
|
||||
operation.StartOperation();
|
||||
startCount--;
|
||||
if (startCount <= 0)
|
||||
break;
|
||||
@@ -79,7 +79,6 @@ namespace YooAsset
|
||||
// 查询旧的下载器
|
||||
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
|
||||
{
|
||||
oldDownloader.Reference();
|
||||
return oldDownloader;
|
||||
}
|
||||
|
||||
@@ -101,13 +100,13 @@ namespace YooAsset
|
||||
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
|
||||
{
|
||||
newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, param);
|
||||
newDownloader.Reference();
|
||||
AddChildOperation(newDownloader);
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, param);
|
||||
newDownloader.Reference();
|
||||
AddChildOperation(newDownloader);
|
||||
_downloaders.Add(bundle.BundleGUID, newDownloader);
|
||||
}
|
||||
return newDownloader;
|
||||
@@ -16,13 +16,13 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
|
||||
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_steps = ESteps.CheckExists;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -89,7 +89,8 @@ namespace YooAsset
|
||||
{
|
||||
var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize);
|
||||
_verifyOperation = new VerifyTempFileOperation(element);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _verifyOperation);
|
||||
_verifyOperation.StartOperation();
|
||||
AddChildOperation(_verifyOperation);
|
||||
_steps = ESteps.CheckVerifyTempFile;
|
||||
}
|
||||
|
||||
@@ -99,6 +100,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete)
|
||||
_verifyOperation.WaitForAsyncComplete();
|
||||
|
||||
_verifyOperation.UpdateOperation();
|
||||
if (_verifyOperation.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -157,25 +159,19 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeWebRequest();
|
||||
}
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
{
|
||||
//TODO 防止下载器挂起陷入无限死循环!
|
||||
if (_steps == ESteps.None)
|
||||
{
|
||||
InternalOnStart();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
//TODO 如果是导入或解压本地文件,执行等待完毕
|
||||
if (_isReuqestLocalFile)
|
||||
{
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
if (IsDone)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageHashOperation));
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -58,9 +58,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string webURL = GetWebRequestURL(fileName);
|
||||
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
|
||||
_webFileRequestOp.StartOperation();
|
||||
AddChildOperation(_webFileRequestOp);
|
||||
}
|
||||
|
||||
_webFileRequestOp.UpdateOperation();
|
||||
if (_webFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(DownloadPackageManifestOperation));
|
||||
_steps = ESteps.CheckExist;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -58,9 +58,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string webURL = GetDownloadRequestURL(fileName);
|
||||
_webFileRequestOp = new UnityWebFileRequestOperation(webURL, savePath, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webFileRequestOp);
|
||||
_webFileRequestOp.StartOperation();
|
||||
AddChildOperation(_webFileRequestOp);
|
||||
}
|
||||
|
||||
_webFileRequestOp.UpdateOperation();
|
||||
if (_webFileRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
@@ -20,13 +19,13 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
|
||||
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
|
||||
_steps = ESteps.CheckExists;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -110,7 +109,8 @@ namespace YooAsset
|
||||
{
|
||||
var element = new TempFileElement(_tempFilePath, Bundle.FileCRC, Bundle.FileSize);
|
||||
_verifyOperation = new VerifyTempFileOperation(element);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _verifyOperation);
|
||||
_verifyOperation.StartOperation();
|
||||
AddChildOperation(_verifyOperation);
|
||||
_steps = ESteps.CheckVerifyTempFile;
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ namespace YooAsset
|
||||
if (IsWaitForAsyncComplete)
|
||||
_verifyOperation.WaitForAsyncComplete();
|
||||
|
||||
_verifyOperation.UpdateOperation();
|
||||
if (_verifyOperation.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -177,25 +178,19 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeWebRequest();
|
||||
}
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
{
|
||||
//TODO 防止下载器挂起陷入无限死循环!
|
||||
if (_steps == ESteps.None)
|
||||
{
|
||||
InternalOnStart();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
//TODO 如果是导入或解压本地文件,执行等待完毕
|
||||
if (_isReuqestLocalFile)
|
||||
{
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
if (IsDone)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -77,9 +77,11 @@ namespace YooAsset
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_fileData);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
_deserializer.StartOperation();
|
||||
AddChildOperation(_deserializer);
|
||||
}
|
||||
|
||||
_deserializer.UpdateOperation();
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestRemotePackageVersionOperation));
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -46,9 +46,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
|
||||
string url = GetWebRequestURL(fileName);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.Prepare;
|
||||
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace YooAsset
|
||||
_waitingList = elements;
|
||||
_fileVerifyLevel = fileSystem.FileVerifyLevel;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.InitVerify;
|
||||
_verifyStartTime = UnityEngine.Time.realtimeSinceStartup;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace YooAsset
|
||||
{
|
||||
_element = element;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.VerifyFile;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ namespace YooAsset
|
||||
while (true)
|
||||
{
|
||||
//TODO 等待子线程验证文件完毕,该操作会挂起主线程
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
if (IsDone)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,25 +54,21 @@ namespace YooAsset
|
||||
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
|
||||
{
|
||||
var operation = new DEFSInitializeOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DEFSLoadPackageManifestOperation(this, packageVersion);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DEFSRequestPackageVersionOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
|
||||
{
|
||||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
@@ -84,14 +80,12 @@ namespace YooAsset
|
||||
if (bundle.BundleType == (int)EBuildBundleType.VirtualBundle)
|
||||
{
|
||||
var operation = new DEFSLoadBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"{nameof(DefaultEditorFileSystem)} not support load bundle type : {bundle.BundleType}";
|
||||
var operation = new FSLoadBundleCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
@@ -120,7 +114,7 @@ namespace YooAsset
|
||||
|
||||
_packageRoot = packageRoot;
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSytem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.DownloadFile;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -72,8 +72,5 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadEditorPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -37,9 +37,11 @@ namespace YooAsset
|
||||
if (_loadEditorPackageHashOpe == null)
|
||||
{
|
||||
_loadEditorPackageHashOpe = new LoadEditorPackageHashOperation(_fileSystem, _packageVersion);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageHashOpe);
|
||||
_loadEditorPackageHashOpe.StartOperation();
|
||||
AddChildOperation(_loadEditorPackageHashOpe);
|
||||
}
|
||||
|
||||
_loadEditorPackageHashOpe.UpdateOperation();
|
||||
if (_loadEditorPackageHashOpe.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -61,9 +63,11 @@ namespace YooAsset
|
||||
{
|
||||
string packageHash = _loadEditorPackageHashOpe.PackageHash;
|
||||
_loadEditorPackageManifestOp = new LoadEditorPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageManifestOp);
|
||||
_loadEditorPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadEditorPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadEditorPackageManifestOp.UpdateOperation();
|
||||
Progress = _loadEditorPackageManifestOp.Progress;
|
||||
if (_loadEditorPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -33,9 +33,11 @@ namespace YooAsset
|
||||
if (_loadEditorPackageVersionOp == null)
|
||||
{
|
||||
_loadEditorPackageVersionOp = new LoadEditorPackageVersionOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadEditorPackageVersionOp);
|
||||
_loadEditorPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_loadEditorPackageVersionOp);
|
||||
}
|
||||
|
||||
_loadEditorPackageVersionOp.UpdateOperation();
|
||||
if (_loadEditorPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_packageVersion = packageVersion;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -77,9 +77,11 @@ namespace YooAsset
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_fileData);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
_deserializer.StartOperation();
|
||||
AddChildOperation(_deserializer);
|
||||
}
|
||||
|
||||
_deserializer.UpdateOperation();
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -61,25 +61,21 @@ namespace YooAsset
|
||||
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
|
||||
{
|
||||
var operation = new DWRFSInitializeOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DWRFSLoadPackageManifestOperation(this, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DWRFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
|
||||
{
|
||||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
@@ -91,14 +87,12 @@ namespace YooAsset
|
||||
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
|
||||
{
|
||||
var operation = new DWRFSLoadAssetBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"{nameof(DefaultWebRemoteFileSystem)} not support load bundle type : {bundle.BundleType}";
|
||||
var operation = new FSLoadBundleCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +120,7 @@ namespace YooAsset
|
||||
{
|
||||
PackageName = packageName;
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Succeed;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.DownloadAssetBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -41,15 +41,18 @@ namespace YooAsset
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
}
|
||||
|
||||
_downloadAssetBundleOp.UpdateOperation();
|
||||
DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
|
||||
DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes;
|
||||
Progress = _downloadAssetBundleOp.Progress;
|
||||
@@ -90,13 +93,5 @@ namespace YooAsset
|
||||
UnityEngine.Debug.LogError(Error);
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.DownloadAssetBundle)
|
||||
{
|
||||
if (_downloadAssetBundleOp != null)
|
||||
_downloadAssetBundleOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestWebPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -39,9 +39,11 @@ namespace YooAsset
|
||||
if (_requestWebPackageHashOp == null)
|
||||
{
|
||||
_requestWebPackageHashOp = new RequestWebRemotePackageHashOperation(_fileSystem, _packageVersion, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageHashOp);
|
||||
_requestWebPackageHashOp.StartOperation();
|
||||
AddChildOperation(_requestWebPackageHashOp);
|
||||
}
|
||||
|
||||
_requestWebPackageHashOp.UpdateOperation();
|
||||
if (_requestWebPackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -63,9 +65,11 @@ namespace YooAsset
|
||||
{
|
||||
string packageHash = _requestWebPackageHashOp.PackageHash;
|
||||
_loadWebPackageManifestOp = new LoadWebRemotePackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadWebPackageManifestOp);
|
||||
_loadWebPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadWebPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadWebPackageManifestOp.UpdateOperation();
|
||||
Progress = _loadWebPackageManifestOp.Progress;
|
||||
if (_loadWebPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -37,9 +37,11 @@ namespace YooAsset
|
||||
if (_requestWebPackageVersionOp == null)
|
||||
{
|
||||
_requestWebPackageVersionOp = new RequestWebRemotePackageVersionOperation(_fileSystem, _appendTimeTicks, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
|
||||
_requestWebPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestWebPackageVersionOp);
|
||||
}
|
||||
|
||||
_requestWebPackageVersionOp.UpdateOperation();
|
||||
Progress = _requestWebPackageVersionOp.Progress;
|
||||
if (_requestWebPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -32,12 +32,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(LoadWebRemotePackageManifestOperation));
|
||||
_steps = ESteps.RequestFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -49,9 +49,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string url = GetWebRequestURL(fileName);
|
||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
|
||||
_webDataRequestOp.StartOperation();
|
||||
AddChildOperation(_webDataRequestOp);
|
||||
}
|
||||
|
||||
_webDataRequestOp.UpdateOperation();
|
||||
if (_webDataRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -88,9 +90,11 @@ namespace YooAsset
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
_deserializer.StartOperation();
|
||||
AddChildOperation(_deserializer);
|
||||
}
|
||||
|
||||
_deserializer.UpdateOperation();
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageHashOperation));
|
||||
_steps = ESteps.RequestPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -46,9 +46,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(_fileSystem.PackageName, _packageVersion);
|
||||
string url = GetWebRequestURL(fileName);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace YooAsset
|
||||
_appendTimeTicks = appendTimeTicks;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_requestCount = WebRequestCounter.GetRequestFailedCount(_fileSystem.PackageName, nameof(RequestWebRemotePackageVersionOperation));
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -46,9 +46,11 @@ namespace YooAsset
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(_fileSystem.PackageName);
|
||||
string url = GetWebRequestURL(fileName);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -70,25 +70,21 @@ namespace YooAsset
|
||||
public virtual FSInitializeFileSystemOperation InitializeFileSystemAsync()
|
||||
{
|
||||
var operation = new DWSFSInitializeOperation(this);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSLoadPackageManifestOperation LoadPackageManifestAsync(string packageVersion, int timeout)
|
||||
{
|
||||
var operation = new DWSFSLoadPackageManifestOperation(this, packageVersion, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSRequestPackageVersionOperation RequestPackageVersionAsync(bool appendTimeTicks, int timeout)
|
||||
{
|
||||
var operation = new DWSFSRequestPackageVersionOperation(this, timeout);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
|
||||
{
|
||||
var operation = new FSClearCacheFilesCompleteOperation();
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
|
||||
@@ -100,14 +96,12 @@ namespace YooAsset
|
||||
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
|
||||
{
|
||||
var operation = new DWSFSLoadAssetBundleOperation(this, bundle);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
else
|
||||
{
|
||||
string error = $"{nameof(DefaultWebServerFileSystem)} not support load bundle type : {bundle.BundleType}";
|
||||
var operation = new FSLoadBundleCompleteOperation(error);
|
||||
OperationSystem.StartOperation(PackageName, operation);
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +130,7 @@ namespace YooAsset
|
||||
else
|
||||
_webPackageRoot = packageRoot;
|
||||
}
|
||||
public virtual void OnUpdate()
|
||||
public virtual void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
using static UnityEngine.Networking.UnityWebRequest;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DWSFSInitializeOperation : FSInitializeFileSystemOperation
|
||||
@@ -21,11 +19,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadCatalogFile;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -49,9 +47,11 @@ namespace YooAsset
|
||||
#endif
|
||||
|
||||
_loadCatalogFileOp = new LoadWebServerCatalogFileOperation(_fileSystem);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadCatalogFileOp);
|
||||
_loadCatalogFileOp.StartOperation();
|
||||
AddChildOperation(_loadCatalogFileOp);
|
||||
}
|
||||
|
||||
_loadCatalogFileOp.UpdateOperation();
|
||||
if (_loadCatalogFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_bundle = bundle;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.DownloadAssetBundle;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -42,15 +42,18 @@ namespace YooAsset
|
||||
if (_bundle.Encrypted)
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _downloadAssetBundleOp);
|
||||
_downloadAssetBundleOp.StartOperation();
|
||||
AddChildOperation(_downloadAssetBundleOp);
|
||||
}
|
||||
}
|
||||
|
||||
_downloadAssetBundleOp.UpdateOperation();
|
||||
DownloadProgress = _downloadAssetBundleOp.DownloadProgress;
|
||||
DownloadedBytes = _downloadAssetBundleOp.DownloadedBytes;
|
||||
Progress = _downloadAssetBundleOp.Progress;
|
||||
@@ -91,13 +94,5 @@ namespace YooAsset
|
||||
UnityEngine.Debug.LogError(Error);
|
||||
}
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
{
|
||||
if (_steps == ESteps.DownloadAssetBundle)
|
||||
{
|
||||
if (_downloadAssetBundleOp != null)
|
||||
_downloadAssetBundleOp.SetAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestWebPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -39,9 +39,11 @@ namespace YooAsset
|
||||
if (_requestWebPackageHashOp == null)
|
||||
{
|
||||
_requestWebPackageHashOp = new RequestWebServerPackageHashOperation(_fileSystem, _packageVersion, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageHashOp);
|
||||
_requestWebPackageHashOp.StartOperation();
|
||||
AddChildOperation(_requestWebPackageHashOp);
|
||||
}
|
||||
|
||||
_requestWebPackageHashOp.UpdateOperation();
|
||||
if (_requestWebPackageHashOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -63,9 +65,11 @@ namespace YooAsset
|
||||
{
|
||||
string packageHash = _requestWebPackageHashOp.PackageHash;
|
||||
_loadWebPackageManifestOp = new LoadWebServerPackageManifestOperation(_fileSystem, _packageVersion, packageHash);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _loadWebPackageManifestOp);
|
||||
_loadWebPackageManifestOp.StartOperation();
|
||||
AddChildOperation(_loadWebPackageManifestOp);
|
||||
}
|
||||
|
||||
_loadWebPackageManifestOp.UpdateOperation();
|
||||
Progress = _loadWebPackageManifestOp.Progress;
|
||||
if (_loadWebPackageManifestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -35,9 +35,11 @@ namespace YooAsset
|
||||
if (_requestWebPackageVersionOp == null)
|
||||
{
|
||||
_requestWebPackageVersionOp = new RequestWebServerPackageVersionOperation(_fileSystem, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _requestWebPackageVersionOp);
|
||||
_requestWebPackageVersionOp.StartOperation();
|
||||
AddChildOperation(_requestWebPackageVersionOp);
|
||||
}
|
||||
|
||||
_requestWebPackageVersionOp.UpdateOperation();
|
||||
Progress = _requestWebPackageVersionOp.Progress;
|
||||
if (_requestWebPackageVersionOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace YooAsset
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadCatalog;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_packageHash = packageHash;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestFileData;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -47,9 +47,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetWebPackageManifestFilePath(_packageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webDataRequestOp = new UnityWebDataRequestOperation(url);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webDataRequestOp);
|
||||
_webDataRequestOp.StartOperation();
|
||||
AddChildOperation(_webDataRequestOp);
|
||||
}
|
||||
|
||||
_webDataRequestOp.UpdateOperation();
|
||||
if (_webDataRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -85,9 +87,11 @@ namespace YooAsset
|
||||
if (_deserializer == null)
|
||||
{
|
||||
_deserializer = new DeserializeManifestOperation(_webDataRequestOp.Result);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _deserializer);
|
||||
_deserializer.StartOperation();
|
||||
AddChildOperation(_deserializer);
|
||||
}
|
||||
|
||||
_deserializer.UpdateOperation();
|
||||
Progress = _deserializer.Progress;
|
||||
if (_deserializer.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace YooAsset
|
||||
_packageVersion = packageVersion;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageHash;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -44,9 +44,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetWebPackageHashFilePath(_packageVersion);
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
Progress = _webTextRequestOp.Progress;
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace YooAsset
|
||||
_fileSystem = fileSystem;
|
||||
_timeout = timeout;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.RequestPackageVersion;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -42,9 +42,11 @@ namespace YooAsset
|
||||
string filePath = _fileSystem.GetWebPackageVersionFilePath();
|
||||
string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
|
||||
_webTextRequestOp = new UnityWebTextRequestOperation(url, _timeout);
|
||||
OperationSystem.StartOperation(_fileSystem.PackageName, _webTextRequestOp);
|
||||
_webTextRequestOp.StartOperation();
|
||||
AddChildOperation(_webTextRequestOp);
|
||||
}
|
||||
|
||||
_webTextRequestOp.UpdateOperation();
|
||||
if (_webTextRequestOp.IsDone == false)
|
||||
return;
|
||||
|
||||
|
||||
@@ -56,14 +56,14 @@ namespace YooAsset
|
||||
void SetParameter(string name, object value);
|
||||
|
||||
/// <summary>
|
||||
/// 创建缓存系统
|
||||
/// 创建文件系统
|
||||
/// </summary>
|
||||
void OnCreate(string packageName, string packageRoot);
|
||||
|
||||
/// <summary>
|
||||
/// 更新文件系统
|
||||
/// 销毁文件系统
|
||||
/// </summary>
|
||||
void OnUpdate();
|
||||
void OnDestroy();
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace YooAsset
|
||||
{
|
||||
_error = error;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_error))
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace YooAsset
|
||||
Error = _error;
|
||||
}
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,19 @@ namespace YooAsset
|
||||
DownloadedBytes = 0;
|
||||
DownloadProgress = 0;
|
||||
}
|
||||
public void Release()
|
||||
|
||||
/// <summary>
|
||||
/// 减少引用计数
|
||||
/// </summary>
|
||||
public virtual void Release()
|
||||
{
|
||||
RefCount--;
|
||||
}
|
||||
public void Reference()
|
||||
|
||||
/// <summary>
|
||||
/// 增加引用计数
|
||||
/// </summary>
|
||||
public virtual void Reference()
|
||||
{
|
||||
RefCount++;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal abstract class FSLoadBundleOperation : AsyncOperationBase
|
||||
@@ -18,11 +17,6 @@ namespace YooAsset
|
||||
/// 下载大小
|
||||
/// </summary>
|
||||
public long DownloadedBytes { protected set; get; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 终止下载任务
|
||||
/// </summary>
|
||||
public abstract void AbortDownloadOperation();
|
||||
}
|
||||
|
||||
internal sealed class FSLoadBundleCompleteOperation : FSLoadBundleOperation
|
||||
@@ -33,15 +27,12 @@ namespace YooAsset
|
||||
{
|
||||
_error = error;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = _error;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
}
|
||||
public override void AbortDownloadOperation()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DownloadFileWrapper : FSDownloadFileOperation
|
||||
{
|
||||
private enum ESteps
|
||||
{
|
||||
None,
|
||||
Download,
|
||||
Done,
|
||||
}
|
||||
|
||||
private readonly FSDownloadFileOperation _downloadFileOp;
|
||||
private ESteps _steps = ESteps.None;
|
||||
|
||||
internal DownloadFileWrapper(FSDownloadFileOperation downloadFileOp) : base(downloadFileOp.Bundle)
|
||||
{
|
||||
_downloadFileOp = downloadFileOp;
|
||||
}
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.Download;
|
||||
}
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.Download)
|
||||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
_downloadFileOp.WaitForAsyncComplete();
|
||||
|
||||
if (_downloadFileOp.Status == EOperationStatus.None)
|
||||
return;
|
||||
|
||||
_downloadFileOp.UpdateOperation();
|
||||
Progress = _downloadFileOp.Progress;
|
||||
DownloadedBytes = _downloadFileOp.DownloadedBytes;
|
||||
DownloadProgress = _downloadFileOp.DownloadProgress;
|
||||
if (_downloadFileOp.IsDone == false)
|
||||
return;
|
||||
|
||||
_steps = ESteps.Done;
|
||||
Status = _downloadFileOp.Status;
|
||||
Error = _downloadFileOp.Error;
|
||||
HttpCode = _downloadFileOp.HttpCode;
|
||||
}
|
||||
}
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (ExecuteWhileDone())
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Release()
|
||||
{
|
||||
_downloadFileOp.Release();
|
||||
}
|
||||
public override void Reference()
|
||||
{
|
||||
_downloadFileOp.Reference();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84c10fd3507a1c24a9043aebb72db5f5
|
||||
guid: 8088863fc7dfbd441bc897380cd7b97f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -15,11 +15,11 @@ namespace YooAsset
|
||||
_checkTimeout = checkTimeout;
|
||||
_decryptionServices = decryptionServices;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -117,7 +117,7 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeWebRequest();
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace YooAsset
|
||||
{
|
||||
_disableUnityWebCache = disableUnityWebCache;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CreateRequest;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
_steps = ESteps.Done;
|
||||
DisposeWebRequest();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
@@ -25,6 +26,11 @@ namespace YooAsset
|
||||
/// WebGL运行模式
|
||||
/// </summary>
|
||||
WebPlayMode,
|
||||
|
||||
/// <summary>
|
||||
/// 自定义运行模式
|
||||
/// </summary>
|
||||
CustomPlayMode,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,4 +73,16 @@ namespace YooAsset
|
||||
public FileSystemParameters WebServerFileSystemParameters;
|
||||
public FileSystemParameters WebRemoteFileSystemParameters;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义运行模式的初始化参数
|
||||
/// </summary>
|
||||
public class CustomPlayModeParameters : InitializeParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件系统初始化参数列表
|
||||
/// 注意:列表最后一个元素作为主文件系统!
|
||||
/// </summary>
|
||||
public List<FileSystemParameters> FileSystemParameterList;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace YooAsset
|
||||
{
|
||||
public abstract class AsyncOperationBase : IEnumerator, IComparable<AsyncOperationBase>
|
||||
{
|
||||
private readonly List<AsyncOperationBase> _childs = new List<AsyncOperationBase>(10);
|
||||
private Action<AsyncOperationBase> _callback;
|
||||
private string _packageName = null;
|
||||
private int _whileFrame = 1000;
|
||||
@@ -15,12 +16,12 @@ namespace YooAsset
|
||||
/// <summary>
|
||||
/// 等待异步执行完成
|
||||
/// </summary>
|
||||
internal bool IsWaitForAsyncComplete = false;
|
||||
internal bool IsWaitForAsyncComplete { private set; get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经完成
|
||||
/// </summary>
|
||||
internal bool IsFinish = false;
|
||||
internal bool IsFinish { private set; get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 优先级
|
||||
@@ -99,9 +100,9 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract void InternalOnStart();
|
||||
internal abstract void InternalOnUpdate();
|
||||
internal virtual void InternalOnAbort()
|
||||
internal abstract void InternalStart();
|
||||
internal abstract void InternalUpdate();
|
||||
internal virtual void InternalAbort()
|
||||
{
|
||||
}
|
||||
internal virtual void InternalWaitForAsyncComplete()
|
||||
@@ -109,36 +110,78 @@ namespace YooAsset
|
||||
throw new System.NotImplementedException(this.GetType().Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置包裹名称
|
||||
/// </summary>
|
||||
internal void SetPackageName(string packageName)
|
||||
{
|
||||
_packageName = packageName;
|
||||
}
|
||||
internal void SetStart()
|
||||
|
||||
/// <summary>
|
||||
/// 添加子任务
|
||||
/// </summary>
|
||||
internal void AddChildOperation(AsyncOperationBase child)
|
||||
{
|
||||
Status = EOperationStatus.Processing;
|
||||
InternalOnStart();
|
||||
#if UNITY_EDITOR
|
||||
if (_childs.Contains(child))
|
||||
throw new Exception($"The child node {child.GetType().Name} already exists !");
|
||||
#endif
|
||||
|
||||
_childs.Add(child);
|
||||
}
|
||||
internal void SetFinish()
|
||||
|
||||
/// <summary>
|
||||
/// 开始异步操作
|
||||
/// </summary>
|
||||
internal void StartOperation()
|
||||
{
|
||||
IsFinish = true;
|
||||
|
||||
// 进度百分百完成
|
||||
Progress = 1f;
|
||||
|
||||
//注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||
_callback?.Invoke(this);
|
||||
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
if (Status == EOperationStatus.None)
|
||||
{
|
||||
Status = EOperationStatus.Processing;
|
||||
InternalStart();
|
||||
}
|
||||
}
|
||||
internal void SetAbort()
|
||||
|
||||
/// <summary>
|
||||
/// 更新异步操作
|
||||
/// </summary>
|
||||
internal void UpdateOperation()
|
||||
{
|
||||
if (IsDone == false)
|
||||
InternalUpdate();
|
||||
|
||||
if (IsDone && IsFinish == false)
|
||||
{
|
||||
IsFinish = true;
|
||||
|
||||
// 进度百分百完成
|
||||
Progress = 1f;
|
||||
|
||||
//注意:如果完成回调内发生异常,会导致Task无限期等待
|
||||
_callback?.Invoke(this);
|
||||
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 终止异步任务
|
||||
/// </summary>
|
||||
internal void AbortOperation()
|
||||
{
|
||||
foreach (var child in _childs)
|
||||
{
|
||||
child.AbortOperation();
|
||||
}
|
||||
|
||||
if (IsDone == false)
|
||||
{
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = "user abort";
|
||||
YooLogger.Warning($"Async operaiton {this.GetType().Name} has been abort !");
|
||||
InternalOnAbort();
|
||||
InternalAbort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +193,7 @@ namespace YooAsset
|
||||
if (IsDone == false)
|
||||
{
|
||||
// 执行更新逻辑
|
||||
InternalOnUpdate();
|
||||
InternalUpdate();
|
||||
|
||||
// 当执行次数用完时
|
||||
_whileFrame--;
|
||||
@@ -180,10 +223,20 @@ namespace YooAsset
|
||||
if (IsDone)
|
||||
return;
|
||||
|
||||
//TODO 防止异步操作被挂起陷入无限死循环!
|
||||
// 例如:文件解压任务或者文件导入任务!
|
||||
if (Status == EOperationStatus.None)
|
||||
{
|
||||
StartOperation();
|
||||
}
|
||||
|
||||
IsWaitForAsyncComplete = true;
|
||||
InternalWaitForAsyncComplete();
|
||||
}
|
||||
|
||||
#region 调试信息
|
||||
#endregion
|
||||
|
||||
#region 排序接口实现
|
||||
public int CompareTo(AsyncOperationBase other)
|
||||
{
|
||||
|
||||
@@ -3,15 +3,15 @@ namespace YooAsset
|
||||
{
|
||||
public abstract class GameAsyncOperation : AsyncOperationBase
|
||||
{
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
OnStart();
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
OnUpdate();
|
||||
}
|
||||
internal override void InternalOnAbort()
|
||||
internal override void InternalAbort()
|
||||
{
|
||||
OnAbort();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
protected void Abort()
|
||||
{
|
||||
SetAbort();
|
||||
AbortOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,6 @@ namespace YooAsset
|
||||
private static Stopwatch _watch;
|
||||
private static long _frameTime;
|
||||
|
||||
/// <summary>
|
||||
/// 快速启动模式
|
||||
/// </summary>
|
||||
public static bool QuickStartMode = true;
|
||||
|
||||
/// <summary>
|
||||
/// 异步操作的最小时间片段
|
||||
/// </summary>
|
||||
@@ -48,8 +43,6 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public static void Update()
|
||||
{
|
||||
_frameTime = _watch.ElapsedMilliseconds;
|
||||
|
||||
// 添加新增的异步操作
|
||||
if (_newList.Count > 0)
|
||||
{
|
||||
@@ -72,6 +65,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
// 更新进行中的异步操作
|
||||
_frameTime = _watch.ElapsedMilliseconds;
|
||||
for (int i = 0; i < _operations.Count; i++)
|
||||
{
|
||||
if (IsBusy)
|
||||
@@ -81,11 +75,7 @@ namespace YooAsset
|
||||
if (operation.IsFinish)
|
||||
continue;
|
||||
|
||||
if (operation.IsDone == false)
|
||||
operation.InternalOnUpdate();
|
||||
|
||||
if (operation.IsDone)
|
||||
operation.SetFinish();
|
||||
operation.UpdateOperation();
|
||||
}
|
||||
|
||||
// 移除已经完成的异步操作
|
||||
@@ -119,7 +109,7 @@ namespace YooAsset
|
||||
{
|
||||
if (operation.PackageName == packageName)
|
||||
{
|
||||
operation.SetAbort();
|
||||
operation.AbortOperation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +118,7 @@ namespace YooAsset
|
||||
{
|
||||
if (operation.PackageName == packageName)
|
||||
{
|
||||
operation.SetAbort();
|
||||
operation.AbortOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,12 +130,7 @@ namespace YooAsset
|
||||
{
|
||||
_newList.Add(operation);
|
||||
operation.SetPackageName(packageName);
|
||||
operation.SetStart();
|
||||
|
||||
if (QuickStartMode)
|
||||
{
|
||||
operation.InternalOnUpdate();
|
||||
}
|
||||
operation.StartOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,11 +43,11 @@ namespace YooAsset
|
||||
_worldPositionStays = worldPositionStays;
|
||||
_actived = actived;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadObject;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -162,7 +162,7 @@ namespace YooAsset
|
||||
_instantiateAsync.Cancel();
|
||||
#endif
|
||||
|
||||
SetAbort();
|
||||
AbortOperation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace YooAsset
|
||||
_resourceManager = resourceManager;
|
||||
LoadBundleInfo = bundleInfo;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.LoadFile;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -67,11 +67,16 @@ namespace YooAsset
|
||||
if (_steps == ESteps.LoadFile)
|
||||
{
|
||||
if (_loadBundleOp == null)
|
||||
{
|
||||
_loadBundleOp = LoadBundleInfo.LoadBundleFile();
|
||||
_loadBundleOp.StartOperation();
|
||||
AddChildOperation(_loadBundleOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_loadBundleOp.WaitForAsyncComplete();
|
||||
|
||||
_loadBundleOp.UpdateOperation();
|
||||
DownloadProgress = _loadBundleOp.DownloadProgress;
|
||||
DownloadedBytes = _loadBundleOp.DownloadedBytes;
|
||||
if (_loadBundleOp.IsDone == false)
|
||||
@@ -209,14 +214,5 @@ namespace YooAsset
|
||||
_removeList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 终止下载任务
|
||||
/// </summary>
|
||||
public void AbortDownloadOperation()
|
||||
{
|
||||
if (_loadBundleOp != null)
|
||||
_loadBundleOp.AbortDownloadOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,11 @@ namespace YooAsset
|
||||
_resManager = resourceManager;
|
||||
_options = options;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckOptions;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
@@ -86,7 +86,7 @@ namespace YooAsset
|
||||
// 注意:终止所有下载任务
|
||||
foreach (var loader in _resManager.LoaderDic.Values)
|
||||
{
|
||||
loader.AbortDownloadOperation();
|
||||
loader.AbortOperation();
|
||||
}
|
||||
_steps = ESteps.CheckLoading;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace YooAsset
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.CheckError;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace YooAsset
|
||||
_resManager = resourceManager;
|
||||
_loopCount = loopCount;
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
_steps = ESteps.UnloadUnused;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,14 @@ namespace YooAsset
|
||||
if (_loadAllAssetsOp == null)
|
||||
{
|
||||
_loadAllAssetsOp = BundleResultObject.LoadAllAssetsAsync(MainAssetInfo);
|
||||
_loadAllAssetsOp.StartOperation();
|
||||
AddChildOperation(_loadAllAssetsOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_loadAllAssetsOp.WaitForAsyncComplete();
|
||||
|
||||
_loadAllAssetsOp.UpdateOperation();
|
||||
Progress = _loadAllAssetsOp.Progress;
|
||||
if (_loadAllAssetsOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,14 @@ namespace YooAsset
|
||||
if (_loadAssetOp == null)
|
||||
{
|
||||
_loadAssetOp = BundleResultObject.LoadAssetAsync(MainAssetInfo);
|
||||
_loadAssetOp.StartOperation();
|
||||
AddChildOperation(_loadAssetOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_loadAssetOp.WaitForAsyncComplete();
|
||||
|
||||
_loadAssetOp.UpdateOperation();
|
||||
Progress = _loadAssetOp.Progress;
|
||||
if (_loadAssetOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace YooAsset
|
||||
protected enum ESteps
|
||||
{
|
||||
None = 0,
|
||||
LoadBundleFile,
|
||||
StartBundleLoader,
|
||||
WaitBundleLoader,
|
||||
ProcessBundleResult,
|
||||
Done,
|
||||
}
|
||||
@@ -96,17 +97,27 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void InternalOnStart()
|
||||
internal override void InternalStart()
|
||||
{
|
||||
DebugBeginRecording();
|
||||
_steps = ESteps.LoadBundleFile;
|
||||
_steps = ESteps.StartBundleLoader;
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
internal override void InternalUpdate()
|
||||
{
|
||||
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||
return;
|
||||
|
||||
if (_steps == ESteps.LoadBundleFile)
|
||||
if (_steps == ESteps.StartBundleLoader)
|
||||
{
|
||||
foreach (var bundleLoader in _bundleLoaders)
|
||||
{
|
||||
bundleLoader.StartOperation();
|
||||
AddChildOperation(bundleLoader);
|
||||
}
|
||||
_steps = ESteps.WaitBundleLoader;
|
||||
}
|
||||
|
||||
if (_steps == ESteps.WaitBundleLoader)
|
||||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
@@ -116,6 +127,13 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
// 更新资源包加载器
|
||||
foreach (var bundleLoader in _bundleLoaders)
|
||||
{
|
||||
bundleLoader.UpdateOperation();
|
||||
}
|
||||
|
||||
// 检测加载是否完成
|
||||
foreach (var bundleLoader in _bundleLoaders)
|
||||
{
|
||||
if (bundleLoader.IsDone == false)
|
||||
@@ -128,6 +146,7 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
// 检测加载结果
|
||||
BundleResultObject = _mainBundleLoader.Result;
|
||||
if (BundleResultObject == null)
|
||||
{
|
||||
@@ -320,7 +339,7 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
protected void DebugBeginRecording()
|
||||
private void DebugBeginRecording()
|
||||
{
|
||||
if (_watch == null)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace YooAsset
|
||||
if (_loadSceneOp == null)
|
||||
{
|
||||
_loadSceneOp = BundleResultObject.LoadSceneOperation(MainAssetInfo, _loadParams, _suspendLoad);
|
||||
_loadSceneOp.StartOperation();
|
||||
AddChildOperation(_loadSceneOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
@@ -32,6 +34,7 @@ namespace YooAsset
|
||||
if (_suspendLoad == false)
|
||||
_loadSceneOp.UnSuspendLoad();
|
||||
|
||||
_loadSceneOp.UpdateOperation();
|
||||
Progress = _loadSceneOp.Progress;
|
||||
if (_loadSceneOp.IsDone == false)
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,14 @@ namespace YooAsset
|
||||
if (_loadSubAssetsOp == null)
|
||||
{
|
||||
_loadSubAssetsOp = BundleResultObject.LoadSubAssetsAsync(MainAssetInfo);
|
||||
_loadSubAssetsOp.StartOperation();
|
||||
AddChildOperation(_loadSubAssetsOp);
|
||||
}
|
||||
|
||||
if (IsWaitForAsyncComplete)
|
||||
_loadSubAssetsOp.WaitForAsyncComplete();
|
||||
|
||||
_loadSubAssetsOp.UpdateOperation();
|
||||
Progress = _loadSubAssetsOp.Progress;
|
||||
if (_loadSubAssetsOp.IsDone == false)
|
||||
return;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user