ItemCountsView
Namespace: StackInventory.Game.UI
Inherits: Container
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
ItemDisplayTemplate | PackedScene |
Methods
Section titled “Methods”_Notification
Section titled “_Notification”void _Notification(int what)_Ready
Section titled “_Ready”void _Ready()Validate
Section titled “Validate”ValidationResult Validate()OnInventoryChanged
Section titled “OnInventoryChanged”void OnInventoryChanged(IInventory? newInventory)UnsubscribeFromInventory
Section titled “UnsubscribeFromInventory”void UnsubscribeFromInventory()OnItemTotalsChanged
Section titled “OnItemTotalsChanged”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.
SetupForMaterials
Section titled “SetupForMaterials”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.
CreateDisplay
Section titled “CreateDisplay”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)