Enchanting Window UGUI

✨ EnchantingWindowUGUI Class

Inventool’s enchanting window for uGUI.

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


📦 Fields

Access
Field
Type
Description

protected

enchantingTitleLabel

TextMeshProUGUI

The enchanting title label.

protected

enchantmentSlotElements

List<ItemSlotElementUGUI>

A list of all enchantment slots.

protected

enchantmentSlotLeft

ItemSlotElementUGUI

Left enchantment slot.

protected

enchantmentSlotRight

ItemSlotElementUGUI

Right enchantment slot.

protected

currencyElement

CurrencyElementUGUI

The enchanting cost element.

protected

enchantButton

Button

The button that confirms the enchant.

protected

enchantButtonLabel

TextMeshProUGUI

Label that displays text for the enchant button.

protected

closeButton

Button

The close button.

protected

activeEnchanter

Enchanter

The enchanter currently being interacted with.

protected

useEnchantingCost

bool

True if the enchanting cost should be used.


🔍 Properties

Access
Property
Type
Description

public

OpenedForMerchant

bool

True if the window is open for a merchant.

public

Instance

EnchantingWindowUGUI

The active instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Initializes singleton, registers buttons, sets slot rules, and localizes UI.

protected override

Start()

void

Wires drop behavior for slots, reloads slot visuals, hides content initially.

protected virtual

HandleEnchantmentError(string message)

void

Handles errors and opens a confirm prompt (localized if enabled).

public

LocalizeElements()

void

Localizes UI elements owned by this window.

public virtual

Open(Enchanter enchanter)

void

Opens the window for an enchanter and updates cost elements.

public override

Close()

void

Closes the window and clears enchantment slots.

public virtual

UpdateEnchantmentCostElements()

void

Updates currency element and button interactivity based on slot items.

public virtual

AddToEnchantSlot(ItemStack itemStack)

void

Places an item stack in a valid enchantment slot.

protected

ReloadEnchantmentSlotElements()

void

Reloads slot icons and tints from inventory settings.

public

GetEnchantmentSlotElementAtPoint(Vector2 point)

ItemSlotElementUGUI

Gets the slot element at a screen point or null.

public virtual

ConfirmEnchantment()

void

Attempts enchant; updates UI and inventory on success.

protected virtual

EnchantmentCriteriaIsMet()

bool

True if both slots contain valid items ready to enchant.

Active Instance

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

Open

Call the Open method when the enchanting window should be opened. This method accepts a Enchanter parameter. Use null to open without a enchanter reference.

EnchantingWindowUGUI.Instance.Open(myEnchanter);

Close

Close simply closes the window.

EnchantingWindowUGUI.Instance.Close();

Last updated