new hotkey to center your view on the current selection
This commit is contained in:
@@ -125,7 +125,8 @@ namespace OpenRA.GameRules
|
||||
public string PauseKey = "f3";
|
||||
|
||||
public string CycleBaseKey = "backspace";
|
||||
public string GotoLastEventKey = "space";
|
||||
public string ToLastEventKey = "space";
|
||||
public string ToSelectionKey = "home";
|
||||
public string SellKey = "v";
|
||||
public string PowerDownKey = "b";
|
||||
public string RepairKey = "n";
|
||||
|
||||
@@ -137,9 +137,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
specialHotkeyList.AddChild(viewportToBase);
|
||||
|
||||
var lastEventKey = ScrollItemWidget.Setup(specialHotkeyTemplate, () => false, () => {});
|
||||
SetupKeyBinding(lastEventKey, "Move Viewport to Last Event:", () => keyConfig.GotoLastEventKey, k => keyConfig.GotoLastEventKey = k);
|
||||
SetupKeyBinding(lastEventKey, "Move Viewport to Last Event:", () => keyConfig.ToLastEventKey, k => keyConfig.ToLastEventKey = k);
|
||||
specialHotkeyList.AddChild(lastEventKey);
|
||||
|
||||
var viewportToSelectionKey = ScrollItemWidget.Setup(specialHotkeyTemplate, () => false, () => {});
|
||||
SetupKeyBinding(viewportToSelectionKey, "Move Viewport to Selection:", () => keyConfig.ToSelectionKey, k => keyConfig.ToSelectionKey = k);
|
||||
specialHotkeyList.AddChild(viewportToSelectionKey);
|
||||
|
||||
var sellKey = ScrollItemWidget.Setup(specialHotkeyTemplate, () => false, () => {});
|
||||
SetupKeyBinding(sellKey, "Switch to Sell-Cursor:", () => keyConfig.SellKey, k => keyConfig.SellKey = k);
|
||||
specialHotkeyList.AddChild(sellKey);
|
||||
|
||||
@@ -47,8 +47,11 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
if (e.KeyName == Game.Settings.Keys.CycleBaseKey)
|
||||
return CycleBases();
|
||||
|
||||
if (e.KeyName == Game.Settings.Keys.GotoLastEventKey)
|
||||
return GotoLastEvent();
|
||||
if (e.KeyName == Game.Settings.Keys.ToLastEventKey)
|
||||
return ToLastEvent();
|
||||
|
||||
if (e.KeyName == Game.Settings.Keys.ToSelectionKey)
|
||||
return ToSelection();
|
||||
|
||||
if (e.KeyName == Game.Settings.Keys.SellKey)
|
||||
return PerformSwitchToSellMode();
|
||||
@@ -168,11 +171,11 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
next = bases.Select(b => b.Actor).First();
|
||||
|
||||
World.Selection.Combine(World, new Actor[] { next }, false, true);
|
||||
Game.viewport.Center(World.Selection.Actors);
|
||||
return true;
|
||||
|
||||
return ToSelection();
|
||||
}
|
||||
|
||||
bool GotoLastEvent()
|
||||
bool ToLastEvent()
|
||||
{
|
||||
if (World.LocalPlayer == null)
|
||||
return true;
|
||||
@@ -188,6 +191,12 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ToSelection()
|
||||
{
|
||||
Game.viewport.Center(World.Selection.Actors);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PerformSwitchToSellMode()
|
||||
{
|
||||
World.ToggleInputMode<SellOrderGenerator>();
|
||||
|
||||
Reference in New Issue
Block a user