예제 #1
0
 static FPSCounter()
 {
     Utils.UniRx.FPSCounter.Current = (IReadOnlyReactiveProperty <float>)ReactivePropertyExtensions.ToReadOnlyReactiveProperty <float>((IObservable <M0>)Observable.Select <IList <float>, float>((IObservable <M0>)Observable.Buffer <float>((IObservable <M0>)Observable.Select <long, float>((IObservable <M0>)Observable.EveryUpdate(), (Func <M0, M1>)(_ => Time.get_deltaTime())), 5, 1), (Func <M0, M1>)(x => 1f / x.Average())));
 }
예제 #2
0
        private void Start()
        {
            ReadOnlyReactiveProperty <bool> reactiveProperty1 = (ReadOnlyReactiveProperty <bool>)ReactivePropertyExtensions.ToReadOnlyReactiveProperty <bool>((IObservable <M0>)Observable.Select <int, bool>((IObservable <M0>) this._count, (Func <M0, M1>)(i => i > 1)));
            ReadOnlyReactiveProperty <bool> reactiveProperty2 = (ReadOnlyReactiveProperty <bool>)ReactivePropertyExtensions.ToReadOnlyReactiveProperty <bool>((IObservable <M0>)Observable.Select <int, bool>((IObservable <M0>) this._count, (Func <M0, M1>)(i => i < this.MaxCount)));
            List <IObservable <int> >       source            = new List <IObservable <int> >();

            // ISSUE: object of a compiler-generated type is created
            using (IEnumerator <\u003C\u003E__AnonType27 <Button, int> > enumerator = ((IEnumerable <Button>) this._addButtons).Select <Button, \u003C\u003E__AnonType27 <Button, int> >((Func <Button, int, \u003C\u003E__AnonType27 <Button, int> >)((bt, index) => new \u003C\u003E__AnonType27 <Button, int>(bt, index != 0 ? index * 10 : 1))).Where <\u003C\u003E__AnonType27 <Button, int> >((Func <\u003C\u003E__AnonType27 <Button, int>, bool>)(bt => bt != null)).GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    // ISSUE: variable of a compiler-generated type
                    \u003C\u003E__AnonType27 <Button, int> item = enumerator.Current;
                    UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>)reactiveProperty2, (Selectable)item.bt);
                    source.Add((IObservable <int>)Observable.Select <Unit, int>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(item.bt), (Func <M0, M1>)(_ => item.add)));
                }
            }
            // ISSUE: object of a compiler-generated type is created
            using (IEnumerator <\u003C\u003E__AnonType27 <Button, int> > enumerator = ((IEnumerable <Button>) this._subButtons).Select <Button, \u003C\u003E__AnonType27 <Button, int> >((Func <Button, int, \u003C\u003E__AnonType27 <Button, int> >)((bt, index) => new \u003C\u003E__AnonType27 <Button, int>(bt, index != 0 ? index * 10 : 1))).Where <\u003C\u003E__AnonType27 <Button, int> >((Func <\u003C\u003E__AnonType27 <Button, int>, bool>)(bt => bt != null)).GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    // ISSUE: variable of a compiler-generated type
                    \u003C\u003E__AnonType27 <Button, int> item = enumerator.Current;
                    UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>)reactiveProperty1, (Selectable)item.bt);
                    source.Add((IObservable <int>)Observable.Select <Unit, int>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(item.bt), (Func <M0, M1>)(_ => - item.add)));
                }
            }
            if (source.Any <IObservable <int> >())
            {
                ObservableExtensions.Subscribe <int>((IObservable <M0>)Observable.Select <int, int>(Observable.Merge <int>((IEnumerable <IObservable <M0> >)source), (Func <M0, M1>)(value => Mathf.Clamp(((ReactiveProperty <int>) this._count).get_Value() + value, 1, this.MaxCount))), (Action <M0>)(value =>
                {
                    ((ReactiveProperty <int>) this._count).set_Value(value);
                    Singleton <Resources> .Instance.SoundPack.Play(SoundPack.SystemSE.OK_S);
                }));
            }
            if (!Object.op_Inequality((Object)this._inputCounter, (Object)null))
            {
                return;
            }
            ObservableExtensions.Subscribe <int>((IObservable <M0>) this._count, (Action <M0>)(i => this._inputCounter.set_text(i.ToString())));
            ObservableExtensions.Subscribe <BaseEventData>(Observable.Take <BaseEventData>((IObservable <M0>)ObservableTriggerExtensions.OnSelectAsObservable((UIBehaviour)this._inputCounter), 1), (Action <M0>)(_ =>
            {
                Transform transform = ((Component)this._inputCounter).get_transform().Find(((Object)this._inputCounter).get_name() + " Input Caret");
                if (!Object.op_Inequality((Object)transform, (Object)null))
                {
                    return;
                }
                RectTransform component     = (RectTransform)((Component)transform).GetComponent <RectTransform>();
                RectTransform rectTransform = ((Graphic)this._countText).get_rectTransform();
                component.set_anchoredPosition(rectTransform.get_anchoredPosition());
                component.set_sizeDelta(rectTransform.get_sizeDelta());
            }));
            ObservableExtensions.Subscribe <int>((IObservable <M0>)Observable.Select <string, int>((IObservable <M0>)UnityUIComponentExtensions.OnEndEditAsObservable(this._inputCounter), (Func <M0, M1>)(text =>
            {
                int result;
                int.TryParse(text, out result);
                return(Mathf.Clamp(result, 1, this.MaxCount));
            })), (Action <M0>)(n =>
            {
                ((ReactiveProperty <int>) this._count).SetValueAndForceNotify(n);
                Singleton <Resources> .Instance.SoundPack.Play(SoundPack.SystemSE.OK_S);
            }));
        }
예제 #3
0
        protected void LinkToggleArray(Toggle[] _tgls, Action <int> _action)
        {
            Toggle[] toggleArray = _tgls;
            // ISSUE: reference to a compiler-generated field
            if (BaseSetting.\u003C\u003Ef__mg\u0024cache0 == null)
            {
                // ISSUE: reference to a compiler-generated field
                BaseSetting.\u003C\u003Ef__mg\u0024cache0 = new Func <Toggle, IObservable <bool> >(UnityUIComponentExtensions.OnValueChangedAsObservable);
            }
            // ISSUE: reference to a compiler-generated field
            Func <Toggle, IObservable <bool> > fMgCache0 = BaseSetting.\u003C\u003Ef__mg\u0024cache0;

            ObservableExtensions.Subscribe <int>(Observable.Skip <int>((IObservable <M0>)ReactivePropertyExtensions.ToReadOnlyReactiveProperty <int>(Observable.Where <int>((IObservable <M0>)Observable.Select <IList <bool>, int>((IObservable <M0>)Observable.CombineLatest <bool>((IEnumerable <IObservable <M0> >)((IEnumerable <Toggle>)toggleArray).Select <Toggle, IObservable <bool> >(fMgCache0)), (Func <M0, M1>)(list => list.IndexOf(true))), (Func <M0, bool>)(i => i >= 0))), 1), (Action <M0>)(i =>
            {
                Action <int> action = _action;
                if (action != null)
                {
                    action(i);
                }
                this.EnterSE();
            }));
        }