Exemplo n.º 1
0
        // for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
        /// <summary>
        /// Bind AsyncRaectiveCommand to button's interactable and onClick.
        /// </summary>
        public static IDisposable BindTo(this AsyncReactiveCommand <Unit> command, UnityEngine.UI.Button button)
        {
            var d1 = command.CanExecute.SubscribeToInteractable(button);
            var d2 = button.OnClickAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x));

            return(StableCompositeDisposable.Create(d1, d2));
        }
Exemplo n.º 2
0
 public Subscription(AsyncReactiveCommand <T> parent, Func <T, IObservable <Unit> > asyncAction)
 {
     this.parent      = parent;
     this.asyncAction = asyncAction;
 }