Fix bogus handling of special keyboard characters everywhere else. Textfields now only accept valid characters, support right-delete.

This commit is contained in:
Paul Chote
2011-03-18 10:48:12 +13:00
parent 7d6d488176
commit eb69b697b1
9 changed files with 47 additions and 41 deletions

View File

@@ -154,7 +154,7 @@ namespace OpenRA.Mods.RA.Widgets
return true;
}
return DoBuildingHotkey(Char.ToLowerInvariant(e.KeyChar), world);
return DoBuildingHotkey(e.KeyName, world);
}
// TODO: BuildPaletteWidget doesn't support delegate methods for mouse input
@@ -499,12 +499,12 @@ namespace OpenRA.Mods.RA.Widgets
p.ToInt2(), Color.White);
}
bool DoBuildingHotkey(char c, World world)
bool DoBuildingHotkey(string key, World world)
{
if (!paletteOpen) return false;
if (CurrentQueue == null) return false;
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == c.ToString());
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == key);
if ( toBuild != null )
{