This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,20 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class AbilityBookToActionBarDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.AbilityBookSlot
&& targetSelect.slotUI?.slotType == SlotType.ActionBarSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
unit.unitActionBar.Set(targetSelect.slotUI.slotIndex, sourceSelect.selectAbility);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6f4635567dc04393a64a263e88e6e7f3
timeCreated: 1698786458
@@ -0,0 +1,11 @@
using VOID.Generic.Objects.Unit;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public abstract class AbstractDraggingOperation
{
public abstract bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect);
public abstract void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6d2de581ca754d01b320bd5de933251a
timeCreated: 1698770059
@@ -0,0 +1,25 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Usable;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class ActionBarToActionBarDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ActionBarSlot
&& targetSelect.slotUI?.slotType == SlotType.ActionBarSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
unit.unitActionBar.UnSet(sourceSelect.slotUI.slotIndex);
if (sourceSelect.selectAbility)
unit.unitActionBar.Set(targetSelect.slotUI.slotIndex, sourceSelect.selectAbility);
if (sourceSelect.selectObject && sourceSelect.selectObject is UsableObject usable)
unit.unitActionBar.Set(targetSelect.slotUI.slotIndex, usable);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ddf93bae19b34fe08aeeedc7006276cb
timeCreated: 1698786284
@@ -0,0 +1,20 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class ActionBarToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ActionBarSlot
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
sourceSelect.slotUI.Clear();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f58f5af0bc224a32ac91a73d75df2008
timeCreated: 1698786224
@@ -0,0 +1,22 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Usable;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class BackpackToActionBarDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.ActionBarSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not UsableObject usable) return;
unit.unitActionBar.Set(targetSelect.slotUI.slotIndex, usable);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 64274bb465a54118bdb30fe1ecab7184
timeCreated: 1698784366
@@ -0,0 +1,32 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class BackpackToBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.BackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
var itemFrom = sourceSelect.slotUI.item;
var itemTo = targetSelect.slotUI.item;
if (itemFrom.CanStackWith(itemTo))
{
itemFrom.StackWith(itemTo);
return;
}
unit.unitBackpack.Swap(
sourceSelect.slotUI.slotIndex,
targetSelect.slotUI.slotIndex
);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b9ca5a17d69447c3af5b238b960de390
timeCreated: 1698784246
@@ -0,0 +1,58 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class BackpackToContainerDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.ContainerSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var container = targetSelect.containerUI.container;
if (container.itemState.carriedBy == unit)
{
var otherItem = container.containerContent.items[targetSelect.slotUI.slotIndex];
unit.unitBackpack.Drop(item);
if (otherItem)
{
container.containerContent.MoveOut(otherItem, unit);
unit.unitBackpack.Take(sourceSelect.slotUI.slotIndex, otherItem);
}
container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, item, unit);
}
else
{
unit.OrderStop();
var moveAction = new MoveAction(unit, container, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
var otherItem = container.containerContent.items[targetSelect.slotUI.slotIndex];
if (otherItem)
{
var dropAction = new DropAction(unit, item);
dropAction.OnBeforePerform += () => container.containerContent.MoveOut(otherItem, unit);
dropAction.OnAfterPerform += () => container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, item, unit);
var takeAction = new TakeAction(unit, otherItem, sourceSelect.slotUI.slotIndex);
orderChain.Add(dropAction);
orderChain.Add(takeAction);
}
else
{
var dropAction = new DropAction(unit, item);
dropAction.OnAfterPerform += () => container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, item, unit);
orderChain.Add(dropAction);
}
unit.OrderChain(orderChain);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a918e5b15659447fa7c7c43edfeaf895
timeCreated: 1698784406
@@ -0,0 +1,24 @@
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 BackpackToEquipmentDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.EquipmentSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
unit.OrderStop();
unit.Order(new EquipAction(unit, wearable, targetSelect.slotUI.slotIndex));
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8fa7fe6f66f94bd29e7b32b0c897e226
timeCreated: 1698784316
@@ -0,0 +1,51 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class BackpackToOtherUnitBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var otherUnit = GameUI.current.PickComponentUI<OtherUnitBackpackUI>().unit;
unit.OrderStop();
var moveAction = new MoveAction(unit, otherUnit, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
var otherItem = otherUnit.unitBackpack.items[targetSelect.slotUI.slotIndex];
if (otherItem)
{
var dropAction = new DropAction(unit, item);
dropAction.OnAfterPerform += () => new ForcedDropAction(otherUnit, otherItem).DoIt();
orderChain.Add(dropAction);
var canStack = item.CanStackWith(otherItem, out var itemWillBeRemoved);
if (canStack) dropAction.OnAfterPerform += () => item.StackWith(otherItem);
if (!canStack || !itemWillBeRemoved)
{
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, targetSelect.slotUI.slotIndex).DoIt();
orderChain.Add(new TakeAction(unit, otherItem, sourceSelect.slotUI.slotIndex));
}
}
else
{
var dropAction = new DropAction(unit, item);
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, targetSelect.slotUI.slotIndex).DoIt();
orderChain.Add(dropAction);
}
unit.OrderChain(orderChain);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 715441676cf0426997ddf7105a46f32a
timeCreated: 1717963868
@@ -0,0 +1,25 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class BackpackToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.BackpackSlot
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, targetSelect.position, unit.unitData.takeRange));
unit.Order(new DropAction(unit, item, targetSelect.position));
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1c6d639801884d18b380e5b887121275
timeCreated: 1698784050
@@ -0,0 +1,56 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class ContainerToBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ContainerSlot
&& targetSelect.slotUI?.slotType == SlotType.BackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
var container = sourceSelect.slotUI.item.itemState.inContainer;
var sourceIndex = sourceSelect.slotUI.slotIndex;
var targetIndex = targetSelect.slotUI.slotIndex;
if (container.itemState.carriedBy == unit)
{
var otherItem = unit.unitBackpack.items[targetIndex];
container.containerContent.MoveOut(item, unit);
unit.unitBackpack.Take(targetIndex, item);
if (otherItem) container.containerContent.MoveIn(targetIndex, otherItem, unit);
}
else
{
var otherItem = unit.unitBackpack.items[targetIndex];
var moveAction = new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
if (otherItem)
{
var dropAction = new DropAction(unit, otherItem);
var takeAction = new TakeAction(unit, item, targetIndex);
takeAction.OnBeforePerform += () => container.containerContent.MoveOut(item, unit);
takeAction.OnAfterPerform += () => container.containerContent.MoveIn(sourceIndex, otherItem, unit);
orderChain.Add(dropAction);
orderChain.Add(takeAction);
}
else
{
var takeAction = new TakeAction(unit, item, targetIndex);
takeAction.OnBeforePerform += () => container.containerContent.MoveOut(item, unit);
orderChain.Add(takeAction);
}
unit.OrderChain(orderChain);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 76702c7ae83e47dfa9d2a9f0ede91563
timeCreated: 1698785372
@@ -0,0 +1,96 @@
using System.Collections.Generic;
using UnityEngine;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class ContainerToContainerDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ContainerSlot
&& targetSelect.slotUI?.slotType == SlotType.ContainerSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var fromContainer = sourceSelect.slotUI.item.itemState.inContainer;
var fromContainerCarrier = fromContainer.itemState.carriedBy;
var fromIndex = sourceSelect.slotUI.slotIndex;
var toContainer = GameUI.current.PickComponentUI<ContainerUI>().container;
var toContainerCarrier = toContainer.itemState.carriedBy;
var toIndex = targetSelect.slotUI.slotIndex;
if (fromContainer == toContainer)
{
fromContainer.containerContent.Swap(fromIndex, toIndex);
}
else if (fromContainerCarrier == toContainerCarrier)
{
var otherItem = toContainer.containerContent.items[toIndex];
fromContainer.containerContent.MoveOut(item, unit);
if (otherItem) toContainer.containerContent.MoveOut(otherItem, unit);
toContainer.containerContent.MoveIn(toIndex, item, unit);
if (otherItem) fromContainer.containerContent.MoveIn(fromIndex, otherItem, unit);
}
else if (fromContainerCarrier == unit && toContainerCarrier == null)
{
unit.OrderStop();
var moveAction = new MoveAction(unit, toContainer, unit.unitData.takeRange);
var dropAction = new DropAction(unit, item);
dropAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
dropAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
var orderChain = new List<AbstractAction>{ moveAction, dropAction };
var otherItem = toContainer.containerContent.items[toIndex];
if (otherItem)
{
var takeAction = new TakeAction(unit, otherItem, sourceSelect.slotUI.slotIndex);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(otherItem);
takeAction.OnAfterPerform += () => fromContainer.containerContent.MoveIn(fromIndex, otherItem, unit);
orderChain.Add(takeAction);
}
unit.OrderChain(orderChain);
}
else if (fromContainerCarrier == null && toContainerCarrier == unit)
{
unit.OrderStop();
var otherItem = unit.unitBackpack.items[toIndex];
var moveAction = new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
if (otherItem)
{
var dropAction = new DropAction(unit, otherItem);
dropAction.OnBeforePerform += () => toContainer.containerContent.MoveOut(otherItem, unit);
var takeAction = new TakeAction(unit, item);
takeAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(item);
takeAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
takeAction.OnAfterPerform += () => fromContainer.containerContent.MoveIn(fromIndex, otherItem, unit);
orderChain.Add(dropAction);
orderChain.Add(takeAction);
}
else
{
var takeAction = new TakeAction(unit, item, toIndex);
takeAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(item);
takeAction.OnAfterPerform += () => fromContainer.containerContent.MoveOut(item, unit);
orderChain.Add(takeAction);
}
unit.OrderChain(orderChain);
}
else
{
var fromName = fromContainer.basicData.finalName;
var toName = toContainer.basicData.finalName;
Debug.LogWarning($"Dragging between {fromName} -> {toName} not supported!", unit);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 417a87bcf85f44dea63127e220bc37a2
timeCreated: 1698786031
@@ -0,0 +1,40 @@
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 ContainerToEquipmentDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ContainerSlot
&& targetSelect.slotUI?.slotType == SlotType.EquipmentSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
unit.OrderStop();
var container = sourceSelect.slotUI.item.itemState.inContainer;
if (container.itemState.carriedBy == unit)
{
var equipAction = new EquipAction(unit, wearable);
equipAction.OnBeforePerform += () => container.containerContent.MoveOut(wearable, unit);
unit.Order(equipAction);
}
else
{
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var takeAction = new TakeAction(unit, wearable);
takeAction.OnBeforePerform += () => container.containerContent.MoveOut(wearable, unit);
var equipAction = new EquipAction(unit, wearable);
equipAction.runAfterAction = takeAction;
unit.Order(takeAction);
unit.Order(equipAction);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7732a40b30894aeca5551047706b3d4c
timeCreated: 1698785718
@@ -0,0 +1,79 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class ContainerToOtherUnitBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ContainerSlot
&& targetSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var fromContainer = sourceSelect.slotUI.item.itemState.inContainer;
var carriedBy = sourceSelect.slotUI.item.itemState.carriedBy;
var fromIndex = sourceSelect.slotUI.slotIndex;
var toIndex = targetSelect.slotUI.slotIndex;
var otherUnit = GameUI.current.PickComponentUI<OtherUnitBackpackUI>().unit;
var otherItem = otherUnit.unitBackpack.items[toIndex];
if (carriedBy != null)
{
unit.OrderStop();
var orderChain = new List<AbstractAction>();
orderChain.Add(new MoveAction(unit, otherUnit, unit.unitData.takeRange));
var dropAction = new DropAction(unit, item);
dropAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
dropAction.OnBeforePerform += () => unit.unitBackpack.Take(item);
orderChain.Add(dropAction);
if (otherItem)
{
var takeAction = new TakeAction(unit, otherItem, sourceSelect.slotUI.slotIndex);
takeAction.OnBeforePerform += () => new ForcedDropAction(otherUnit, otherItem).DoIt();
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(otherItem);
takeAction.OnAfterPerform += () => fromContainer.containerContent.MoveIn(fromIndex, otherItem, unit);
takeAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, toIndex).DoIt();
orderChain.Add(takeAction);
}
else
{
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, toIndex).DoIt();
}
unit.OrderChain(orderChain);
}
else if (carriedBy == null)
{
unit.OrderStop();
var moveAction = new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
if (otherItem)
{
var moveItemAction = new MoveItemAction(unit, item, otherUnit.transform.position);
moveItemAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(otherUnit, otherItem).DoIt();
moveItemAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, toIndex).DoIt();
moveItemAction.OnAfterPerform += () => fromContainer.containerContent.MoveIn(fromIndex, otherItem, unit);
orderChain.Add(moveItemAction);
}
else
{
var moveItemAction = new MoveItemAction(unit, item, otherUnit.transform.position);
moveItemAction.OnBeforePerform += () => fromContainer.containerContent.MoveOut(item, unit);
moveItemAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, toIndex).DoIt();
orderChain.Add(moveItemAction);
}
unit.OrderChain(orderChain);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: afc596d37ace4ab69f58589a6b4b3a1c
timeCreated: 1718033491
@@ -0,0 +1,42 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class ContainerToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.ContainerSlot
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
var container = sourceSelect.slotUI.item.itemState.inContainer;
if (container.itemState.carriedBy == unit)
{
unit.Order(new MoveAction(unit, targetSelect.position, unit.unitData.takeRange));
var dropAction = new DropAction(unit, item);
dropAction.OnBeforePerform += () => container.containerContent.MoveOut(item, unit);
dropAction.OnBeforePerform += () => unit.unitBackpack.Take(item);
var moveItemAction = new MoveItemAction(unit, item, targetSelect.position);
moveItemAction.runAfterAction = dropAction;
unit.Order(dropAction);
unit.Order(moveItemAction);
}
else
{
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var moveItemAction = new MoveItemAction(unit, item, targetSelect.position);
moveItemAction.OnBeforePerform += () => container.containerContent.MoveOut(item, unit);
unit.Order(moveItemAction);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5a84d1f27e714c4a822c7144f9f54a0d
timeCreated: 1698785210
@@ -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);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d8b3e528d0744c15a772c0c5337527fa
timeCreated: 1698784995
@@ -0,0 +1,44 @@
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;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class EquipmentToContainerDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.EquipmentSlot
&& targetSelect.slotUI?.slotType == SlotType.ContainerSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
unit.OrderStop();
var container = targetSelect.containerUI.container;
if (container.itemState.carriedBy == unit)
{
var unEquipAction = new UnEquipAction(unit, wearable);
unEquipAction.OnAfterPerform += () =>
container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, wearable, unit);
unit.Order(unEquipAction);
}
else
{
unit.Order(new MoveAction(unit, targetSelect.position, unit.unitData.takeRange));
var dropAction = new DropAction(unit, wearable);
var moveItemAction = new MoveItemAction(unit, wearable, container.transform.position);
moveItemAction.runAfterAction = dropAction;
moveItemAction.OnAfterPerform += () =>
container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, wearable, unit);
unit.Order(dropAction);
unit.Order(moveItemAction);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 47f70dcfb78941dca1a8943275501788
timeCreated: 1698785122
@@ -0,0 +1,33 @@
using System.Collections.Generic;
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 EquipmentToEquipmentDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.EquipmentSlot
&& targetSelect.slotUI?.slotType == SlotType.EquipmentSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
if (sourceSelect.slotUI.slotIndex == targetSelect.slotUI.slotIndex) return;
if (!unit.unitEquipment.CanEquipInSlot(targetSelect.slotUI.slotIndex, wearable)) return;
unit.OrderStop();
var orderChain = new List<AbstractAction>();
var otherItem = targetSelect.slotUI.item as WearableObject;
if (otherItem) orderChain.Add(new UnEquipAction(unit, otherItem));
orderChain.Add(new UnEquipAction(unit, wearable));
if (otherItem) orderChain.Add(new EquipAction(unit, otherItem, sourceSelect.slotUI.slotIndex));
orderChain.Add(new EquipAction(unit, wearable, targetSelect.slotUI.slotIndex));
unit.OrderChain(orderChain);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a66f7a7673d94067a286fb2a72ed4f47
timeCreated: 1698785061
@@ -0,0 +1,37 @@
using System.Collections.Generic;
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;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class EquipmentToOtherUnitBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.EquipmentSlot
&& targetSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
unit.OrderStop();
var otherUnit = GameUI.current.PickComponentUI<OtherUnitBackpackUI>().unit;
var orderChain = new List<AbstractAction>();
orderChain.Add(new MoveAction(unit, targetSelect.position, unit.unitData.takeRange));
var dropAction = new DropAction(unit, wearable);
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, wearable, targetSelect.slotUI.slotIndex).DoIt();
orderChain.Add(dropAction);
unit.OrderChain(orderChain);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 26d992915bbd4c59b9ebbe95975f3bc0
timeCreated: 1718031952
@@ -0,0 +1,30 @@
using System.Collections.Generic;
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 EquipmentToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.EquipmentSlot
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not WearableObject wearable) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, targetSelect.position, unit.unitData.takeRange));
unit.OrderChain(new List<AbstractAction>
{
new UnEquipAction(unit, wearable),
new DropAction(unit, wearable, targetSelect.position)
});
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 27be82d70f594b0a9d6175de70fe6596
timeCreated: 1698784802
@@ -0,0 +1,35 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
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 OtherUnitBackpackToBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.BackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject otherItem) return;
var otherUnit = otherItem.itemState.carriedBy;
var thisItem = targetSelect.slotUI.item;
unit.OrderStop();
var moveAction = new MoveAction(unit, otherUnit, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
var takeAction = new TakeAction(unit, otherItem, targetSelect.slotUI.slotIndex);
if (thisItem && otherItem.CanStackWith(thisItem))
takeAction.OnAfterPerform += () => otherItem.StackWith(thisItem);
orderChain.Add(takeAction);
unit.OrderChain(orderChain);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: eaf6bc7196e74b768a4f75aa8de10664
timeCreated: 1718038380
@@ -0,0 +1,86 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class OtherUnitBackpackToContainerDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.ContainerSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var toContainer = GameUI.current.PickComponentUI<ContainerUI>().container;
var toContainerCarrier = toContainer.itemState.carriedBy;
var fromIndex = sourceSelect.slotUI.slotIndex;
var toIndex = targetSelect.slotUI.slotIndex;
var otherUnit = item.itemState.carriedBy;
var otherItem = toContainer.containerContent.items[toIndex];
if (toContainerCarrier != null)
{
unit.OrderStop();
var orderChain = new List<AbstractAction>();
orderChain.Add(new MoveAction(unit, otherUnit, unit.unitData.takeRange));
if (otherItem)
{
var takeAction = new TakeAction(unit, item);
takeAction.OnAfterPerform += () => toContainer.containerContent.MoveOut(otherItem, unit);
takeAction.OnAfterPerform += () => unit.unitBackpack.Take(otherItem);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(item);
takeAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
var dropAction = new DropAction(unit, otherItem);
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, otherItem).DoIt();
orderChain.Add(takeAction);
orderChain.Add(dropAction);
}
else
{
var takeAction = new TakeAction(unit, item);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(item);
takeAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
orderChain.Add(takeAction);
}
unit.OrderChain(orderChain);
}
else if (toContainerCarrier == null)
{
unit.OrderStop();
var moveAction = new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange);
var orderChain = new List<AbstractAction> { moveAction };
if (otherItem)
{
var moveItemAction = new MoveItemAction(unit, item, toContainer.transform.position);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(otherUnit, item).DoIt();
moveItemAction.OnAfterPerform += () => toContainer.containerContent.MoveOut(otherItem, unit);
moveItemAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
moveItemAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, otherItem, fromIndex).DoIt();
orderChain.Add(moveItemAction);
}
else
{
var moveItemAction = new MoveItemAction(unit, item, toContainer.transform.position);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(otherUnit, item).DoIt();
moveItemAction.OnAfterPerform += () => toContainer.containerContent.MoveIn(toIndex, item, unit);
orderChain.Add(moveItemAction);
}
unit.OrderChain(orderChain);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 25c8a7fb404c410e9e47bc5324b6250b
timeCreated: 1718040161
@@ -0,0 +1,47 @@
using System.Collections.Generic;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
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 OtherUnitBackpackToEquipmentDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.EquipmentSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
var otherUnit = item.itemState.carriedBy;
var fromIndex = sourceSelect.slotUI.slotIndex;
var toIndex = targetSelect.slotUI.slotIndex;
var otherWearable = unit.unitEquipment.GetEquipped(toIndex);
unit.OrderStop();
var orderChain = new List<AbstractAction>();
orderChain.Add(new MoveAction(unit, otherUnit, unit.unitData.takeRange));
orderChain.Add(new TakeAction(unit, item));
if (otherWearable)
{
var dropAction = new DropAction(unit, otherWearable);
dropAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, fromIndex).DoIt();
orderChain.Add(dropAction);
}
if (item is WearableObject wearable)
{
orderChain.Add(new EquipAction(unit, wearable, targetSelect.slotUI.slotIndex));
}
unit.OrderChain(orderChain);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b4e62c66a06455e92d726822af1e02b
timeCreated: 1718039368
@@ -0,0 +1,50 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class OtherUnitBackpackToOtherUnitBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot
&& targetSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject fromItem) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var fromDeadUnit = fromItem.itemState.carriedBy;
var toDeadUnit = GameUI.current.PickComponentUI<OtherUnitBackpackUI>().unit;
var fromIndex = sourceSelect.slotUI.slotIndex;
var toIndex = targetSelect.slotUI.slotIndex;
var toItem = toDeadUnit.unitBackpack.items[toIndex];
if (toItem)
{
var moveItemAction = new MoveItemAction(unit, fromItem, toDeadUnit.transform.position);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(fromDeadUnit, fromItem).DoIt();
moveItemAction.OnBeforePerform += () => new ForcedDropAction(toDeadUnit, toItem).DoIt();
var canStack = fromItem.CanStackWith(toItem, out var itemWillBeRemoved);
if (canStack) moveItemAction.OnBeforePerform += () => fromItem.StackWith(toItem);
moveItemAction.OnAfterPerform += () => new ForcedTakeAction(toDeadUnit, fromItem, toIndex).DoIt();
if (!itemWillBeRemoved) moveItemAction.OnAfterPerform += () => new ForcedTakeAction(fromDeadUnit, toItem, fromIndex).DoIt();
unit.Order(moveItemAction);
}
else
{
var moveItemAction = new MoveItemAction(unit, fromItem, toDeadUnit.transform.position);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(fromDeadUnit, fromItem).DoIt();
moveItemAction.OnAfterPerform += () => new ForcedTakeAction(toDeadUnit, fromItem, toIndex).DoIt();
unit.Order(moveItemAction);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81f800d435364c459cab3e01c4236c58
timeCreated: 1718043824
@@ -0,0 +1,29 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class OtherUnitBackpackToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var otherUnit = item.itemState.carriedBy;
var moveItemAction = new MoveItemAction(unit, item, targetSelect.position);
moveItemAction.OnBeforePerform += () => new ForcedDropAction(otherUnit, item).DoIt();
unit.Order(moveItemAction);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 38ede8e0c3df41d8a47e74d72e55bb02
timeCreated: 1718037826
@@ -0,0 +1,29 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Objects.Usable;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class SceneToActionBarDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == SlotType.ActionBarSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var takeAction = new TakeAction(unit, item);
if (sourceSelect.selectObject is UsableObject usable)
takeAction.OnAfterPerform += () => unit.unitActionBar.Set(targetSelect.slotUI.slotIndex, usable);
unit.Order(takeAction);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5f69b5ebe04f440c9469f4d782068417
timeCreated: 1698783893
@@ -0,0 +1,29 @@
using System;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class SceneToBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == SlotType.BackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var takeAction = new TakeAction(unit, item);
takeAction.OnAfterPerform += () =>
unit.unitBackpack.Swap(Array.IndexOf(unit.unitBackpack.items, item), targetSelect.slotUI.slotIndex);
unit.Order(takeAction);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 46c073e148f34906b94428dc5701449b
timeCreated: 1698783569
@@ -0,0 +1,42 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class SceneToContainerDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == SlotType.ContainerSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var container = GameUI.current.PickComponentUI<ContainerUI>().container;
if (container.itemState.carriedBy == unit)
{
var takeAction = new TakeAction(unit, item);
takeAction.OnAfterPerform += () => unit.unitBackpack.Drop(item);
takeAction.OnAfterPerform += () =>
container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, item, unit);
unit.Order(takeAction);
}
else
{
var moveAction = new MoveItemAction(unit, item, container.transform.position);
moveAction.OnAfterPerform += () =>
container.containerContent.MoveIn(targetSelect.slotUI.slotIndex, item, unit);
unit.Order(moveAction);
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3b905f13c67c42068ca94b4729afbb66
timeCreated: 1698783960
@@ -0,0 +1,31 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
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 SceneToEquipmentDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == SlotType.EquipmentSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var takeAction = new TakeAction(unit, item);
unit.Order(takeAction);
if (sourceSelect.selectObject is not WearableObject wearable) return;
var equipAction = new EquipAction(unit, wearable);
equipAction.runAfterAction = takeAction;
unit.Order(equipAction);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3312e4749bd94a94a67b79c9d0afdf32
timeCreated: 1698783820
@@ -0,0 +1,31 @@
using VOID.Generic.Dict;
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
using VOID.UserInterface;
using VOID.UserInterface.Game;
namespace VOID.Generic.Player.DraggingOperation
{
public class SceneToOtherUnitBackpackDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == SlotType.OtherUnitBackpackSlot;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
var otherUnit = GameUI.current.PickComponentUI<OtherUnitBackpackUI>().unit;
var moveAction = new MoveItemAction(unit, item, otherUnit.transform.position);
moveAction.OnAfterPerform += () => new ForcedTakeAction(otherUnit, item, targetSelect.slotUI.slotIndex).DoIt();
unit.Order(moveAction);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9385b685493d436187c735c921884f15
timeCreated: 1717970430
@@ -0,0 +1,24 @@
using VOID.Generic.Objects.Item;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Unit.Actions;
using VOID.Generic.Player.Util;
namespace VOID.Generic.Player.DraggingOperation
{
public class SceneToSceneDraggingOperation : AbstractDraggingOperation
{
public override bool Check(SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
return sourceSelect.slotUI?.slotType == null
&& targetSelect.slotUI?.slotType == null;
}
public override void Perform(UnitObject unit, SelectUtilResult sourceSelect, SelectUtilResult targetSelect)
{
if (sourceSelect.selectObject is not ItemObject item) return;
unit.OrderStop();
unit.Order(new MoveAction(unit, sourceSelect.position, unit.unitData.takeRange));
unit.Order(new MoveItemAction(unit, item, targetSelect.position));
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 532ed242e6534be3b4ef0a34d1ed3ce5
timeCreated: 1698780991