Remove VirtKey and KeyName.

This commit is contained in:
Paul Chote
2013-10-20 18:16:33 +13:00
parent e5f93ec39e
commit aab6fec68b
13 changed files with 54 additions and 70 deletions

View File

@@ -147,12 +147,12 @@ namespace OpenRA.Mods.RA.Widgets
public override bool HandleKeyPress(KeyInput e)
{
if (e.Event == KeyInputEvent.Up) return false;
if (e.KeyName == Game.Settings.Keys.CycleTabsKey)
if (KeycodeExts.DisplayString(e.Key) == Game.Settings.Keys.CycleTabsKey)
{
TabChange(e.Modifiers.HasModifier(Modifiers.Shift));
return true;
}
return DoBuildingHotkey(e.KeyName, world);
return DoBuildingHotkey(e, world);
}
public override bool HandleMouseInput(MouseInput mi)
@@ -495,12 +495,12 @@ namespace OpenRA.Mods.RA.Widgets
p.ToInt2(), Color.White);
}
bool DoBuildingHotkey(string key, World world)
bool DoBuildingHotkey(KeyInput e, World world)
{
if (!paletteOpen) return false;
if (CurrentQueue == null) return false;
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == key);
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == KeycodeExts.DisplayString(e.Key));
if (toBuild != null)
{

View File

@@ -70,9 +70,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
chatPanel.OnKeyPress = (e) =>
{
if (e.Event == KeyInputEvent.Up) return false;
if (!IsOpen && (e.KeyName == "enter" || e.KeyName == "return") )
if (!IsOpen && (e.Key == Keycode.RETURN || e.Key == Keycode.KP_ENTER))
{
var shift = e.Modifiers.HasModifier(Modifiers.Shift);
var toggle = Game.Settings.Game.TeamChatToggle ;
TeamChat = (!toggle && shift) || ( toggle && (TeamChat ^ shift) );

View File

@@ -47,35 +47,36 @@ namespace OpenRA.Mods.RA.Widgets
{
if (e.Modifiers == Modifiers.None && e.Event == KeyInputEvent.Down)
{
if (e.KeyName == Game.Settings.Keys.CycleBaseKey)
var ks = Game.Settings.Keys;
if (KeycodeExts.DisplayString(e.Key) == ks.CycleBaseKey)
return CycleBases();
if (e.KeyName == Game.Settings.Keys.ToLastEventKey)
if (KeycodeExts.DisplayString(e.Key) == ks.ToLastEventKey)
return ToLastEvent();
if (e.KeyName == Game.Settings.Keys.ToSelectionKey)
if (KeycodeExts.DisplayString(e.Key) == ks.ToSelectionKey)
return ToSelection();
// Put all functions that aren't unit-specific before this line!
if (!world.Selection.Actors.Any())
return false;
if (e.KeyName == Game.Settings.Keys.AttackMoveKey)
if (KeycodeExts.DisplayString(e.Key) == ks.AttackMoveKey)
return PerformAttackMove();
if (e.KeyName == Game.Settings.Keys.StopKey)
if (KeycodeExts.DisplayString(e.Key) == ks.StopKey)
return PerformStop();
if (e.KeyName == Game.Settings.Keys.ScatterKey)
if (KeycodeExts.DisplayString(e.Key) == ks.ScatterKey)
return PerformScatter();
if (e.KeyName == Game.Settings.Keys.DeployKey)
if (KeycodeExts.DisplayString(e.Key) == ks.DeployKey)
return PerformDeploy();
if (e.KeyName == Game.Settings.Keys.StanceCycleKey)
if (KeycodeExts.DisplayString(e.Key) == ks.StanceCycleKey)
return PerformStanceCycle();
if (e.KeyName == Game.Settings.Keys.GuardKey)
if (KeycodeExts.DisplayString(e.Key) == ks.GuardKey)
return PerformGuard();
}