public void UpdateUI(object publishedObject) { UpdateAlertItemUiEvent e = publishedObject as UpdateAlertItemUiEvent; self.SetActive(true); ItemText.SetText(e.Item.name); Slot.AddItem(e.Item); }
private void MoveItemTo(ItemUIElement iue, InventorySlotUI slot) { iue.UpdateReturnPos(slot.ItemOffsetPos); if (slot.transform.parent.parent != null) { iue.transform.SetParent(slot.transform.parent.parent.Find("Items")); iue.ReturnPos(); } iue.ItemInfo.CurrentSlot.m_container.ClearItem(iue.ItemInfo.CurrentSlot.Coordinate); slot.AddItem(iue.ItemInfo); iue.ItemInfo.CurrentSlot = slot; }
public static void AttemptSwap(Item item1, Item item2) { InventoryContainer container1 = item1.GetContainer(); InventoryContainer container2 = item2.GetContainer(); GameObject newSlot = Instantiate(m_instance.SlotPrefab, m_instance.transform); InventorySlotUI tempSlot = newSlot.GetComponent <InventorySlotUI>(); tempSlot.m_container = m_instance.m_Container; container1.ClearItem(item1.GetSlot()); tempSlot.AddItem(item1); item1.CurrentSlot = tempSlot; InventoryUIManager.MoveItemTo(item2, container1, item1.GetSlot()); InventoryUIManager.MoveItemTo(item1, container2, item2.GetSlot()); Destroy(newSlot); }