protected override IDisposable SubscribeCore(IObserver <T> observer, IDisposable cancel)
        {
            var microCoroutineObserver = new FromMicroCoroutine(observer, cancel);

#if (ENABLE_MONO_BLEEDING_EDGE_EDITOR || ENABLE_MONO_BLEEDING_EDGE_STANDALONE)
            var moreCancel = new CancellationDisposable();
            var token      = moreCancel.Token;
#else
            var moreCancel = new BooleanDisposable();
            var token      = new CancellationToken(moreCancel);
#endif

            switch (frameCountType)
            {
            case FrameCountType.Update:
                MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            case FrameCountType.FixedUpdate:
                MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            case FrameCountType.EndOfFrame:
                MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            default:
                throw new ArgumentException("Invalid FrameCountType:" + frameCountType);
            }

            return(moreCancel);
        }
Exemple #2
0
        protected override IDisposable SubscribeCore(IObserver <T> observer, IDisposable cancel)
        {
            var microCoroutineObserver = new FromMicroCoroutine(observer, cancel);

#if (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0)
            var moreCancel = new CancellationDisposable();
            var token      = moreCancel.Token;
#else
            var moreCancel = new BooleanDisposable();
            var token      = new CancellationToken(moreCancel);
#endif

            switch (frameCountType)
            {
            case FrameCountType.Update:
                MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            case FrameCountType.FixedUpdate:
                MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            case FrameCountType.EndOfFrame:
                MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(microCoroutineObserver, token));
                break;

            default:
                throw new ArgumentException("Invalid FrameCountType:" + frameCountType);
            }

            return(moreCancel);
        }
Exemple #3
0
            protected override IDisposable SubscribeCore(IObserver <T> observer, IDisposable cancel)
            {
                observer.OnNext(this.initialValue);

                var microCoroutineObserver = new FromMicroCoroutine(observer, cancel);

//#if (NET_4_6)
                var moreCancel = new CancellationDisposable();
                var token      = moreCancel.Token;

//#else
//                var moreCancel = new BooleanDisposable();
//                var token = new CancellationToken(moreCancel);
//#endif

                switch (frameCountType)
                {
                case FrameCountType.Update:
                    MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                    break;

                case FrameCountType.FixedUpdate:
                    MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(microCoroutineObserver, token));
                    break;

                case FrameCountType.EndOfFrame:
                    MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(microCoroutineObserver, token));
                    break;

                default:
                    throw new ArgumentException("Invalid FrameCountType:" + frameCountType);
                }

                return(moreCancel);
            }
Exemple #4
0
        protected override IDisposable SubscribeCore(UniRx.IObserver <T> observer, IDisposable cancel)
        {
            FromMicroCoroutine arg = new FromMicroCoroutine(observer, cancel);
            BooleanDisposable  booleanDisposable = new BooleanDisposable();
            CancellationToken  arg2 = new CancellationToken(booleanDisposable);

            switch (frameCountType)
            {
            case FrameCountType.Update:
                MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(arg, arg2));
                break;

            case FrameCountType.FixedUpdate:
                MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(arg, arg2));
                break;

            case FrameCountType.EndOfFrame:
                MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(arg, arg2));
                break;

            default:
                throw new ArgumentException("Invalid FrameCountType:" + frameCountType);
            }
            return(booleanDisposable);
        }
        protected override IDisposable SubscribeCore(IObserver <T> observer, IDisposable cancel)
        {
            var microCoroutineObserver = new FromMicroCoroutine(observer, cancel);

            var moreCancel = new BooleanDisposable();

            switch (frameCountType)
            {
            case FrameCountType.Update:
                MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(microCoroutineObserver, new CancellationToken(moreCancel)));
                break;

            case FrameCountType.FixedUpdate:
                MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(microCoroutineObserver, new CancellationToken(moreCancel)));
                break;

            case FrameCountType.EndOfFrame:
                MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(microCoroutineObserver, new CancellationToken(moreCancel)));
                break;

            default:
                throw new ArgumentException("Invalid FrameCountType:" + frameCountType);
            }

            return(moreCancel);
        }