Add hotkey configuration for scroll keys
This commit is contained in:
committed by
Oliver Brakmann
parent
044e562457
commit
86c57a270b
@@ -190,6 +190,11 @@ namespace OpenRA
|
|||||||
public Hotkey SelectAllUnitsKey = new Hotkey(Keycode.Q, Modifiers.None);
|
public Hotkey SelectAllUnitsKey = new Hotkey(Keycode.Q, Modifiers.None);
|
||||||
public Hotkey SelectUnitsByTypeKey = new Hotkey(Keycode.W, Modifiers.None);
|
public Hotkey SelectUnitsByTypeKey = new Hotkey(Keycode.W, Modifiers.None);
|
||||||
|
|
||||||
|
public Hotkey MapScrollUp = new Hotkey(Keycode.UP, Modifiers.None);
|
||||||
|
public Hotkey MapScrollDown = new Hotkey(Keycode.DOWN, Modifiers.None);
|
||||||
|
public Hotkey MapScrollLeft = new Hotkey(Keycode.LEFT, Modifiers.None);
|
||||||
|
public Hotkey MapScrollRight = new Hotkey(Keycode.RIGHT, Modifiers.None);
|
||||||
|
|
||||||
public Hotkey PauseKey = new Hotkey(Keycode.PAUSE, Modifiers.None);
|
public Hotkey PauseKey = new Hotkey(Keycode.PAUSE, Modifiers.None);
|
||||||
public Hotkey PlaceBeaconKey = new Hotkey(Keycode.B, Modifiers.None);
|
public Hotkey PlaceBeaconKey = new Hotkey(Keycode.B, Modifiers.None);
|
||||||
public Hotkey SellKey = new Hotkey(Keycode.Z, Modifiers.None);
|
public Hotkey SellKey = new Hotkey(Keycode.Z, Modifiers.None);
|
||||||
|
|||||||
@@ -410,6 +410,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
{ "ToggleStatusBarsKey", "Toggle status bars" },
|
{ "ToggleStatusBarsKey", "Toggle status bars" },
|
||||||
{ "TogglePixelDoubleKey", "Toggle pixel doubling" },
|
{ "TogglePixelDoubleKey", "Toggle pixel doubling" },
|
||||||
|
|
||||||
|
{ "MapScrollUp", "Map scroll up" },
|
||||||
|
{ "MapScrollDown", "Map scroll down" },
|
||||||
|
{ "MapScrollLeft", "Map scroll left" },
|
||||||
|
{ "MapScrollRight", "Map scroll right" }
|
||||||
};
|
};
|
||||||
|
|
||||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||||
|
|||||||
@@ -222,12 +222,31 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public override bool HandleKeyPress(KeyInput e)
|
public override bool HandleKeyPress(KeyInput e)
|
||||||
{
|
{
|
||||||
switch (e.Key)
|
var key = Hotkey.FromKeyInput(e);
|
||||||
|
var ks = Game.Settings.Keys;
|
||||||
|
|
||||||
|
if (key == ks.MapScrollUp)
|
||||||
{
|
{
|
||||||
case Keycode.UP: keyboardDirections = keyboardDirections.Set(ScrollDirection.Up, e.Event == KeyInputEvent.Down); return true;
|
keyboardDirections = keyboardDirections.Set(ScrollDirection.Up, e.Event == KeyInputEvent.Down);
|
||||||
case Keycode.DOWN: keyboardDirections = keyboardDirections.Set(ScrollDirection.Down, e.Event == KeyInputEvent.Down); return true;
|
return true;
|
||||||
case Keycode.LEFT: keyboardDirections = keyboardDirections.Set(ScrollDirection.Left, e.Event == KeyInputEvent.Down); return true;
|
}
|
||||||
case Keycode.RIGHT: keyboardDirections = keyboardDirections.Set(ScrollDirection.Right, e.Event == KeyInputEvent.Down); return true;
|
|
||||||
|
if (key == ks.MapScrollDown)
|
||||||
|
{
|
||||||
|
keyboardDirections = keyboardDirections.Set(ScrollDirection.Down, e.Event == KeyInputEvent.Down);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == ks.MapScrollLeft)
|
||||||
|
{
|
||||||
|
keyboardDirections = keyboardDirections.Set(ScrollDirection.Left, e.Event == KeyInputEvent.Down);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == ks.MapScrollRight)
|
||||||
|
{
|
||||||
|
keyboardDirections = keyboardDirections.Set(ScrollDirection.Right, e.Event == KeyInputEvent.Down);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user