Replace MouseButtonPreference with MouseActionType.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
c588c3ef8d
commit
962e7e911d
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
TextNotificationsManager.AddTransientLine(manager.Self.Owner, Info.SelectTargetTextNotification);
|
||||
|
||||
self.World.OrderGenerator = new SelectSpawnActorPowerTarget(order, manager, this, MouseButton.Left);
|
||||
self.World.OrderGenerator = new SelectSpawnActorPowerTarget(order, manager, this);
|
||||
}
|
||||
|
||||
public bool Validate(World world, SpawnActorPowerInfo info, CPos cell)
|
||||
@@ -122,23 +122,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class SelectSpawnActorPowerTarget : OrderGenerator
|
||||
{
|
||||
protected override MouseActionType ActionType => MouseActionType.SupportPower;
|
||||
readonly SpawnActorPower power;
|
||||
readonly SpawnActorPowerInfo info;
|
||||
readonly SupportPowerManager manager;
|
||||
readonly MouseButton expectedButton;
|
||||
|
||||
public string OrderKey { get; }
|
||||
|
||||
public SelectSpawnActorPowerTarget(string order, SupportPowerManager manager, SpawnActorPower power, MouseButton button)
|
||||
public SelectSpawnActorPowerTarget(string order, SupportPowerManager manager, SpawnActorPower power)
|
||||
: base(manager.Self.World)
|
||||
{
|
||||
// Clear selection if using Left-Click Orders
|
||||
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||
manager.Self.World.Selection.Clear();
|
||||
|
||||
this.manager = manager;
|
||||
this.power = power;
|
||||
OrderKey = order;
|
||||
expectedButton = button;
|
||||
|
||||
info = (SpawnActorPowerInfo)power.Info;
|
||||
}
|
||||
@@ -146,11 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected override IEnumerable<Order> OrderInner(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
{
|
||||
world.CancelInputMode();
|
||||
|
||||
if (!power.Validate(world, info, cell))
|
||||
yield break;
|
||||
|
||||
if (mi.Button == expectedButton)
|
||||
if (power.Validate(world, info, cell))
|
||||
yield return new Order(OrderKey, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user