Namespace: GGG.Equipment.UI
Handles drag/drop behavior local to Equipment.
Responsibilities:
- tracks Equipment-slot drag state
- tracks externally supplied ItemInstance drag state
- equips external items
- moves equipped items between Equipment slots
- unequips dragged slots
Drops that cannot be interpreted locally are surfaced through UnhandledSlotDropReceived so higher-level integrations can decide what they mean.
public sealed class EquipmentDragDropHandler : IDisposable
Inheritance
object ← EquipmentDragDropHandler
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
EquipmentDragDropHandler(IEquipment, IReadOnlyList<EquipmentSlotViewBinding>)
Creates a new EquipmentDragDropHandler instance.
public EquipmentDragDropHandler(IEquipment equipment, IReadOnlyList<EquipmentSlotViewBinding> bindings)
Parameters
equipment IEquipment
The equipment instance to inspect.
bindings IReadOnlyList<EquipmentSlotViewBinding>
The configured equipment slot view bindings.
Properties
DraggedItem
Gets the runtime item currently being dragged, when applicable.
public ItemInstance DraggedItem { get; }
Property Value
DraggedSlot
Gets the source equipment slot for the current drag, when applicable.
public EquipmentSlotDefinition DraggedSlot { get; }
Property Value
IsDragging
Gets whether an item drag operation is active.
public bool IsDragging { get; }
Property Value
IsDraggingEquipmentSlot
Gets whether a drag originating in an equipment slot is active.
public bool IsDraggingEquipmentSlot { get; }
Property Value
IsDraggingExternalItem
Gets whether a drag originating outside this view is active.
public bool IsDraggingExternalItem { get; }
Property Value
Methods
BeginExternalItemDrag(ItemInstance)
Begins dragging an ItemInstance supplied from outside Equipment.
public bool BeginExternalItemDrag(ItemInstance item)
Parameters
item ItemInstance
Returns
Disable()
Stops processing interaction events.
public void Disable()
Dispose()
Releases event subscriptions and other resources used by the handler.
public void Dispose()
DropDraggedEquipmentSlot(out ItemInstance)
Unequips the currently dragged Equipment slot.
The caller decides what should happen to the returned item.
public bool DropDraggedEquipmentSlot(out ItemInstance unequippedItem)
Parameters
unequippedItem ItemInstance
Returns
Enable()
Enables processing of interaction events.
public void Enable()
EndDrag()
Explicitly clears current drag state.
Higher-level integrations can call this after consuming a cross-module drop.
public void EndDrag()
EndExternalItemDrag()
Ends the current external-item drag operation.
public void EndExternalItemDrag()
ExternalItemDragging(Vector2)
Updates the pointer position for an active external-item drag.
public void ExternalItemDragging(Vector2 position)
Parameters
position Vector2
The current pointer position.
OnDrag
Raised when an active item drag moves.
public event Action<EquipmentSlotDefinition, ItemInstance, Vector2> OnDrag
Event Type
Action<EquipmentSlotDefinition, ItemInstance, Vector2>
OnDragStarted
Raised when an item drag begins.
public event Action<EquipmentSlotDefinition, ItemInstance> OnDragStarted
Event Type
Action<EquipmentSlotDefinition, ItemInstance>
OnDrop
Raised when an item is dropped.
public event Action<EquipmentSlotDefinition, ItemInstance> OnDrop
Event Type
Action<EquipmentSlotDefinition, ItemInstance>
OperationCompleted
Raised after a drag-and-drop operation has completed.
public event Action<EquipmentDragDropResult> OperationCompleted
Event Type
Action<EquipmentDragDropResult>
UnhandledSlotDropReceived
Raised when a drop cannot be resolved by the handler.
public event Action<EquipmentSlotDefinition> UnhandledSlotDropReceived