public void Clear() { for (int i = 0; i < inventorySlots.Count; i++) { InventoryTabObject tabObject = inventorySlots[i]; // if has subtab, iterate through all the subtabs and all their slots if (tabObject.subTabs.Count > 0) { for (int j = 0; j < tabObject.subTabs.Count; j++) { RemoveItemsFromTabsSlots(tabObject.subTabs[j].tabInventorySlots); } } else { // else iterate over all slots in a tab RemoveItemsFromTabsSlots(tabObject.tabInventorySlots); } } }
public void PopulateInitial() { // iterate through all tabs for (int i = 0; i < inventorySlots.Count; i++) { InventoryTabObject tabObject = inventorySlots[i]; // if has subtab, iterate through all the subtabs and all their slots if (tabObject.subTabs.Count > 0) { for (int j = 0; j < tabObject.subTabs.Count; j++) { SetItemsInTabsSlots(i, tabObject.subTabs[j].tabInventorySlots); } } else { // else iterate over all slots in a tab SetItemsInTabsSlots(i, tabObject.tabInventorySlots); } } }