Equipment Slot Element

🛡️ EquipmentSlotElement Class

A draggable UI element representing an equipment slot with hover, click, and drag behavior.

Namespace: Esper.Inventool.UI Access: public Type: class Inherits: DraggableElement Attributes: [UxmlElement]


📦 Fields

Access
Field
Type
Description

public

slot

EquipmentSlot

Underlying equipment slot data.

public

containerElement

VisualElement

Container for icon styling and cropping.

public

iconElement

VisualElement

Element displaying the equipped item’s icon.

protected

dragElement

VisualElement

Visual element shown during dragging.

protected

dragIconElement

VisualElement

Icon shown within the drag element.


🔍 Properties

Access
Property
Type
Description

public

IsVisible

bool

True if the slot is visible.

public

HasItem

bool

True if an item is equipped in this slot.


🧰 Methods

Access
Method
Returns
Description

public

EquipmentSlotElement()

Constructor wiring drag and pointer callbacks and building UI.

protected virtual

OnPointerEnter(PointerEnterEvent e)

void

Show hover details for this slot.

protected virtual

OnPointerLeave(PointerLeaveEvent e)

void

Hide hover details.

protected virtual

OnClick()

void

Invoke click event and open action menu.

protected

DragStartedHandler()

void

Initialize drag visuals and register for movement.

protected

DragHandlerImmediate(GeometryChangedEvent e)

void

Immediately follow pointer when drag visuals appear.

protected

DragHandler()

void

Update drag element position to follow pointer.

protected

DropHandler()

void

Handle drop logic, equip/unequip or swap items accordingly.

protected

OpenActionMenu()

void

Open context menu for this slot’s available actions.

public

Refresh()

void

Update visuals based on current slot and item state.

public

SetData(EquipmentSlot slot)

void

Assign slot data and refresh visibility and visuals.


Last updated