[DoTween]:fix CancellationToken can't stop UniTask

pull/189/head
cuibeibei 2020-10-28 18:48:10 +08:00
parent da0e654e7d
commit 5837b26208
1 changed files with 11 additions and 0 deletions

View File

@ -223,6 +223,17 @@ namespace Cysharp.Threading.Tasks
void OnCompleteCallbackDelegate() void OnCompleteCallbackDelegate()
{ {
if (cancellationToken.IsCancellationRequested)
{
if (this.cancelBehaviour == TweenCancelBehaviour.KillAndCancelAwait
|| this.cancelBehaviour == TweenCancelBehaviour.KillWithCompleteCallbackAndCancelAwait
|| this.cancelBehaviour == TweenCancelBehaviour.CompleteAndCancelAwait
|| this.cancelBehaviour == TweenCancelBehaviour.CompleteWithSeqeunceCallbackAndCancelAwait
|| this.cancelBehaviour == TweenCancelBehaviour.CancelAwait)
{
canceled = true;
}
}
if (canceled) if (canceled)
{ {
core.TrySetCanceled(cancellationToken); core.TrySetCanceled(cancellationToken);