Replace MouseButtonPreference with MouseActionType.

This commit is contained in:
Paul Chote
2025-12-15 20:30:26 +00:00
committed by Gustas Kažukauskas
parent c588c3ef8d
commit 962e7e911d
27 changed files with 212 additions and 246 deletions

View File

@@ -20,27 +20,25 @@ namespace OpenRA.Mods.Common.Orders
{
readonly string orderName;
readonly string cursor;
readonly MouseButton expectedButton;
IEnumerable<Actor> subjects;
protected override MouseActionType ActionType => MouseActionType.ConfirmOrder;
public GuardOrderGenerator(IEnumerable<Actor> subjects, string order, string cursor, MouseButton button)
public GuardOrderGenerator(World world, IEnumerable<Actor> subjects, string order, string cursor)
: base(world)
{
orderName = order;
this.cursor = cursor;
expectedButton = button;
this.subjects = subjects;
}
public override IEnumerable<Order> Order(World world, CPos cell, int2 worldPixel, MouseInput mi)
{
if (mi.Button != expectedButton)
if (mi.Button != ActionButton)
{
world.CancelInputMode();
yield break;
}
return OrderInner(world, mi);
}
IEnumerable<Order> OrderInner(World world, MouseInput mi)
{
var target = FriendlyGuardableUnits(world, mi).FirstOrDefault();
if (target == null)
yield break;