Storage Window
🏦 StorageWindow Class
Window for managing in‐game storage vaults with pagination, filtering, and currency transactions.
Namespace:
Esper.Inventool.UI
Access:public
Type:class
Inherits:DraggableWindow
📦 Fields
public
storage
Storage
The currently managed storage vault.
protected
currenciesContainer
VisualElement
Container for displaying storage currencies.
protected
currencyElements
List<CurrencyElement>
Dynamic list of currency UI elements.
protected
filters
List<StorageFilter>
Available item‐type filters.
protected
selectedFilter
StorageFilter
Currently active filter.
protected
title
Label
Displays the storage title.
protected
originalStorageTitle
string
Backup of the UI title before localization or custom override.
protected
filterScroll
ScrollView
Scroll view for filter buttons.
protected
storageContent
VisualElement
Root element for storage UI layout.
protected
storageItemContent
VisualElement
Container for slot elements.
protected
filterTitleLabel
Label
Current filter name display.
protected
storageScroll
ScrollView
Scroll view presenting storage items per page.
protected
pagesArea
VisualElement
Pagination controls container.
protected
pagesLabel
Label
Label showing “current/total” page count.
protected
pageLeftButton
Button
Button to navigate to previous page.
protected
pageRightButton
Button
Button to navigate to next page.
protected
loadedSlots
List<VisualElement>
Instantiated slot UI elements for layout.
protected
loadedItemElements
Dictionary<ItemStack,ItemStackElement>
Tracking currently visible item elements.
protected
storageRequiresReload
bool
Flag indicating layout must be rebuilt.
protected
singleSlotSize
float
Calculated pixel size per storage slot based on content width.
protected
closeButton
Button
Button to close the storage window.
protected
isPointerInsideStorage
bool
True when the pointer hovers over the storage scroll view.
🔍 Properties
public
Loaded
bool
True after the first page layout completes.
public static
Instance
StorageWindow
Active singleton instance of the window.
🧰 Methods
protected override
Awake()
void
Initialize singleton, cache UI elements, and register storage update callbacks.
protected override
Start()
void
Hide window by default.
protected virtual
HandleStorageUpdated(ItemStack itemStack, Storage storage)
void
Reload current page when items change in storage.
protected virtual
HandleStorageUpdated(Currency currency, Storage storage)
void
Update currency labels when storage currencies change.
public virtual
Open(Storage storage)
void
Configure pagination, filters, and currencies; then display the window.
public virtual
UpdateStorageTitle()
void
Localize or reset the storage title based on custom settings.
public virtual
ReloadStorage()
void
Rebuild slot grid and reload current page.
public override
Close()
void
Close window, invoke storage‐closed event, and clear reference.
public virtual
IsPointerInsideStorage()
bool
Return true if pointer is over the storage scroll view.
public
ReloadCurrencyElements()
void
Rebuild the UI elements for storage currencies.
public
UpdateCurrenciesText()
void
Refresh currency amount labels.
public
UpdatePagesText()
void
Update the pages counter label.
public
NextPage()
void
Advance to the next storage page and reload it.
public
PreviousPage()
void
Go back one storage page and reload it.
public
ReloadCurrentPage()
void
Clear previous items and populate the current page slots with ItemStackElement
s.
public
GetItemElement(ItemStack itemStack)
ItemStackElement
Retrieve the visual element for a given item stack, or null
.
public
ResetLoadedSlots()
void
Mark all storage slots as available.
public
SetSlotInUse(VisualElement slotElement)
void
Visually mark a slot as occupied.
public
SetSlotAvailable(VisualElement slotElement)
void
Visually mark a slot as free.
public
CreateItemStackElement(ItemStack itemStack)
ItemStackElement
Instantiate a UI element for the given ItemStack
.
public virtual
ReloadSlots()
void
Rebuild the empty slot grid based on storage.PageSlotCount
and slot size calculation.
public virtual
ReloadFilters()
void
Rebuild filter buttons for all item types (with an “All Items” option).
public virtual
SelectFirstFilter()
void
Select the default “All Items” filter.
public virtual
SelectFilter(StorageFilter filter)
void
Highlight a filter button and update the filter title.
public virtual
DeselectFilter()
void
Remove visual selection from the active filter button.
🧩 Nested Types
public struct CurrencyElement
public struct CurrencyElement
image
VisualElement
Icon element for a currency.
label
Label
Label showing currency amount.
public struct StorageFilter
public struct StorageFilter
button
Button
Filter button UI element.
itemType
ItemType
The item type this filter applies to.
Active Instance
You can get the active StorageWindow
instance with StorageWindow.Instance
. Ensure there's an instance of it in your scene before using this field.
Open
Call the Open
method when the storage window should be opened. This method requires a StorageKeeper
reference as a parameter.
StorageWindow.Instance.Open(myStorageKeeper);
Close
Close
simply closes the window.
StorageWindow.Instance.Close();
Last updated