Skip to content

ItemCountsView

Namespace: StackInventory.Game.UI
Inherits: Container

NameTypeDescription
ItemDisplayTemplatePackedScene
void _Notification(int what)
void _Ready()
ValidationResult Validate()
void OnInventoryChanged(IInventory? newInventory)
void UnsubscribeFromInventory()
void OnItemTotalsChanged(object? sender, Dictionary<IItem, int> itemTotals)

Handles the ItemTotalsChanged event from the inventory. Automatically refreshes the display when item totals change (items added, removed, or quantities updated).

void Clear()

Removes all item displays from the grid and frees their resources.

void SetupForMaterials(IInventory inventory)

Populates the grid with displays for each item type in the inventory. Creates one StackView per item type showing the total quantity across all containers.

void CreateDisplay(ItemStack displayStack)

Creates and adds a new StackView display for the given item stack to the grid. The display will show the item’s icon and total count.

Parameters:

  • displayStack - The item stack to create a display for (item and total count)