LateUpdateAsObservable() public static method

public static LateUpdateAsObservable ( ) : IObservable
return IObservable
Exemplo n.º 1
0
        public static IObservable <T> ObserveOnMainThread <T>(this IObservable <T> source, MainThreadDispatchType dispatchType)
        {
            switch (dispatchType)
            {
            case MainThreadDispatchType.Update:
                return(source.ObserveOnMainThread());    // faster path

            // others, bit slower

            case MainThreadDispatchType.FixedUpdate:
                return(source.SelectMany(_ => EveryFixedUpdate().Take(1), (x, _) => x));

            case MainThreadDispatchType.EndOfFrame:
                return(source.SelectMany(_ => EveryEndOfFrame().Take(1), (x, _) => x));

            case MainThreadDispatchType.GameObjectUpdate:
                return(source.SelectMany(_ => MainThreadDispatcher.UpdateAsObservable().Take(1), (x, _) => x));

            case MainThreadDispatchType.LateUpdate:
                return(source.SelectMany(_ => MainThreadDispatcher.LateUpdateAsObservable().Take(1), (x, _) => x));

#if SupportCustomYieldInstruction
#pragma warning disable 612 // Type or member is obsolete
            case MainThreadDispatchType.AfterUpdate:
                return(source.SelectMany(_ => EveryAfterUpdate().Take(1), (x, _) => x));

#pragma warning restore 612 // Type or member is obsolete
#endif
            default:
                throw new ArgumentException("type is invalid");
            }
        }
Exemplo n.º 2
0
        public static IObservable <T> ObserveOnMainThread <T>(this IObservable <T> source, MainThreadDispatchType dispatchType)
        {
            switch (dispatchType)
            {
            case MainThreadDispatchType.Update:
                return(source.ObserveOnMainThread());    // faster path

            // others, bit slower

            case MainThreadDispatchType.FixedUpdate:
                return(source.SelectMany(_ => EveryFixedUpdate().Take(1), (x, _) => x));

            case MainThreadDispatchType.EndOfFrame:
                return(source.SelectMany(_ => EveryEndOfFrame().Take(1), (x, _) => x));

            case MainThreadDispatchType.GameObjectUpdate:
                return(source.SelectMany(_ => MainThreadDispatcher.UpdateAsObservable().Take(1), (x, _) => x));

            case MainThreadDispatchType.LateUpdate:
                return(source.SelectMany(_ => MainThreadDispatcher.LateUpdateAsObservable().Take(1), (x, _) => x));

            default:
                throw new ArgumentException("type is invalid");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// EveryLateUpdate calls from MainThreadDispatcher's OnLateUpdate.
 /// </summary>
 public static IObservable <long> EveryLateUpdate()
 {
     return(MainThreadDispatcher.LateUpdateAsObservable().Scan(-1L, (x, y) => x + 1));
 }