Inventool Window
🏠 InventoolWindow Class
Main UI Toolkit window that hosts inventory, crafting, enchanting, shop, key‑items and storage systems; manages tabs, filters, pagination, currency displays, drag/drop and interactions with merchants, crafters, enchanters and storage.
Namespace:
Esper.Inventool.UI
Access:public
Type:class
Inherits:CrossInputSupportedWindow
📦 Fields
protected
selectedTabButton
Button
Currently selected tab button.
protected
currenciesContainer
VisualElement
Container for currency UI elements.
protected
currencyElements
List<CurrencyElement>
Loaded currency elements.
protected
inventoryFilters
List<InventoryFilter>
Inventory item-type filters.
protected
selectedInventoryFilter
InventoryFilter
Currently selected inventory filter.
protected
tabButtonContainer
VisualElement
Container that holds tab buttons.
protected
inventoryTabButton
Button
Inventory tab button.
protected
craftingTabButton
Button
Crafting tab button.
protected
enchantingTabButton
Button
Enchanting tab button.
protected
keyItemsTabButton
Button
Key items tab button.
protected
inventoryTitle
Label
Inventory title label.
protected
craftingTitle
Label
Crafting title label.
protected
enchantingTitle
Label
Enchanting title label.
protected
shopTitle
Label
Shop title label.
protected
inventoryTab
VisualElement
Inventory tab panel.
protected
inventoryContent
VisualElement
Inventory content container (movable).
protected
slotContainer
VisualElement
Equipment slots container.
protected
craftingTab
VisualElement
Crafting tab panel.
protected
enchantingTab
VisualElement
Enchanting tab panel.
protected
keyItemsTab
VisualElement
Key items tab panel.
protected
shopTab
VisualElement
Shop tab panel.
protected
storageTab
VisualElement
Storage tab panel.
protected
activeTab
VisualElement
Currently active tab panel.
protected
characterViewerElement
CharacterViewerElement
UI element for character preview/rotation.
protected
inventoryFilterScroll
ScrollView
Inventory filter scroller.
protected
weightArea
VisualElement
Weight display area.
protected
weightLabel
Label
Weight amount label.
protected
inventoryFilterTitleLabel
Label
Current inventory filter title.
protected
itemContent
VisualElement
Container for inventory slot grid.
protected
craftingContent
VisualElement
Crafting content container.
protected
enchantingContent
VisualElement
Enchanting content container.
protected
inventoryScroll
ScrollView
Inventory scroll view.
protected
pagesArea
VisualElement
Pagination controls area.
protected
inventoryPagesLabel
Label
Inventory pages label.
protected
inventoryPageLeftButton
Button
Inventory previous page button.
protected
inventoryPageRightButton
Button
Inventory next page button.
protected
loadedInventorySlots
List<VisualElement>
Generated slot visuals.
protected
loadedItemElements
Dictionary<ItemStack, ItemStackElement>
Visible item elements by ItemStack
.
protected
singleInventorySlotSize
float
Calculated pixel size per inventory slot.
protected
singleStorageSlotSize
float
Calculated pixel size per storage slot.
protected
keyItemScroll
ScrollView
Key items scroll view.
protected
keyItemContent
VisualElement
Selected key item detail container.
protected
keyItemImage
VisualElement
Selected key item icon.
protected
keyItemNameLabel
Label
Selected key item name label.
protected
keyItemSubtypeLabel
Label
Selected key item subtype label.
protected
keyItemDescriptionLabel
Label
Selected key item description label.
protected
selectedKeyItem
KeyItemElement
Currently selected key item element.
protected
equipmentSlotElements
List<EquipmentSlotElement>
All equipment slot elements.
protected
enchantmentSlotElements
List<ItemSlotElement>
Enchantment slot elements.
protected
craftingSlotElements
List<ItemSlotElement>
Crafting slot elements.
protected
enchantmentSlotLeft
ItemSlotElement
Left enchantment slot.
protected
enchantmentSlotRight
ItemSlotElement
Right enchantment slot.
protected
enchantmentCostIcon
VisualElement
Enchant cost icon.
protected
enchantmentCostLabel
Label
Enchant cost label.
protected
enchantButton
Button
Confirm enchant button.
protected
craftScroll
ScrollView
Craft list scroller.
protected
craftListElement
VisualElement
Container for craft ingredients.
protected
craftCostIcon
VisualElement
Craft cost icon.
protected
craftCostLabel
Label
Craft cost label.
protected
craftButton
Button
Confirm craft button.
protected
craftResultSlot
ItemSlotElement
Craft result slot.
protected
craftEmptyLabel
Label
Shown when craft list empty.
protected
keyItemsEmptyLabel
Label
Shown when no key items.
protected
closeButton
Button
Close window button.
protected
crafter
Crafter
Crafting logic handler.
public
activeShopkeeper
Shopkeeper
Active shopkeeper reference.
public
activeEnchanter
Enchanter
Active enchanter reference.
public
activeCraftsman
Craftsman
Active craftsman reference.
public
activeStorage
Storage
Active storage reference.
protected
shopFilterScroll
ScrollView
Shop filter scroll view.
protected
shopScroll
ScrollView
Shop items scroll.
protected
shopFilters
List<InventoryFilter>
Shop filters list.
protected
selectedShopFilter
InventoryFilter
Currently selected shop filter.
public
characterViewer
CharacterViewer
Active character viewer.
public
rotationResetButton
Button
Button to reset character rotation.
protected
storageCurrenciesContainer
VisualElement
Container for storage currencies.
protected
storageCurrencyElements
List<CurrencyElement>
Loaded storage currency visuals.
protected
storageFilters
List<InventoryFilter>
Storage filters list.
protected
selectedStorageFilter
InventoryFilter
Selected storage filter.
protected
storageTitle
Label
Storage title label.
protected
storageFilterScroll
ScrollView
Storage filter scroller.
protected
storageContent
VisualElement
Storage content container.
protected
storageItemContent
VisualElement
Storage item grid container.
protected
storageFilterTitleLabel
Label
Storage filter title label.
protected
storageScroll
ScrollView
Storage scroll view.
protected
storagePagesArea
VisualElement
Storage pagination area.
protected
storagePagesLabel
Label
Storage pages label.
protected
storagePageLeftButton
Button
Storage prev page button.
protected
storagePageRightButton
Button
Storage next page button.
protected
loadedStorageSlots
List<VisualElement>
Storage slot visuals.
protected
storageLoadedItemElements
Dictionary<ItemStack, ItemStackElement>
Visible storage items map.
public
openedTab
Tab
Currently opened tab.
protected
originalStorageTitle
string
Cached original storage title text.
protected
useEnchantingCost
bool
Show enchant cost when true.
protected
useCraftingCost
bool
Show craft cost when true.
protected
inventoryRequiresReload
bool
Flag to rebuild inventory layout.
protected
storageRequiresReload
bool
Flag to rebuild storage layout.
protected
firstOpen
bool
True until initial setup complete.
protected
inTransition
bool
True while open/close transition running.
protected
isPointerInsideCraftList
bool
Pointer inside craft list.
protected
isPointerInsideStorage
bool
Pointer inside storage.
protected
isPointerInsideShop
bool
Pointer inside shop.
protected
isPointerInsideInventory
bool
Pointer inside inventory.
🔍 Properties
public
Loaded
bool
Returns !firstOpen
.
public
OpenedForMerchant
bool
True if open and any merchant/storage is active.
public static
Instance
InventoolWindow
Singleton instance (get only).
🧰 Methods
protected override
Awake()
void
Initialize singleton, cache UI elements, register callbacks and listeners.
protected override
Start()
void
Final UI setup: parity, reload elements, hide root.
protected virtual
HandleInitialOpen()
void
One-time layout and initial loads executed on first open.
public virtual
Open()
void
Open window in Inventory mode (full UI).
public virtual
Open(Craftsman craftsman)
void
Open window in crafting-only mode.
public virtual
Open(Enchanter enchanter)
void
Open window in enchanting-only mode.
public virtual
Open(Shopkeeper shopkeeper)
void
Open window in shop-only mode.
public virtual
Open(Storage storage)
void
Open window in storage-only mode.
public virtual
Close()
void
Close window (non-merchant close).
public virtual
Exit()
void
Exit merchant/storage session and close window.
protected virtual
OpenHandler(TransitionEndEvent endEvent)
void
Transition end handler for opening.
protected virtual
CloseHandler(TransitionEndEvent endEvent)
void
Transition end handler for closing and cleanup.
protected virtual
RegisterButtonEvents(Button button)
void
Wire pointer enter and clicked events to invoke global events.
protected
SelectTabButton(Button tabButton)
void
Deselect previous and select the given tab button.
protected
SetTabButtonAsSelected(Button button)
void
Apply selected visuals and disable button.
protected
SetTabButtonAsUnselected(Button button)
void
Revert visuals and enable button.
protected virtual
ActivateTab(VisualElement tab)
void
Enable and display specified tab panel.
protected virtual
MoveInventory(VisualElement parent)
void
Move itemContent
into parent
and send to back.
protected
ShowOrHideWeightArea()
void
Toggle weight area based on settings.
protected virtual
ReloadInventoryFilters()
void
Build inventory filter UI and handlers.
protected virtual
SelectInventoryFilter(InventoryFilter filter)
void
Mark inventory filter selected and update title.
protected virtual
DeselectInventoryFilter()
void
Unmark selected inventory filter.
protected virtual
ReloadShopFilters()
void
Build shop filter UI and handlers.
protected virtual
SelectShopFilter(InventoryFilter filter)
void
Mark shop filter selected.
protected virtual
DeselectShopFilter()
void
Unmark selected shop filter.
public virtual
ReloadStorageFilters()
void
Build storage filter UI and handlers.
public virtual
SelectStorageFilter(InventoryFilter filter)
void
Mark storage filter selected and update title.
public virtual
DeselectStorageFilter()
void
Unmark selected storage filter.
protected virtual
ReloadInventorySlots()
void
Recreate inventory slot grid and calculate slot size.
public virtual
ReloadStorageSlots()
void
Recreate storage slot grid and calculate slot size.
protected
CreateItemStackElement(ItemStack itemStack)
ItemStackElement
Instantiate and size an ItemStackElement for inventory.
public
CreateStorageItemStackElement(ItemStack itemStack)
ItemStackElement
Instantiate and size an ItemStackElement for storage.
public
ReloadCurrentInventoryPage()
void
Populate visible inventory page with ItemStackElements.
public
ReloadCurrentStoragePage()
void
Populate visible storage page with ItemStackElements.
public
NextPage()
void
Advance inventory page then reload.
public
PreviousPage()
void
Go back inventory page then reload.
public
NextStoragePage()
void
Advance storage page then reload.
public
PreviousStoragePage()
void
Go back storage page then reload.
protected
ResetLoadedSlots()
void
Mark all loaded inventory slots as available.
public
ResetLoadedStorageSlots()
void
Mark all loaded storage slots as available.
protected
SetSlotInUse(VisualElement slotElement)
void
Visually mark inventory slot as occupied.
public
SetStorageSlotInUse(VisualElement slotElement)
void
Visually mark storage slot as occupied.
protected
SetSlotAvailable(VisualElement slotElement)
void
Visually mark inventory slot as available.
public
SetStorageSlotAvailable(VisualElement slotElement)
void
Visually mark storage slot as available.
public
GetItemElement(ItemStack itemStack)
ItemStackElement
Retrieve inventory ItemStackElement for given ItemStack, or null.
public
GetStorageItemElement(ItemStack itemStack)
ItemStackElement
Retrieve storage ItemStackElement for given ItemStack, or null.
public virtual
AddToEnchantSlot(ItemStack itemStack)
void
Place item into first matching enchantment slot.
public virtual
UpdateEnchantmentCostElements()
void
Update enchant cost visibility and values.
public virtual
ConfirmEnchantment()
void
Attempt enchant and update inventory/currencies on success.
protected
ReloadEnchantmentSlotElements()
void
Set enchant slot backgrounds from settings.
protected
ReloadCurrencyElements()
void
Rebuild on-screen inventory currency UI.
public
UpdateCurrenciesText()
void
Refresh inventory currency labels.
public
UpdateStorageCurrenciesText()
void
Refresh storage currency labels.
public
UpdateWeightText()
void
Refresh weight text label.
public
UpdatePagesText()
void
Refresh inventory pages label.
public
UpdateStoragePagesText()
void
Refresh storage pages label.
public virtual
ReloadCraftList()
void
Rebuild craft ingredient list UI.
public virtual
AddToCraftList(ItemStack itemStack)
void
Add item to craft list (if allowed) and refresh.
public virtual
RemoveFromCraftList(int index)
void
Remove craft item at index and refresh.
public virtual
UpdateCraftingElements()
void
Update craft result slot, cost icon/label and button state.
public virtual
ConfirmCraft()
void
Attempt craft; clear items and refresh on success.
public
ReloadKeyItems()
void
Rebuild key items list UI.
protected
SelectKeyItem(KeyItemElement keyItemElement)
void
Show selected key item details.
protected
DeselectKeyItem()
void
Clear key item selection and hide details.
public virtual
IsPointerInsideInventory()
bool
True if pointer is inside inventory scroll and flag set.
public virtual
IsPointerInsideStorage()
bool
True if pointer is inside storage scroll and flag set.
public virtual
IsPointerInsideCraftingList()
bool
True if pointer is inside craft scroll and flag set.
public virtual
IsPointerInsideShop()
bool
True if pointer is inside shop scroll and flag set.
protected virtual
HandleItemsUpdated(ItemStack itemStack, Storage storage)
void
Handler for item updates from storage/inventory.
protected virtual
HandleStorageUpdated(ItemStack itemStack, Storage storage)
void
Handler for storage item updates.
protected virtual
HandleStorageUpdated(Currency currency, Storage storage)
void
Handler for storage currency updates.
protected virtual
HandleItemDismantled(ItemStack itemStack, List<ItemStack> dismantleResult)
void
Handler when an item is dismantled.
protected virtual
HandleItemDropped(ItemStack itemStack)
void
Handler when an item is dropped.
protected virtual
HandleItemEquipped(ItemStack itemStack, EquipmentSlot equipmentSlot)
void
Handler for equipment events; refresh equipment visuals.
protected virtual
HandleItemUnequipped(ItemStack itemStack, EquipmentSlot equipmentSlot)
void
Handler for unequip events; refresh equipment visuals.
protected virtual
HandleItemUsed(ItemStack itemStack)
void
Handler when an item is used.
protected virtual
HandleCurrencyChanged(Currency currency)
void
Handler when inventory currency changes.
protected virtual
HandleItemSold(ItemStack itemStack)
void
Handler when an item is sold; update inventory and currencies.
protected virtual
HandleItemsUpdated()
void
Handler for generic items updated events.
protected virtual
HandleEnchantmentError(string message)
void
Show localized confirm prompt for enchant errors.
protected virtual
HandleCraftingError(string message)
void
Show localized confirm prompt for craft errors.
protected virtual
HandleMerchantError(Merchant.MerchantError error, string message)
void
Show localized confirm prompt for various merchant errors.
public
GetActiveShopkeeper()
Shopkeeper
Return activeShopkeeper
reference.
🧩 Nested Types
public struct CurrencyElement
public struct CurrencyElement
image
VisualElement
The currency icon element.
label
Label
The currency amount label.
public struct InventoryFilter
public struct InventoryFilter
button
Button
The filter button UI element.
itemType
ItemType
The item type that this filter applies.
public enum Tab
public enum Tab
None
No tab selected.
Inventory
Inventory tab.
Crafting
Crafting tab.
Enchanting
Enchanting tab.
KeyItems
Key-items tab.
Shop
Shop tab.
Storage
Storage tab.
Active Instance
You can get the active InventoolWindow
instance with InventoolWindow.Instance
. Ensure there's an instance of it in your scene before using this field.
Opening & Closing
Open
The InventoolWindow
can be opened in multiple ways, each for a different purpose.
Opening For Player
Call the Open
method when the player wants to open their inventory.
InventoolWindow.Instance.Open();
Opening For Merchant
You can open the window for the specific merchant by providing the Merchant reference as a parameter.
InventoolWindow.Instance.Open(myMerchant);
Opening for Storage
You can open the window for a specific storage by providing the Storage reference as a parameter.
InventoolWindow.Instance.Open(myStorage);
Close
Close
closes the window if opened for the player. Use Exit
to close the window when opened for a merchant. Optionally, you can use ForceClose
to close the window whether it's opened for a merchant or not.
InventoolWindow.Instance.Close();
Toggle
Optionally, you can use Toggle to open or close the window.
InventoolWindow.Instance.Toggle();
Character View
Setting Custom Image
If you don't have a Character Viewer set up in your scene, a default image will be displayed in the equipment section. You can override this image with a custom one. A Sprite or Texture2D will be required.
InventoolWindow.Instance.SetCharacterViewer(mySprite);
Reset Character View Rotation
If you have the Character Viewer set up, you can call ResetCharacterViewRotation
to reset its view.
InventoolWindow.Instance.ResetCharacterViewRotation();
Tabs
The methods below can only be used in a script that inherits from InventoolWindow
.
Close Active Tab
CloseActiveTab
closes the tab currently enabled. This is useful if you added your own tabs.
CloseActiveTab();
Activate Tab
Use ActivateTab
and provide a VisualElement
that acts as the root of the tab. This will enable the tab.
ActivateTab(myTab);
Select Tab Button
To mark a tab button as selected, use SelectTabButton
and provide the Button
as a parameter.
SelectTabButton(myButton);
Move Inventory
You can move the inventory to a tab with the MoveInventory
method. Provide a VisualElement
(root of the tab) as a parameter.
MoveInventory(myTab);
Last updated