コード例 #1
0
            public static IUniTaskSource <T> Create(AsyncReactiveProperty <T> parent, CancellationToken cancellationToken, out short token)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    return(AutoResetUniTaskCompletionSource <T> .CreateFromCanceled(cancellationToken, out token));
                }

                if (!pool.TryPop(out var result))
                {
                    result = new WaitAsyncSource();
                }

                result.parent            = parent;
                result.cancellationToken = cancellationToken;

                if (cancellationToken.CanBeCanceled)
                {
                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, result);
                }

                result.parent.triggerEvent.Add(result);

                TaskTracker.TrackActiveTask(result, 3);

                token = result.core.Version;
                return(result);
            }
コード例 #2
0
 bool TryReturn()
 {
     TaskTracker.RemoveTracking(this);
     core.Reset();
     cancellationTokenRegistration.Dispose();
     cancellationTokenRegistration = default;
     parent.triggerEvent.Remove(this);
     parent            = null;
     cancellationToken = default;
     return(pool.TryPush(this));
 }
コード例 #3
0
            public Enumerator(AsyncReactiveProperty <T> parent, CancellationToken cancellationToken, bool publishCurrentValue)
            {
                this.parent            = parent;
                this.cancellationToken = cancellationToken;
                this.firstCall         = publishCurrentValue;

                parent.triggerEvent.Add(this);
                TaskTracker.TrackActiveTask(this, 3);

                if (cancellationToken.CanBeCanceled)
                {
                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);
                }
            }
コード例 #4
0
 public static void BindTo <T>(this AsyncReactiveProperty <T> source, TMP_Text text, bool rebindOnError = true)
 {
     BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();
 }
コード例 #5
0
 public WithoutCurrentEnumerable(AsyncReactiveProperty <T> parent)
 {
     this.parent = parent;
 }