Fix IDE0032

This commit is contained in:
RoosterDragon
2023-02-19 11:19:28 +00:00
committed by Pavel Penev
parent e64c0a35c5
commit 98c4eaca83
52 changed files with 460 additions and 567 deletions

View File

@@ -121,10 +121,9 @@ namespace OpenRA.Mods.Common.Traits
readonly SpawnActorPower power;
readonly SpawnActorPowerInfo info;
readonly SupportPowerManager manager;
readonly string order;
readonly MouseButton expectedButton;
public string OrderKey { get { return order; } }
public string OrderKey { get; }
public SelectSpawnActorPowerTarget(string order, SupportPowerManager manager, SpawnActorPower power, MouseButton button)
{
@@ -134,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits
this.manager = manager;
this.power = power;
this.order = order;
OrderKey = order;
expectedButton = button;
info = (SpawnActorPowerInfo)power.Info;
@@ -148,13 +147,13 @@ namespace OpenRA.Mods.Common.Traits
yield break;
if (mi.Button == expectedButton)
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
yield return new Order(OrderKey, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
}
protected override void Tick(World world)
{
// Cancel the OG if we can't use the power
if (!manager.Powers.ContainsKey(order))
if (!manager.Powers.ContainsKey(OrderKey))
world.CancelInputMode();
}

View File

@@ -279,11 +279,10 @@ namespace OpenRA.Mods.Common.Traits
public class SelectGenericPowerTarget : OrderGenerator
{
readonly SupportPowerManager manager;
readonly string order;
readonly string cursor;
readonly MouseButton expectedButton;
public string OrderKey => order;
public string OrderKey { get; }
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
{
@@ -292,7 +291,7 @@ namespace OpenRA.Mods.Common.Traits
manager.Self.World.Selection.Clear();
this.manager = manager;
this.order = order;
OrderKey = order;
this.cursor = cursor;
expectedButton = button;
}
@@ -301,13 +300,13 @@ namespace OpenRA.Mods.Common.Traits
{
world.CancelInputMode();
if (mi.Button == expectedButton && world.Map.Contains(cell))
yield return new Order(order, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
yield return new Order(OrderKey, manager.Self, Target.FromCell(world, cell), false) { SuppressVisualFeedback = true };
}
protected override void Tick(World world)
{
// Cancel the OG if we can't use the power
if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready)
if (!manager.Powers.TryGetValue(OrderKey, out var p) || !p.Active || !p.Ready)
world.CancelInputMode();
}