mirror of https://github.com/tuyoogame/YooAsset
fix #178
parent
a25d03f073
commit
b3a135e1a2
|
@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue