private void OnPressAttack()
        {
            UISlotPanel selected_panel = UISlotPanel.GetFocusedPanel();

            if (selected_panel is InventoryPanel || selected_panel is EquipPanel)
            {
                ItemSlotPanel.CancelSelectionAll();
                UISlotPanel.UnfocusAll();
            }
        }
        void Update()
        {
            ItemSlotPanel chest_panel = ItemSlotPanel.Get(select.GetUID());
            bool          open        = chest_panel != null && chest_panel.IsVisible();
            Quaternion    target      = open ? Quaternion.Euler(-90f, 0f, 0f) * start_rot : start_rot;

            chest_lid.localRotation = Quaternion.Slerp(chest_lid.localRotation, target, 10f * Time.deltaTime);
            if (chest_lid_outline != null)
            {
                chest_lid_outline.localRotation = Quaternion.Slerp(chest_lid_outline.localRotation, target, 10f * Time.deltaTime);
            }
        }
        public void CancelSelection()
        {
            ItemSlotPanel.CancelSelectionAll();
            CraftPanel.Get(player_id)?.CancelSelection();
            CraftSubPanel.Get(player_id)?.CancelSelection();
            ActionSelectorUI.Get(player_id)?.Hide();
            ActionSelector.Get(player_id)?.Hide();

            if (onCancelSelection != null)
            {
                onCancelSelection.Invoke();
            }
        }
        void Update()
        {
            ItemSlotPanel panel = ItemSlotPanel.Get(inventory_target);

            if (panel != null)
            {
                Vector3 wPos = panel.GetSlotWorldPosition(slot_target);
                DoMoveToward(wPos);

                InventoryData     inventory = panel.GetInventory();
                InventoryItemData islot     = inventory?.GetItem(slot_target);
                if (islot == null || islot.GetItem() == null)
                {
                    Destroy(gameObject);
                }
            }

            timer += Time.deltaTime;
            if (timer > 2f)
            {
                Destroy(gameObject);
            }
        }
        void Update()
        {
            if (target == null)
            {
                Destroy(gameObject);
                return;
            }

            if (icon_group.activeSelf)
            {
                icon_group.SetActive(false);
            }

            if (!target.IsActive())
            {
                return;
            }

            transform.position = target.transform.position;
            transform.rotation = Quaternion.LookRotation(TheCamera.Get().transform.forward, Vector3.up);

            ItemSlot selected = ItemSlotPanel.GetSelectedSlotInAllPanels();

            if (selected != null && selected.GetItem() != null)
            {
                MAction action = selected.GetItem().FindMergeAction(target);
                foreach (PlayerCharacter player in PlayerCharacter.GetAll())
                {
                    if (player != null && action != null && action.CanDoAction(player, selected, target))
                    {
                        icon.sprite = selected.GetItem().icon;
                        title.text  = action.title;
                        icon_group.SetActive(true);
                    }
                }
            }
        }
Exemplo n.º 6
0
 private void SlowUpdate()
 {
     current_slot   = ItemSlotPanel.GetSelectedSlotInAllPanels();
     current_select = Selectable.GetNearestHover(transform.position);
 }
 private void OnCancel(UISlot slot)
 {
     ItemSlotPanel.CancelSelectionAll();
     UISlotPanel.UnfocusAll();
 }
 private void OnCancel(UISlot slot)
 {
     ItemSlotPanel.CancelSelectionAll();
     Hide();
 }
        public InventoryData GetInventory()
        {
            ItemSlotPanel parent_item = (ItemSlotPanel)parent;

            return(parent_item?.GetInventory());
        }
Exemplo n.º 10
0
        public string GetInventoryUID()
        {
            ItemSlotPanel parent_item = (ItemSlotPanel)parent;

            return(parent_item?.GetInventoryUID());
        }
Exemplo n.º 11
0
        public InventoryData GetSelectedSlotInventory()
        {
            ItemSlot slot = ItemSlotPanel.GetSelectedSlotInAllPanels();

            return(slot != null?slot.GetInventory() : null);
        }
Exemplo n.º 12
0
        public int GetSelectedSlotIndex()
        {
            ItemSlot slot = ItemSlotPanel.GetSelectedSlotInAllPanels();

            return(slot != null ? slot.index : -1);
        }
Exemplo n.º 13
0
 public ItemSlot GetSelectedSlot()
 {
     return(ItemSlotPanel.GetSelectedSlotInAllPanels());
 }