Beispiel #1
0
 public static IObservable <R> Publish <T, R>(
     this IObservable <T> source, Func <IObservable <T>, IObservable <R> > selector)
 {
     return(Observable.CreateSafe((IObserver <R> observer) =>
     {
         var s = source.Publish();
         var p = selector(s).Subscribe(observer);
         return new CompositeDisposable(p, s.Connect());
     }));
 }
 public static IObservable <float> CreateObservable(
     EasingFunction easing,
     float duration,
     bool ignoreTimeScale)
 {
     return((IObservable <float>)Observable.CreateSafe <float>((Func <IObserver <M0>, IDisposable>)(observer =>
     {
         observer.OnNext(0.0f);
         BooleanDisposable cancellation = new BooleanDisposable();
         TweenEngine.AddTween((ITween) new ObservableEasing.ObservableTween(observer, cancellation, easing, duration, ignoreTimeScale));
         return (IDisposable)cancellation;
     }), false));
 }
Beispiel #3
0
            public static IObservable <float> CreateObservable(EasingFunction easing, float duration, bool ignoreTimeScale)
            {
                return(Observable.CreateSafe <float>(observer =>
                {
                    observer.OnNext(default(float)); // push initial value on subscribe.

                    var cancellation = new BooleanDisposable();
                    var tween = new ObservableTween(observer, cancellation, easing, duration, ignoreTimeScale);
                    TweenEngine.AddTween(tween);

                    return cancellation;
                }, false));
            }