public void dropItem() { if (grabbedSlot != null) { grabbedSlot.getItem().release(); grabbedSlot.releaseItem(null); grabbedSlot = null; } }
private void purchaseDecoration(uint id, MenuSlot item) { if (grabbedSlot == null) { if (fpc.money >= decorationValue[(uint)id]) { if (!homeDecorationsBought.ContainsKey(id)) { homeDecorationsBought.Add(id, 0); } homeDecorationsBought[id] += 1; fpc.money -= decorationValue[(uint)id]; updateMoneyText(); bool pushedToInventory = false; Transform playerInventoryPanel = GameObject.Find("playerInventoryPanel").transform; for (int i = 0; i < 10 && pushedToInventory == false; i++) { if (playerInventoryPanel.GetChild(i).childCount != 0) { MenuSlotItem msi = playerInventoryPanel.GetChild(i).GetChild(0).GetComponent <MenuSlotItem>(); if (msi.isFlower == false && msi.id == id) { msi.setCount(msi.count + 1); pushedToInventory = true; } } } if (!pushedToInventory) { item.setCount(item.getCount() + 1); addHomeInventoryItem(id, 1, false); } for (int i = 0; i < 10 && pushedToInventory == false; i++) { if (playerInventoryPanel.GetChild(i).childCount == 0) { item.releaseItem(playerInventoryPanel.GetChild(i).GetComponent <MenuSlot>()); pushedToInventory = true; } } } } }