Exemplo n.º 1
0
 public static IObservable <Tuple <T0, T1, T2> > AsObservable <T0, T1, T2>(
     this UnityEngine.Events.UnityEvent <T0, T1, T2> unityEvent)
 {
     return(Observable.FromEvent <UnityAction <T0, T1, T2>, Tuple <T0, T1, T2> >(
                h => { return new UnityAction <T0, T1, T2>((t0, t1, t2) => { h(Tuple.Create(t0, t1, t2)); }); },
                h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)));
 }
        public static IObservable <T> AsObservable <T>(this UnityEngine.Events.UnityEvent <T> unityEvent)
        {
            var dummy = 0;

            return(Observable.FromEvent <UnityAction <T>, T>(h =>
            {
                dummy.GetHashCode(); // capture for AOT issue
                return new UnityAction <T>(h);
            }, h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)));
        }
        public static IObservable <Tuple <T0, T1, T2, T3> > AsObservable <T0, T1, T2, T3>(this UnityEngine.Events.UnityEvent <T0, T1, T2, T3> unityEvent)
        {
            var dummy = 0;

            return(Observable.FromEvent <UnityAction <T0, T1, T2, T3>, Tuple <T0, T1, T2, T3> >(h =>
            {
                return new UnityAction <T0, T1, T2, T3>((t0, t1, t2, t3) =>
                {
                    dummy.GetHashCode(); // capture for AOT issue
                    h(Tuple.Create(t0, t1, t2, t3));
                });
            }, h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)));
        }
Exemplo n.º 4
0
 public static IObservable <T> AsObservable <T>(this UnityEngine.Events.UnityEvent <T> unityEvent)
 {
     return(Observable.FromEvent <UnityAction <T>, T>(h => new UnityAction <T>(h), h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)));
 }
 public static IObservable <Tuple <T0, T1, T2, T3> > AsObservable <T0, T1, T2, T3>(this UnityEngine.Events.UnityEvent <T0, T1, T2, T3> unityEvent)
 {
     return(Observable.FromEvent <UnityAction <T0, T1, T2, T3>, Tuple <T0, T1, T2, T3> >(
                h => (t0, t1, t2, t3) => h(Tuple.Create(t0, t1, t2, t3)),
                h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)));
 }