public void SetNullSlots(List <int> slotsUsed, InventoryE who) { for (int i = 0; i < inventoryUIs[(int)who].slotContents.Length; i++) { if (!slotsUsed.Contains(i) && inventoryUIs[(int)who].slotContents[i].activeSelf) { inventories[(int)who].items[i] = null; inventoryUIs[(int)who].slotContents[i].SetActive(false); } } }
public int ChangeSelectedInventory(int location) { cursorLocation = location; InventoryE CurrentInventory = InventoryE.Player; if (cursorLocation < 0) { cursorLocation = 3; } else if (cursorLocation > 3) { cursorLocation = 0; } //reset highlight locations (must be done to clear selected slot of past inventory for (int i = 0; i <= 3; i++) { if (i == 0) { CurrentInventory = InventoryE.Player; } else if (i == 1) { CurrentInventory = InventoryE.PlayerBin; } else if (i == 2) { CurrentInventory = InventoryE.NPCBin; } else if (i == 3) { CurrentInventory = InventoryE.NPC; } if (cursorLocation == i) { for (int j = (int)InventoryE.Player; j <= (int)InventoryE.NPCBin; j++) { if (j == (int)CurrentInventory) { inventoryUIs[j].EnableSelectedSlot(); } else { inventoryUIs[j].DisableSelectedSlot(); } inventories[j].SelectSlotNumber(0); } } } return(cursorLocation); }
public void increaseNumContent(List <int> currentContents, InventoryE who, int slot) { for (int i = 0; i < inventoryUIs[(int)who].slotFrames.Length; i++) { if (who == InventoryE.IOU) { if (inventoryUIs[(int)who].slotFrames[i].activeSelf) { currentContents[slot]++; //number items } } else { if (inventoryUIs[(int)who].slotContents[i].activeSelf) { currentContents[slot]++; //number items } } } }
public void TransferItem(InventoryE sender, InventoryE reciever, int slotNumber) { var i = slotNumber; //copied private method FindEmptySlot var firstSlot = 0; for (var j = 0; j < inventoryUIs[(int)reciever].slotFrames.Length; j++) { if (inventoryUIs[(int)reciever].slotContents[j].activeSelf) { continue; } firstSlot = j; break; } //Customized inventory.PickUp() method if (inventoryUIs[(int)sender].slotContents[i].activeSelf) { //inventory.items[i].SetActive(true); // Add item to destination inventoryUIs[(int)reciever].slotContents[firstSlot].SetActive(true); inventoryUIs[(int)reciever].slotContents[firstSlot].GetComponent <Image>().sprite = inventories[(int)sender].items[i].GetComponent <Collectible>().sprite; inventories[(int)reciever].items[firstSlot] = inventories[(int)sender].items[i]; // Remove item from inventory inventories[(int)sender].items[i] = null; inventoryUIs[(int)sender].slotContents[i].SetActive(false); } inventories[(int)sender].SelectSlotNumber(i); }