Beispiel #1
0
        public void AddItemToRespectiveSlot(InventoryItemButton itemButton)
        {
            switch (itemButton.ItemSlot)
            {
            case ItemSlot.Weapon:
                if (!weaponSlot1.Occupied)
                {
                    weaponSlot1.AddItemIntoSlot(itemButton);
                }
                else
                {
                    weaponSlot2.AddItemIntoSlot(itemButton);
                }
                break;

            case ItemSlot.Head:
                headSlot.AddItemIntoSlot(itemButton);
                break;

            case ItemSlot.Body:
                bodySlot.AddItemIntoSlot(itemButton);
                break;

            case ItemSlot.Feet:
                feetSlot.AddItemIntoSlot(itemButton);
                break;
            }
        }
 internal void AddItemIntoSlot(InventoryItemButton itemButton)
 {
     Occupied = true;
     ItemName = itemButton.ItemName;
     textSlotLabel.enabled = false;
     itemButton.SetParent(transform);
 }
        public void OnDrop(PointerEventData eventData)
        {
            InventoryItemButton itemButton = ItemDragHandler.selectedItemButton;

            if (CanMoveToSlot())
            {
                if (!string.IsNullOrEmpty(_slotDetail.ItemName))
                {
                    //_slotDetail.RemoveItemFromSlot();
                    InventoryManager.Instance.MoveItemToInventory(_slotDetail.ItemName);
                }

                string itemName = itemButton.ItemName;
                _slotDetail.AddItemIntoSlot(itemButton);
                itemButton.DisableDrag();
                InventoryManager.Instance.AddAttributeIntoOverallStats(itemName);
            }
            else
            {
                itemButton.ResetParent();
            }

            itemButton.GetComponent <CanvasGroup>().blocksRaycasts = true;
            ItemDragHandler.selectedItemButton = null;
        }
Beispiel #4
0
        internal InventoryItemButton SpawnItem()
        {
            InventoryItemButton itemButton = Instantiate(uiInventoryItemPrefab, parentForInventoryItems);

            _uiItems.Add(itemButton);
            return(itemButton);
        }
Beispiel #5
0
        private void MoveItemIntoSlot(Item item)
        {
            InventoryItemButton itemButton = uiItemManager.GetButton(item.item_name);

            itemButton.DisableDrag();
            slotManager.AddItemToRespectiveSlot(itemButton);
            overallStatsDisplay.AddItemAttribute(item);
        }
 public void OnBeginDrag(PointerEventData eventData)
 {
     selectedItemButton = GetComponent <InventoryItemButton>();
     transform.SetParent(_parentDuringMove);
     _canvasGroup.blocksRaycasts = false;
 }