Inventory Window

🪟 InventoryWindow Class

Inventool’s inventory window split out from the other systems for UI Toolkit.

Namespace: Esper.Inventool.UI Access: public Type: class Inherits: DraggableWindow


📦 Fields

Access
Field
Type
Description

protected

currenciesContainer

VisualElement

Container for currency UI elements.

protected

currencyElements

List<CurrencyElement>

Instantiated currency visuals.

protected

inventoryFilters

List<InventoryFilter>

Instantiated inventory filters.

protected

selectedInventoryFilter

InventoryFilter

Currently selected inventory filter.

protected

inventoryTitle

Label

Label displaying the inventory title.

protected

inventoryContent

VisualElement

Container for inventory slots.

protected

inventoryFilterScroll

ScrollView

ScrollView for filters list.

protected

weightArea

VisualElement

Container for weight display.

protected

weightLabel

Label

Label showing weight text.

protected

inventoryFilterTitleLabel

Label

Label for current filter title.

protected

itemContent

VisualElement

Container for slot elements.

protected

inventoryScroll

ScrollView

ScrollView for slots content.

protected

pagesArea

VisualElement

Container for pagination controls.

protected

inventoryPagesLabel

Label

Label showing page counter.

protected

inventoryPageLeftButton

Button

Button to go to previous page.

protected

inventoryPageRightButton

Button

Button to go to next page.

protected

loadedInventorySlots

List<VisualElement>

Instantiated slot UI elements.

protected

loadedItemElements

Dictionary<ItemStack, ItemStackElement>

Instantiated item visuals.

protected

inventoryRequiresReload

bool

True if inventory layout needs reload.

protected

singleInventorySlotSize

float

Calculated pixel size for slots.

protected

closeButton

Button

Button to close the window.

protected

isPointerInsideInventory

bool

True while pointer is over inventory.


🔍 Properties

Access
Property
Type
Description

public

Loaded

bool

True after first layout completes.

public static

Instance

InventoryWindow

Active singleton instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Initialize singleton and cache UI elements.

protected override

Start()

void

Reload currencies, filters, and hide window initially.

protected virtual

HandleItemDismantled(itemStack, result)

void

Reload page after an item is dismantled.

protected virtual

HandleItemUsed(itemStack)

void

Reload page after an item is used.

protected virtual

HandleCurrencyChanged(currency)

void

Update currency labels on change.

protected virtual

HandleItemsUpdated()

void

Reload page when inventory changes.

protected virtual

HandleItemDropped(itemStack)

void

Reload page after an item is dropped.

protected virtual

HandleMerchantError(error, message)

void

Show error prompt for merchant interactions.

public

LocalizeElements()

void

Localize static UI text when enabled.

public virtual

Toggle()

void

Toggle window open or close.

protected virtual

HandleInitialOpen()

void

Perform one-time slot setup on first open.

public virtual

ReloadInventory()

void

Rebuild slots and reload current page.

public override

Open()

void

Open window and initialize layout.

public virtual

IsPointerInsideInventory()

bool

True if pointer is over inventory content.

protected

ShowOrHideWeightArea()

void

Toggle weight area visibility.

protected

ReloadCurrencyElements()

void

Rebuild inventory currency UI.

public

UpdateCurrenciesText()

void

Refresh inventory currency labels.

public

UpdateWeightText()

void

Refresh weight label.

public

UpdatePagesText()

void

Refresh page counter label.

public

NextPage()

void

Advance to next page and reload.

public

PreviousPage()

void

Go to previous page and reload.

public virtual

ReloadCurrentInventoryPage()

void

Recreate item visuals for current page.

public

GetItemElement(itemStack)

ItemStackElement

Retrieve UI element for a given item stack.

protected

ResetLoadedSlots()

void

Mark all slots as available.

protected

SetSlotInUse(slotElement)

void

Visually mark a slot as occupied.

protected

SetSlotAvailable(slotElement)

void

Visually mark a slot as free.

protected

CreateItemStackElement(itemStack)

ItemStackElement

Instantiate UI element for an item stack.

protected virtual

ReloadInventorySlots()

void

Recreate slot grid based on page size.

protected virtual

ReloadInventoryFilters()

void

Rebuild inventory filter UI.

protected virtual

SelectInventoryFilter(filter)

void

Select a filter and update title.

protected virtual

DeselectInventoryFilter()

void

Deselect active filter.


🧩 Nested Types

protected struct CurrencyElement

Name
Type
Description

image

VisualElement

Currency icon element.

label

Label

Currency amount label.

protected struct InventoryFilter

Name
Type
Description

button

Button

Filter button UI element.

itemType

ItemType

The item type this filter applies to.


Active Instance

You can get the active InventoryWindow instance with InventoryWindow.Instance. Ensure there's an instance of it in your scene before using this field.

Opening & Closing

Open

Call the Open method when the player wants to open their inventory.

InventoryWindow.Instance.Open();

Close

Close simply closes the window.

InventoryWindow.Instance.Close();

Toggle

Optionally, you can use Toggle to open or close the window.

InventoryWindow.Instance.Toggle();

Last updated