diff --git a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs index 74746461..0d102753 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/AsyncOperationBase.cs @@ -224,12 +224,12 @@ namespace YooAsset InternalAbort(); Status = EOperationStatus.Failed; Error = "user abort"; - YooLogger.Warning($"Async operaiton {this.GetType().Name} has been abort !"); + YooLogger.Warning($"Async operation {this.GetType().Name} has been aborted !"); } } /// - /// 结束异步任务 + /// 强制结束异步任务 /// internal void FinishOperation() { @@ -348,6 +348,25 @@ namespace YooAsset float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f); return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00"); } + + internal DebugOperationInfo GetDebugOperationInfo() + { + var operationInfo = new DebugOperationInfo(); + operationInfo.OperationName = this.GetType().Name; + operationInfo.OperationDesc = GetOperationDesc(); + operationInfo.Priority = Priority; + operationInfo.Progress = Progress; + operationInfo.BeginTime = BeginTime; + operationInfo.ProcessTime = ProcessTime; + operationInfo.Status = Status.ToString(); + operationInfo.Childs = new List(Childs.Count); + foreach (var child in Childs) + { + var childInfo = child.GetDebugOperationInfo(); + operationInfo.Childs.Add(childInfo); + } + return operationInfo; + } #endregion #region 排序接口实现 diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationScheduler.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationScheduler.cs index 3eabac6f..51463577 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/OperationScheduler.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/OperationScheduler.cs @@ -109,6 +109,7 @@ namespace YooAsset foreach (var operation in _newList) { operation.AbortOperation(); + operation.FinishOperation(); //注意:强制收尾,确保Task能完成 } _newList.Clear(); @@ -116,6 +117,7 @@ namespace YooAsset foreach (var operation in _operations) { operation.AbortOperation(); + operation.FinishOperation(); //注意:强制收尾,确保Task能完成 } _operations.Clear(); } @@ -131,14 +133,14 @@ namespace YooAsset // 包含正在执行的任务 foreach (var operation in _operations) { - var operationInfo = OperationSystem.GetDebugOperationInfo(operation); + var operationInfo = operation.GetDebugOperationInfo(); result.Add(operationInfo); } // 包含待处理的新任务 foreach (var operation in _newList) { - var operationInfo = OperationSystem.GetDebugOperationInfo(operation); + var operationInfo = operation.GetDebugOperationInfo(); result.Add(operationInfo); } diff --git a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs index 50cb53e6..a5964487 100644 --- a/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs +++ b/Assets/YooAsset/Runtime/OperationSystem/OperationSystem.cs @@ -229,25 +229,6 @@ namespace YooAsset return new List(); } - - internal static DebugOperationInfo GetDebugOperationInfo(AsyncOperationBase operation) - { - var operationInfo = new DebugOperationInfo(); - operationInfo.OperationName = operation.GetType().Name; - operationInfo.OperationDesc = operation.GetOperationDesc(); - operationInfo.Priority = operation.Priority; - operationInfo.Progress = operation.Progress; - operationInfo.BeginTime = operation.BeginTime; - operationInfo.ProcessTime = operation.ProcessTime; - operationInfo.Status = operation.Status.ToString(); - operationInfo.Childs = new List(operation.Childs.Count); - foreach (var child in operation.Childs) - { - var childInfo = GetDebugOperationInfo(child); - operationInfo.Childs.Add(childInfo); - } - return operationInfo; - } #endregion } }