From ab76098895b99ceab44898c38959c58fa993cfaa Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 25 Jun 2020 22:35:35 +0900 Subject: [PATCH] Removed CancelAfterSlim(bool ignoreTimeScale), changed to CancelAfterSlim(DelayType delayType) --- .../UniTask/Runtime/CancellationTokenExtensions.cs | 1 + .../UniTask/Runtime/CancellationTokenSourceExtensions.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs index 9867dd5..d7cd06b 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs @@ -36,6 +36,7 @@ namespace Cysharp.Threading.Tasks UniTaskScheduler.PublishUnobservedTaskException(ex); } cts.Cancel(); + cts.Dispose(); } public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cancellationToken) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs index 167255a..5913908 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs @@ -9,15 +9,15 @@ namespace Cysharp.Threading.Tasks { public static class CancellationTokenSourceExtensions { - public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) + public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) { - var delay = UniTask.Delay(millisecondsDelay, ignoreTimeScale, delayTiming, cts.Token); + var delay = UniTask.Delay(millisecondsDelay, delayType, delayTiming, cts.Token); CancelAfterCore(cts, delay).Forget(); } - public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) + public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) { - var delay = UniTask.Delay(delayTimeSpan, ignoreTimeScale, delayTiming, cts.Token); + var delay = UniTask.Delay(delayTimeSpan, delayType, delayTiming, cts.Token); CancelAfterCore(cts, delay).Forget(); }