Move remaining hardcoded selection power keys into yaml.

This commit is contained in:
Paul Chote
2017-09-03 18:56:56 +00:00
committed by reaperrr
parent 83d522d945
commit e04ae9aa2c
3 changed files with 9 additions and 2 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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