public static void clearInventoryItems(Table targetTable) { Array<Cell> cells = targetTable.getCells(); for (int i = 0; i < cells.size; i++) { InventorySlot inventorySlot = (InventorySlot) cells.get(i).getActor(); if (inventorySlot == null) continue; inventorySlot.clearAllInventoryItems(false); } }
public void removeQuestItemFromInventory(String questID) { Array<Cell> sourceCells = _inventorySlotTable.getCells(); for (int index = 0; index < sourceCells.size; index++) { InventorySlot inventorySlot = ((InventorySlot) sourceCells.get(index).getActor()); if (inventorySlot == null) continue; InventoryItem item = inventorySlot.getTopInventoryItem(); if (item == null) continue; String inventoryItemName = item.getName(); if (inventoryItemName != null && inventoryItemName.equals(questID)) { inventorySlot.clearAllInventoryItems(false); } } }