Shop Window

🏪 ShopWindow Class

Window for displaying and filtering shop items.

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


📦 Fields

Access
Field
Type
Description

protected

shopTitle

Label

Title label of the shop tab.

protected

closeButton

Button

Button to close the window.

protected

activeShopkeeper

Shopkeeper

Currently active shopkeeper instance.

protected

shopFilterScroll

ScrollView

ScrollView for shop filters.

protected

shopScroll

ScrollView

ScrollView listing available shop items.

protected

shopFilters

List<InventoryFilter>

List of filter buttons and their associated types.

protected

selectedShopFilter

InventoryFilter

Currently selected filter.

protected

isPointerInsideShop

bool

True while pointer is over the shop list.


🔍 Properties

Access
Property
Type
Description

public static

Instance

ShopWindow

Active singleton instance of this window.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Register singleton, cache UI elements, and wire close and hover callbacks.

protected override

Start()

void

Initialize window state and hide on startup.

protected virtual

HandleItemSold(ItemStack itemStack)

void

Reload inventory and currencies after a sale.

public

LocalizeElements()

void

Localize the shop title when localization is enabled.

public virtual

Open(Shopkeeper shopkeeper)

void

Show window for the given shopkeeper, then reload filters and items.

public override

Close()

void

Close the window and clear the active shopkeeper.

protected virtual

ReloadShopItems()

void

Rebuild the shop item list based on the active filter.

protected virtual

ReloadShopFilters()

void

Rebuild the filter buttons for the shop.

public virtual

IsPointerInsideShopList()

bool

Return true if pointer is currently over the shop items list.

protected virtual

SelectShopFilter(InventoryFilter filter)

void

Highlight the selected filter button.

protected virtual

DeselectShopFilter()

void

Remove visual selection from the current filter.

public

GetActiveShopkeeper()

Shopkeeper

Retrieve the currently active shopkeeper instance.


🧩 Nested Types

protected struct InventoryFilter

Field
Type
Description

button

Button

UI element representing the filter.

itemType

ItemType

The item type this filter applies to.


Active Instance

You can get the active ShopWindow instance with ShopWindow.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 Shopkeeper reference as a parameter.

ShopWindow.Instance.Open(myShopkeeper);

Close

Close simply closes the window.

ShopWindow.Instance.Close();

Last updated