示例#1
0
        private void OnClick(UISlot uislot)
        {
            int       slot  = uislot.index;
            ItemSlot  islot = (ItemSlot)uislot;
            CraftData item  = islot.GetCraftable();

            foreach (ItemSlot aslot in slots)
            {
                aslot.UnselectSlot();
            }

            CraftInfoPanel info_panel = CraftInfoPanel.Get(GetPlayerID());

            if (info_panel)
            {
                if (item == info_panel.GetData())
                {
                    info_panel.Hide();
                }
                else
                {
                    parent_ui.CancelSelection();
                    slots[slot].SelectSlot();
                    info_panel.ShowData(item);
                }
            }
        }
示例#2
0
 public void CancelSelection()
 {
     for (int i = 0; i < slots.Length; i++)
     {
         slots[i].UnselectSlot();
     }
     CraftInfoPanel.Get(GetPlayerID())?.Hide();
 }
示例#3
0
        private void OnAccept(UISlot slot)
        {
            PlayerCharacter player = PlayerCharacter.Get(GetPlayerID());

            CraftInfoPanel.Get(GetPlayerID())?.OnClickCraft();
            if (player.Crafting.IsBuildMode())
            {
                UISlotPanel.UnfocusAll();
            }
        }
示例#4
0
        public override void Hide(bool instant = false)
        {
            base.Hide(instant);

            current_category = null;
            CraftInfoPanel.Get(GetPlayerID())?.Hide();
            ShowAnim(false);

            if (instant && animator != null)
            {
                animator.Rebind();
            }
        }
示例#5
0
        protected override void RefreshPanel()
        {
            base.RefreshPanel();

            PlayerCharacter player = GetPlayer();

            if (player != null)
            {
                CraftStation station = player.Crafting.GetCraftStation();
                if (current_staton != station)
                {
                    current_staton = station;
                    RefreshCategories();
                }
            }

            //Gamepad auto controls
            PlayerControls controls    = PlayerControls.Get(GetPlayerID());
            CraftSubPanel  sub_panel   = CraftSubPanel.Get(GetPlayerID());
            UISlotPanel    focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != this && focus_panel != sub_panel && !TheUI.Get().IsBlockingPanelOpened() &&
                controls.IsGamePad() && player != null && !player.Crafting.IsBuildMode())
            {
                Focus();
                CraftInfoPanel.Get(GetPlayerID())?.Hide();
            }
            if (focus_panel == this)
            {
                selection_index = Mathf.Clamp(selection_index, 0, CountActiveSlots() - 1);

                UISlot slot = GetSelectSlot();
                if (prev_slot != slot || !sub_panel.IsVisible())
                {
                    OnClick(slot);
                    sub_panel.selection_index = 0;
                    prev_slot = slot;
                }
            }
        }
示例#6
0
        protected override void RefreshPanel()
        {
            base.RefreshPanel();

            //Gamepad auto controls
            PlayerCharacter player     = GetPlayer();
            CraftInfoPanel  info_panel = CraftInfoPanel.Get(GetPlayerID());

            if (UISlotPanel.GetFocusedPanel() == this)
            {
                selection_index = Mathf.Clamp(selection_index, 0, CountActiveSlots() - 1);

                UISlot slot = GetSelectSlot();
                if (player != null && !player.Crafting.IsBuildMode())
                {
                    if (prev_slot != slot || !info_panel.IsVisible())
                    {
                        OnClick(slot);
                        prev_slot = slot;
                    }
                }
            }
        }
示例#7
0
 private void OnCancel(UISlot slot)
 {
     CancelSelection();
     CraftInfoPanel.Get(GetPlayerID())?.Hide();
     CraftPanel.Get(GetPlayerID())?.Focus();
 }