Shop Window UGUI

🏬 ShopWindowUGUI Class

Shop window for uGUI.

Namespace: Esper.Inventool.UI.UGUI Access: public Type: class Inherits: DraggableWindowUGUI


📦 Fields

Access
Field
Type
Description

protected

shopItemElementPrefab

ShopItemElementUGUI

Shop item prefab.

protected

inventoryFilterPrefab

InventoryFilterUGUI

Filter button prefab.

protected

shopTitleLabel

TextMeshProUGUI

Title label.

protected

closeButton

Button

Close button.

protected

shopFilterScroll

ScrollRect

Filter scroll container.

protected

shopScroll

ScrollRect

Shop items scroll container.

protected

activeShopkeeper

Shopkeeper

Current shopkeeper.

protected

loadedShopItems

List<ShopItemElementUGUI>

Instantiated shop item elements.

protected

shopFilters

List<InventoryFilterUGUI>

Instantiated filter buttons.

protected

selectedShopFilter

InventoryFilterUGUI

Currently selected filter.

public static

Instance

ShopWindowUGUI

Singleton instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Singleton setup, register close button, wire sold event, localize.

protected override

Start()

void

Hides content on start.

protected virtual

HandleItemSold(ItemStack itemStack)

void

Refresh inventory UI after sale.

public

LocalizeElements()

void

Localize shop title if enabled.

public virtual

Open(Shopkeeper shopkeeper)

void

Open window for a shopkeeper, load filters/items, set active.

public override

Close()

void

Close window and clear active shopkeeper.

protected virtual

ReloadShopItems()

void

Rebuild shop item list from active shopkeeper.

protected virtual

ReloadShopFilters()

void

Rebuild filter buttons from shopkeeper filter types.

public virtual

IsPointInsideShopList(Vector2 point)

bool

True if point lies inside shop list scroll area.

protected virtual

SelectShopFilter(InventoryFilterUGUI filter)

void

Select a filter and disable its button.

protected virtual

DeselectShopFilter()

void

Deselect current filter.

public

GetActiveShopkeeper()

Shopkeeper

Returns active shopkeeper or null.

Active Instance

You can get the active ShopWindowUGUI instance with ShopWindowUGUI.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.

ShopWindowUGUI.Instance.Open(myShopkeeper);

Close

Close simply closes the window.

ShopWindowUGUI.Instance.Close();

Last updated