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; }
internal InventoryItemButton SpawnItem() { InventoryItemButton itemButton = Instantiate(uiInventoryItemPrefab, parentForInventoryItems); _uiItems.Add(itemButton); return(itemButton); }
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; }