From 82b2a5cc20cce656979e95981a02b3e74ba43b02 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 22 Dec 2023 10:24:41 +0800 Subject: [PATCH] fix #210 --- .../Runtime/OperationSystem/AsyncOperationBase.cs | 2 +- .../Runtime/OperationSystem/OperationSystem.cs | 11 ++++++++++- .../ResourcePackage/Operation/DownloaderOperation.cs | 5 ++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs index 892b77f..711c774 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs @@ -88,7 +88,7 @@ namespace YooAsset internal abstract void InternalOnUpdate(); internal virtual void InternalOnAbort() { } - internal void Init(string packageName) + internal void SetPackageName(string packageName) { PackageName = packageName; } diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs index ed85e1c..2c420c6 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs @@ -134,7 +134,16 @@ namespace YooAsset public static void StartOperation(string packageName, AsyncOperationBase operation) { _newList.Add(operation); - operation.Init(packageName); + operation.SetPackageName(packageName); + operation.SetStart(); + } + + /// + /// 开始处理异步操作类 + /// + public static void StartOperation(AsyncOperationBase operation) + { + _newList.Add(operation); operation.SetStart(); } } diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs index 0645055..377a6dd 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs @@ -95,6 +95,9 @@ namespace YooAsset _failedTryAgain = failedTryAgain; _timeout = timeout; + // 设置包裹名称 (fix #210) + SetPackageName(packageName); + // 统计下载信息 CalculatDownloaderInfo(); } @@ -269,7 +272,7 @@ namespace YooAsset { if (_steps == ESteps.None) { - OperationSystem.StartOperation(_packageName, this); + OperationSystem.StartOperation(this); } }