diff --git a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs index 51a1b45..75fe28b 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs @@ -78,6 +78,7 @@ namespace YooAsset internal abstract void Start(); internal abstract void Update(); + internal virtual void Abort() { } internal void SetPackageName(string packageName) { @@ -90,6 +91,7 @@ namespace YooAsset Status = EOperationStatus.Failed; Error = "user abort"; YooLogger.Warning($"Async operaiton has been abort : {this.GetType().Name}"); + Abort(); } } internal void SetFinish() @@ -102,6 +104,7 @@ namespace YooAsset internal void SetStart() { Status = EOperationStatus.Processing; + Start(); } /// diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs index dfb1265..f80c6ea 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs @@ -59,16 +59,15 @@ namespace YooAsset break; var operation = _operations[i]; + if (operation.IsDone == false) + operation.Update(); + if (operation.IsDone) { // 注意:如果业务端发生异常,保证异步操作提前移除。 _operations.RemoveAt(i); operation.SetFinish(); } - else - { - operation.Update(); - } } } @@ -116,7 +115,6 @@ namespace YooAsset _newList.Add(operation); operation.SetPackageName(packageName); operation.SetStart(); - operation.Start(); } } } \ No newline at end of file