refactor : 重构代码

This commit is contained in:
何冠峰
2026-01-17 18:44:48 +08:00
parent e10888de93
commit 0a1c81faf1
75 changed files with 219 additions and 197 deletions
@@ -158,13 +158,13 @@ namespace YooAsset
#if UNITY_EDITOR || DEBUG
if (child == null)
throw new YooInternalException("The child node is null !");
throw new YooInternalException("The child node is null.");
if (ReferenceEquals(child, this))
throw new YooInternalException("The child node cannot be itself !");
throw new YooInternalException("The child node cannot be itself.");
if (_childs.Contains(child))
throw new YooInternalException($"The child node {child.GetType().Name} already exists !");
throw new YooInternalException($"The child node {child.GetType().Name} already exists.");
// 禁止形成环依赖
if (WouldCreateCycle(child))
@@ -184,10 +184,10 @@ namespace YooAsset
#if UNITY_EDITOR || DEBUG
if (child == null)
throw new YooInternalException("The child node is null !");
throw new YooInternalException("The child node is null.");
if (_childs.Contains(child) == false)
throw new YooInternalException($"The child node {child.GetType().Name} not exists !");
throw new YooInternalException($"The child node {child.GetType().Name} not exists.");
#endif
_childs.Remove(child);
@@ -276,7 +276,7 @@ namespace YooAsset
InternalAbort();
Status = EOperationStatus.Failed;
Error = "user abort";
YooLogger.Warning($"Async operation {this.GetType().Name} has been aborted !");
YooLogger.Warning($"Async operation {this.GetType().Name} has been aborted.");
}
//注意:强制收尾,确保Task能完成
@@ -398,7 +398,7 @@ namespace YooAsset
if (IsDone == false)
{
Status = EOperationStatus.Failed;
Error = $"Operation {this.GetType().Name} failed to wait for async complete !";
Error = $"Operation {this.GetType().Name} failed to wait for async complete.";
YooLogger.Error(Error);
}
@@ -481,7 +481,7 @@ namespace YooAsset
// 防止无限循环(图过大)
if (visited.Count > MaxCycleCheckDepth)
throw new YooInternalException("Child operation graph is too large, cycle check aborted !");
throw new YooInternalException("Child operation graph is too large, cycle check aborted.");
// 检测循环:如果遍历到自己,说明形成循环
if (ReferenceEquals(node, this))
@@ -77,7 +77,7 @@ namespace YooAsset
{
if (_isInitialized)
{
YooLogger.Warning("Operation system is already initialized!");
YooLogger.Warning("Operation system is already initialized.");
return;
}
@@ -174,7 +174,7 @@ namespace YooAsset
// 不允许销毁默认调度器
if (packageName == GlobalSchedulerName)
{
throw new YooInternalException("Cannot destroy the global package scheduler!");
throw new YooInternalException("Cannot destroy the global package scheduler.");
}
if (_schedulerDic.TryGetValue(packageName, out var scheduler))
@@ -261,7 +261,7 @@ namespace YooAsset
throw new YooInternalException("Package name is null or empty.");
if (_isInitialized == false)
throw new YooInternalException($"{nameof(OperationSystem)} not initialized !");
throw new YooInternalException($"{nameof(OperationSystem)} not initialized.");
}
#endregion
}