public void RegisterCommand(Interfaces.ICommand command, params Keys[] keys) { foreach (Keys key in keys) { addMapping(command, key); } }
private void addMapping(Interfaces.ICommand command, Keys key) { bool tryAdd = controllerMappings.TryAdd(key, command); if (tryAdd == false) { controllerMappings.Remove(key); controllerMappings.Add(key, command); } }
/* This is used to put a command into 'controllerMappings' * so that when a key is held, the command may be executed */ public void RegisterCommand(Interfaces.ICommand command, params Keys[] keys) { foreach (Keys key in keys) { bool tryAdd = controllerMappings.TryAdd(key, command); if (tryAdd == false) { controllerMappings.Remove(key); controllerMappings.Add(key, command); } } }
public void RegisterCommand(Keys key, Interfaces.ICommand command) { addMapping(command, key); }