Exemple #1
0
 public static IDisposable Bind <T>(
     this IObservable <T> source,
     IReactiveCommand <T> target,
     int frameThrottle = 1)
 {
     return(source.
            BatchPlayerTiming(frameThrottle, PlayerLoopTiming.LastPostLateUpdate).
            Where(x => target.CanExecute.Value).
            Subscribe(x => target.Execute(x)));
 }
Exemple #2
0
 public static IDisposable Bind <T>(
     this IObservable <T> source,
     Action <T> target,
     int frameThrottle = 1)
 {
     if (source == null)
     {
         GameLog.LogWarning($"BindingExtension: NULL IObservable<T> detected with type {typeof(T).Name}");
         return(Disposable.Empty);
     }
     return(source.
            BatchPlayerTiming(frameThrottle, PlayerLoopTiming.LastPostLateUpdate).
            Subscribe(target));
 }