Update Operation System

增加异步操作取消方法
pull/51/head
hevinci 2022-10-11 18:09:54 +08:00
parent ef1acdc3d1
commit 608f401a80
2 changed files with 18 additions and 1 deletions

View File

@ -81,5 +81,14 @@ namespace YooAsset
Status = EOperationStatus.Succeed;
}
}
public override void Cancel()
{
if (IsDone == false)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"User cancelled !";
}
}
}
}

View File

@ -81,6 +81,14 @@ namespace YooAsset
_taskCompletionSource.TrySetResult(null);
}
/// <summary>
/// 取消异步操作
/// </summary>
public virtual void Cancel()
{
throw new NotImplementedException("Can not cancel operation !");
}
#region 异步编程相关
bool IEnumerator.MoveNext()
{