Enchanting Window

✨ EnchantingWindow Class

Window for enchanting items with split UI support.

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


📦 Fields

Access
Field
Type
Description

protected

enchantingTitle

Label

Enchanting window title label.

protected

enchantingContent

VisualElement

Container for enchanting content.

protected

enchantmentSlotElements

List<ItemSlotElement>

All enchantment slot elements.

protected

enchantmentSlotLeft

ItemSlotElement

Left enchantment slot.

protected

enchantmentSlotRight

ItemSlotElement

Right enchantment slot.

protected

enchantmentCostIcon

VisualElement

Icon for enchantment cost.

protected

enchantmentCostLabel

Label

Label showing enchantment cost.

protected

enchantButton

Button

Button to confirm enchantment.

protected

closeButton

Button

Button to close the window.

protected

activeEnchanter

Enchanter

Currently active enchanter.

protected

useEnchantingCost

bool

True to display enchanting cost.


🔍 Properties

Access
Property
Type
Description

public

OpenedForMerchant

bool

True if open for a merchant.

public static

Instance

EnchantingWindow

Active singleton instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Initialize UI elements and event listeners.

protected override

Start()

void

Hook drop logic and reload slot visuals.

protected virtual

HandleEnchantmentError(string message)

void

Show error prompt on failure.

public

LocalizeElements()

void

Localize window text when enabled.

public virtual

Open(Enchanter enchanter)

void

Open window for given enchanter.

public override

Close()

void

Close window and clear slot items.

public virtual

UpdateEnchantmentCostElements()

void

Refresh cost icon and label visibility.

public virtual

AddToEnchantSlot(ItemStack itemStack)

void

Place an item into the correct enchantment slot.

protected

ReloadEnchantmentSlotElements()

void

Apply slot background icons from settings.

public

GetHoveredEnchantmentSlotElement()

ItemSlotElement

Get the currently hovered enchantment slot.

public virtual

ConfirmEnchantment()

void

Attempt enchantment and update inventory.

protected virtual

EnchantmentCriteriaIsMet()

bool

True if both slots have valid items to enchant.


Active Instance

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

EnchantingWindow.Instance.Open(myEnchanter);

Close

Close simply closes the window.

EnchantingWindow.Instance.Close();

Last updated