Keep Attack M./Guard action while holding hotkey (revert Playtest change)
This commit is contained in:
@@ -10,13 +10,10 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Mods.Common.Orders;
|
using OpenRA.Mods.Common.Orders;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Orders;
|
using OpenRA.Orders;
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
@@ -58,14 +55,20 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
attackMoveButton.IsHighlighted = () => world.OrderGenerator is GenericSelectTarget
|
attackMoveButton.IsHighlighted = () => world.OrderGenerator is GenericSelectTarget
|
||||||
&& ((GenericSelectTarget)world.OrderGenerator).OrderName == "AttackMove";
|
&& ((GenericSelectTarget)world.OrderGenerator).OrderName == "AttackMove";
|
||||||
|
|
||||||
attackMoveButton.OnClick = () =>
|
Action<bool> toggle = allowCancel =>
|
||||||
{
|
{
|
||||||
if (attackMoveButton.IsHighlighted())
|
if (attackMoveButton.IsHighlighted())
|
||||||
world.CancelInputMode();
|
{
|
||||||
|
if (allowCancel)
|
||||||
|
world.CancelInputMode();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
world.OrderGenerator = new GenericSelectTarget(selectedActors,
|
world.OrderGenerator = new GenericSelectTarget(selectedActors,
|
||||||
"AttackMove", "attackmove", Game.Settings.Game.MouseButtonPreference.Action);
|
"AttackMove", "attackmove", Game.Settings.Game.MouseButtonPreference.Action);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
attackMoveButton.OnClick = () => toggle(true);
|
||||||
|
attackMoveButton.OnKeyPress = _ => toggle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var forceMoveButton = widget.GetOrNull<ButtonWidget>("FORCE_MOVE");
|
var forceMoveButton = widget.GetOrNull<ButtonWidget>("FORCE_MOVE");
|
||||||
@@ -110,14 +113,20 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
guardButton.IsHighlighted = () => world.OrderGenerator is GenericSelectTarget
|
guardButton.IsHighlighted = () => world.OrderGenerator is GenericSelectTarget
|
||||||
&& ((GenericSelectTarget)world.OrderGenerator).OrderName == "Guard";
|
&& ((GenericSelectTarget)world.OrderGenerator).OrderName == "Guard";
|
||||||
|
|
||||||
guardButton.OnClick = () =>
|
Action<bool> toggle = allowCancel =>
|
||||||
{
|
{
|
||||||
if (guardButton.IsHighlighted())
|
if (guardButton.IsHighlighted())
|
||||||
world.CancelInputMode();
|
{
|
||||||
|
if (allowCancel)
|
||||||
|
world.CancelInputMode();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
world.OrderGenerator = new GuardOrderGenerator(selectedActors,
|
world.OrderGenerator = new GuardOrderGenerator(selectedActors,
|
||||||
"Guard", "guard", Game.Settings.Game.MouseButtonPreference.Action);
|
"Guard", "guard", Game.Settings.Game.MouseButtonPreference.Action);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
guardButton.OnClick = () => toggle(true);
|
||||||
|
guardButton.OnKeyPress = _ => toggle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var scatterButton = widget.GetOrNull<ButtonWidget>("SCATTER");
|
var scatterButton = widget.GetOrNull<ButtonWidget>("SCATTER");
|
||||||
|
|||||||
@@ -270,7 +270,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Width: 34
|
Width: 34
|
||||||
Height: 34
|
Height: 34
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Attack Move
|
TooltipText: Attack Move
|
||||||
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
||||||
@@ -321,7 +320,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Width: 34
|
Width: 34
|
||||||
Height: 34
|
Height: 34
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Guard
|
TooltipText: Guard
|
||||||
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Height: 41
|
Height: 41
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Attack Move
|
TooltipText: Attack Move
|
||||||
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
||||||
@@ -94,7 +93,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Height: 41
|
Height: 41
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Guard
|
TooltipText: Guard
|
||||||
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Height: 26
|
Height: 26
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Attack Move
|
TooltipText: Attack Move
|
||||||
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
TooltipDesc: Selected units will move to the desired location\nand attack any enemies they encounter en route.\n\nLeft-click icon then right-click on target location.
|
||||||
@@ -103,7 +102,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
Height: 26
|
Height: 26
|
||||||
VisualHeight: 0
|
VisualHeight: 0
|
||||||
Background: command-button
|
Background: command-button
|
||||||
DisableKeyRepeat: true
|
|
||||||
DisableKeySound: true
|
DisableKeySound: true
|
||||||
TooltipText: Guard
|
TooltipText: Guard
|
||||||
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
TooltipDesc: Selected units will follow the targeted unit.\n\nLeft-click icon then right-click on target unit.
|
||||||
|
|||||||
Reference in New Issue
Block a user