fix shift-numkeys
This commit is contained in:
@@ -360,18 +360,36 @@ namespace OpenRA
|
|||||||
get { return LobbyInfo.Clients.FirstOrDefault(c => c.Index == orderManager.Connection.LocalClientId); }
|
get { return LobbyInfo.Clients.FirstOrDefault(c => c.Index == orderManager.Connection.LocalClientId); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Dictionary<char, char> RemapKeys = new Dictionary<char, char>
|
||||||
|
{
|
||||||
|
{ '!', '1' },
|
||||||
|
{ '@', '2' },
|
||||||
|
{ '#', '3' },
|
||||||
|
{ '$', '4' },
|
||||||
|
{ '%', '5' },
|
||||||
|
{ '^', '6' },
|
||||||
|
{ '&', '7' },
|
||||||
|
{ '*', '8' },
|
||||||
|
{ '(', '9' },
|
||||||
|
{ ')', '0' },
|
||||||
|
};
|
||||||
|
|
||||||
public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers )
|
public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers )
|
||||||
{
|
{
|
||||||
int sync = Game.world.SyncHash();
|
int sync = Game.world.SyncHash();
|
||||||
|
|
||||||
if( e.KeyChar == '\r' )
|
if( e.KeyChar == '\r' )
|
||||||
Game.chat.Toggle();
|
Game.chat.Toggle();
|
||||||
else if( Game.chat.isChatting )
|
else if (Game.chat.isChatting)
|
||||||
Game.chat.TypeChar( e.KeyChar );
|
Game.chat.TypeChar(e.KeyChar);
|
||||||
else
|
else
|
||||||
if( e.KeyChar >= '0' && e.KeyChar <= '9' )
|
{
|
||||||
Game.controller.selection.DoControlGroup( world,
|
var c = RemapKeys.ContainsKey(e.KeyChar) ? RemapKeys[e.KeyChar] : e.KeyChar;
|
||||||
e.KeyChar - '0', modifiers );
|
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
Game.controller.selection.DoControlGroup(world,
|
||||||
|
c - '0', modifiers);
|
||||||
|
}
|
||||||
|
|
||||||
if( sync != Game.world.SyncHash() )
|
if( sync != Game.world.SyncHash() )
|
||||||
throw new InvalidOperationException( "Desync in OnKeyPress" );
|
throw new InvalidOperationException( "Desync in OnKeyPress" );
|
||||||
|
|||||||
Reference in New Issue
Block a user