Beispiel #1
0
 private void SetCursorFocus(
     Image cursor,
     ItemFilterCategoryUI categoryUI,
     Selectable selectable)
 {
     categoryUI.useCursor = false;
     CursorFrame.Set(((Graphic)cursor).get_rectTransform(), (RectTransform)((Component)selectable).GetComponent <RectTransform>(), (RectTransform)null);
     foreach (ItemBoxUI.ItemBoxDataPack itemBoxDataPack in ((IEnumerable <ItemBoxUI.ItemBoxDataPack>) this.itemPacks).Where <ItemBoxUI.ItemBoxDataPack>((Func <ItemBoxUI.ItemBoxDataPack, bool>)(p => Object.op_Inequality((Object)p.cursor, (Object)cursor))))
     {
         ((Behaviour)itemBoxDataPack.cursor).set_enabled(false);
     }
     ((Behaviour)cursor).set_enabled(true);
     this.SetFocusLevel(categoryUI.FocusLevel);
 }
 private void OnUpdate()
 {
     this.CursorCanvasGroup.set_alpha(Smooth.Damp(this.CursorCanvasGroup.get_alpha(), !this.EnabledInput || this.FocusLevel != Singleton <Input> .Instance.FocusLevel || !Object.op_Inequality((Object)this.SelectedOption, (Object)null) ? 0.0f : 1f, ref this._alphaVelocity, this._alphaAccelerationTime));
     if (Object.op_Inequality((Object)this.SelectedOption, (Object)null))
     {
         CursorFrame.Set(((Graphic)this._cursorFrame).get_rectTransform(), (RectTransform)((Component)this.SelectedOption).GetComponent <RectTransform>(), ref this._velocity, new float?(), new float?(this._followAccelerationTime));
     }
     if (Object.op_Equality((Object)this.CurrentOption, (Object)null))
     {
         ((Component)this._selectedCursorFrame).get_gameObject().SetActive(false);
     }
     else
     {
         ((Component)this._selectedCursorFrame).get_gameObject().SetActive(true);
         CursorFrame.Set(((Graphic)this._selectedCursorFrame).get_rectTransform(), (RectTransform)((Component)this.CurrentOption).GetComponent <RectTransform>(), ref this._selectedvelocity, new float?(), new float?(this._followAccelerationTime));
     }
 }
        protected override void Start()
        {
            if (Object.op_Equality((Object)this._countViewer, (Object)null))
            {
                ((MonoBehaviour)this).StartCoroutine(this.LoadCountViewer());
            }
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            ObservableExtensions.Subscribe <ItemNodeUI>((IObservable <M0>) this.selectionItem, (Action <M0>)(node =>
            {
                this._hasItemNode = Object.op_Inequality((Object)node, (Object)null);
                if (this._hasItemNode)
                {
                    this.IsActiveControl = true;
                    this.Refresh(node.Item);
                }
                else
                {
                    if (!this.isOpen)
                    {
                        return;
                    }
                    this.IsActiveControl = false;
                }
            }));
            ObservableExtensions.Subscribe <long>(Observable.Where <long>(Observable.TakeUntilDestroy <long>((IObservable <M0>)Observable.EveryUpdate(), ((Component)this).get_gameObject()), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ => this.OnUpdate()));
            ObservableExtensions.Subscribe <int>((IObservable <M0>)Observable.Select <bool, int>((IObservable <M0>) this._takeout, (Func <M0, M1>)(isOn => isOn ? 1 : 0)), (Action <M0>)(index => ((Selectable)this._sendButton).get_image().set_sprite(this._sprites.GetElement <Sprite>(index))));
            ((MonoBehaviour)this).StartCoroutine(this.SlotBind());
            ObservableExtensions.Subscribe <int>(Observable.Merge <int>((IObservable <M0>[]) new IObservable <int>[2]
            {
                (IObservable <int>)Observable.Select <PointerEventData, int>((IObservable <M0>)ObservableTriggerExtensions.OnPointerEnterAsObservable((UIBehaviour)this._sendButton), (Func <M0, M1>)(_ => 0)),
                (IObservable <int>)Observable.Select <PointerEventData, int>((IObservable <M0>)ObservableTriggerExtensions.OnPointerEnterAsObservable((UIBehaviour)this._removeButton), (Func <M0, M1>)(_ => 1))
            }), (Action <M0>)(id => ((ReactiveProperty <int>) this._selectID).set_Value(id)));
            ObservableExtensions.Subscribe <RectTransform>(Observable.Where <RectTransform>((IObservable <M0>)Observable.Select <int, RectTransform>((IObservable <M0>) this._selectID, (Func <M0, M1>)(i =>
            {
                if (i == 0)
                {
                    return((RectTransform)((Component)this._sendButton).GetComponent <RectTransform>());
                }
                return(i == 1 ? (RectTransform)((Component)this._removeButton).GetComponent <RectTransform>() : (RectTransform)null);
            })), (Func <M0, bool>)(rt => Object.op_Inequality((Object)rt, (Object)null))), (Action <M0>)(rt => CursorFrame.Set(((Graphic)this.cursor).get_rectTransform(), rt, (RectTransform)null)));
            ActionIDDownCommand actionIdDownCommand1 = new ActionIDDownCommand()
            {
                ActionID = ActionID.Submit
            };

            // ISSUE: method pointer
            actionIdDownCommand1.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__11)));
            this._actionCommands.Add(actionIdDownCommand1);
            ActionIDDownCommand actionIdDownCommand2 = new ActionIDDownCommand()
            {
                ActionID = ActionID.Cancel
            };

            // ISSUE: method pointer
            actionIdDownCommand2.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__12)));
            this._actionCommands.Add(actionIdDownCommand2);
            base.Start();
        }
