init
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
using VOID.Generic.Objects.Unit.Actions;
|
||||
using VOID.Generic.Objects.Wearable;
|
||||
using VOID.Generic.Player.Util;
|
||||
|
||||
namespace VOID.Generic.Player.DraggingOperation
|
||||
{
|
||||
public class EquipmentToBackpackDraggingOperation : AbstractDraggingOperation
|
||||
{
|
||||
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
|
||||
{
|
||||
return sourceSelect.slotUI?.slotType == SlotType.EquipmentSlot
|
||||
&& targetSelect.slotUI?.slotType == SlotType.BackpackSlot;
|
||||
}
|
||||
|
||||
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
|
||||
{
|
||||
if (sourceSelect.selectObject is not WearableObject wearable) return;
|
||||
unit.OrderStop();
|
||||
var unEquipAction = new UnEquipAction(unit, wearable);
|
||||
unEquipAction.OnAfterPerform += () => unit.unitBackpack.Swap(Array.IndexOf(unit.unitBackpack.items, wearable), targetSelect.slotUI.slotIndex);
|
||||
unit.Order(unEquipAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user