Move remaining hardcoded selection power keys into yaml.
This commit is contained in:
@@ -22,6 +22,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
public class WorldInteractionControllerWidget : Widget
|
public class WorldInteractionControllerWidget : Widget
|
||||||
{
|
{
|
||||||
|
public readonly NamedHotkey SelectAllKey = new NamedHotkey();
|
||||||
|
public readonly NamedHotkey SelectSameTypeKey = new NamedHotkey();
|
||||||
|
|
||||||
protected readonly World World;
|
protected readonly World World;
|
||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
int2 dragStart, mousePos;
|
int2 dragStart, mousePos;
|
||||||
@@ -242,7 +245,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
var key = Hotkey.FromKeyInput(e);
|
var key = Hotkey.FromKeyInput(e);
|
||||||
|
|
||||||
if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver)
|
if (key == SelectAllKey.GetValue() && !World.IsGameOver)
|
||||||
{
|
{
|
||||||
// Select actors on the screen which belong to the current player
|
// Select actors on the screen which belong to the current player
|
||||||
var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority().ToList();
|
var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority().ToList();
|
||||||
@@ -259,7 +262,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
World.Selection.Combine(World, ownUnitsOnScreen, false, false);
|
World.Selection.Combine(World, ownUnitsOnScreen, false, false);
|
||||||
}
|
}
|
||||||
else if (key == Game.Settings.Keys.SelectUnitsByTypeKey && !World.IsGameOver)
|
else if (key == SelectSameTypeKey.GetValue() && !World.IsGameOver)
|
||||||
{
|
{
|
||||||
if (!World.Selection.Actors.Any())
|
if (!World.Selection.Actors.Any())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ Container@INGAME_ROOT:
|
|||||||
WorldInteractionController@INTERACTION_CONTROLLER:
|
WorldInteractionController@INTERACTION_CONTROLLER:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
|
SelectAllKey: SelectAllUnits
|
||||||
|
SelectSameTypeKey: SelectUnitsByType
|
||||||
ViewportController:
|
ViewportController:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ Container@INGAME_ROOT:
|
|||||||
WorldInteractionController@INTERACTION_CONTROLLER:
|
WorldInteractionController@INTERACTION_CONTROLLER:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
|
SelectAllKey: SelectAllUnits
|
||||||
|
SelectSameTypeKey: SelectUnitsByType
|
||||||
ViewportController:
|
ViewportController:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
|
|||||||
Reference in New Issue
Block a user