Split unrelated hotkeys from WorldInteractionController.

This commit is contained in:
Paul Chote
2017-09-07 18:20:37 +00:00
committed by reaperrr
parent 0e3bfcfb35
commit 83d522d945
10 changed files with 175 additions and 49 deletions

View File

@@ -242,10 +242,7 @@ namespace OpenRA.Mods.Common.Widgets
{
var key = Hotkey.FromKeyInput(e);
if (key == Game.Settings.Keys.PauseKey
&& (Game.IsHost || (World.LocalPlayer != null && World.LocalPlayer.WinState != WinState.Lost))) // Disable pausing for spectators and defeated players
World.SetPauseState(!World.Paused);
else if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver)
if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver)
{
// Select actors on the screen which belong to the current player
var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority().ToList();
@@ -288,12 +285,6 @@ namespace OpenRA.Mods.Common.Widgets
World.Selection.Combine(World, newSelection, true, false);
}
else if (key == Game.Settings.Keys.CycleStatusBarsKey)
return CycleStatusBars();
else if (key == Game.Settings.Keys.TogglePixelDoubleKey)
return TogglePixelDouble();
else if (key == Game.Settings.Keys.TogglePlayerStanceColorsKey)
return TogglePlayerStanceColors();
}
return false;
@@ -333,40 +324,5 @@ namespace OpenRA.Mods.Common.Widgets
.Where(x => x.Info.HasTraitInfo<SelectableInfo>() && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)))
.SubsetWithHighestSelectionPriority();
}
bool CycleStatusBars()
{
if (Game.Settings.Game.StatusBars == StatusBarsType.Standard)
Game.Settings.Game.StatusBars = StatusBarsType.DamageShow;
else if (Game.Settings.Game.StatusBars == StatusBarsType.DamageShow)
Game.Settings.Game.StatusBars = StatusBarsType.AlwaysShow;
else if (Game.Settings.Game.StatusBars == StatusBarsType.AlwaysShow)
Game.Settings.Game.StatusBars = StatusBarsType.Standard;
return true;
}
bool TogglePixelDouble()
{
if (worldRenderer.Viewport.Zoom == 1f)
worldRenderer.Viewport.Zoom = 2f;
else
{
// Reset zoom to regular view if it was anything else before
// (like a zoom level only reachable by using the scroll wheel).
worldRenderer.Viewport.Zoom = 1f;
}
Game.Settings.Graphics.PixelDouble = worldRenderer.Viewport.Zoom == 2f;
return true;
}
bool TogglePlayerStanceColors()
{
Game.Settings.Game.UsePlayerStanceColors ^= true;
return true;
}
}
}