Beispiel #4
0
        protected override void Start()
        {
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            if (Object.op_Inequality((Object)this._closeButton, (Object)null))
            {
                ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this._closeButton), (Action <M0>)(_ =>
                {
                    this.playSE.Play(SoundPack.SystemSE.Cancel);
                    this.OnInputCancel();
                }));
            }
            ObservableExtensions.Subscribe <int>((IObservable <M0>) this._currentIndex, (Action <M0>)(x =>
            {
                bool flag1 = x >= 0;
                ((Component)this._currentCursor).get_gameObject().SetActive(flag1);
                if (flag1)
                {
                    CursorFrame.Set((RectTransform)((Component)this._currentCursor).GetComponent <RectTransform>(), (RectTransform)((Component)this._chickens[x].toggle).GetComponent <RectTransform>(), (RectTransform)null);
                    if (this.IconChanged != null)
                    {
                        this.IconChanged(x);
                    }
                }
                bool flag2 = this.GetChickenInfo(x) != null;
                ((Selectable)this._escapeButton).set_interactable(flag2);
                if (flag2)
                {
                    return;
                }
                this._nameChangeUI.Close();
            }));
            DisposableExtensions.AddTo <CompositeDisposable>((M0)((IEnumerable <Selectable>)((IEnumerable <ChickenCoopListUI.Chicken>) this._chickens).Select <ChickenCoopListUI.Chicken, Toggle>((Func <ChickenCoopListUI.Chicken, Toggle>)(p => p.toggle))).BindToEnter(true, this._selectCursor), (Component)this);
            DisposableExtensions.AddTo <IDisposable>((M0)((IEnumerable <ChickenCoopListUI.Chicken>) this._chickens).Select <ChickenCoopListUI.Chicken, Toggle>((Func <ChickenCoopListUI.Chicken, Toggle>)(p => p.toggle)).BindToGroup((Action <int>)(sel => ((ReactiveProperty <int>) this._currentIndex).set_Value(sel))), (Component)this);
            this._nameChangeUI.OnSubmit += (Action)(() =>
            {
                this.playSE.Play(SoundPack.SystemSE.OK_S);
                AIProject.SaveData.Environment.ChickenInfo chickenInfo = this.GetChickenInfo(this._nameChangeIndex);
                this._chickens[this._nameChangeIndex].name.set_text(chickenInfo?.name ?? string.Empty);
                this.NameChanged(chickenInfo);
            });
            this._nameChangeUI.OnCancel += (Action)(() => this.playSE.Play(SoundPack.SystemSE.Cancel));
            // ISSUE: object of a compiler-generated type is created
            foreach (\u003C\u003E__AnonType18 <ChickenCoopListUI.Chicken, int> anonType18 in ((IEnumerable <ChickenCoopListUI.Chicken>) this._chickens).Select <ChickenCoopListUI.Chicken, \u003C\u003E__AnonType18 <ChickenCoopListUI.Chicken, int> >((Func <ChickenCoopListUI.Chicken, int, \u003C\u003E__AnonType18 <ChickenCoopListUI.Chicken, int> >)((p, i) => new \u003C\u003E__AnonType18 <ChickenCoopListUI.Chicken, int>(p, i))))
            {
                // ISSUE: variable of a compiler-generated type
                \u003C\u003E__AnonType18 <ChickenCoopListUI.Chicken, int> item = anonType18;
                ChickenCoopListUI chickenCoopListUi = this;
                DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <int>((IObservable <M0>)Observable.Select <Unit, int>((IObservable <M0>)item.p.NameChange, (Func <M0, M1>)(_ => item.i)), (Action <M0>)(index =>
                {
                    chickenCoopListUi.playSE.Play(SoundPack.SystemSE.OK_S);
                    chickenCoopListUi._nameChangeIndex = index;
                    chickenCoopListUi._nameChangeUI.Open(chickenCoopListUi.GetChickenInfo(index));
                })), (Component)this);
            }
            ActionIDDownCommand actionIdDownCommand1 = new ActionIDDownCommand()
            {
                ActionID = ActionID.Cancel
            };

            // ISSUE: method pointer
            actionIdDownCommand1.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__B)));
            this._actionCommands.Add(actionIdDownCommand1);
            ActionIDDownCommand actionIdDownCommand2 = new ActionIDDownCommand()
            {
                ActionID = ActionID.MouseRight
            };

            // ISSUE: method pointer
            actionIdDownCommand2.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__C)));
            this._actionCommands.Add(actionIdDownCommand2);
            ActionIDDownCommand actionIdDownCommand3 = new ActionIDDownCommand()
            {
                ActionID = ActionID.SquareX
            };

            // ISSUE: method pointer
            actionIdDownCommand3.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__D)));
            this._actionCommands.Add(actionIdDownCommand3);
            ActionIDDownCommand actionIdDownCommand4 = new ActionIDDownCommand()
            {
                ActionID = ActionID.Submit
            };

            // ISSUE: method pointer
            actionIdDownCommand4.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003CStart\u003Em__E)));
            this._actionCommands.Add(actionIdDownCommand4);
            base.Start();
        }