public static void CancelSetControl() { CommandToTest = null; foreach (var device in ControlerLibrary.Devices) { if (device as Keyboard != null) { (device as Keyboard).KeyPressed -= ControlMapSetter_KeyPressed; } else if (device as Joystick != null) { (device as Joystick).ControllChanged -= ControlMapSetter_ControllChanged; } } }
public static void BeginSetControl(ControlMapping.Command cmd, bool add = false, bool setPositive = true, ControlMapping.Command.Input inputToUpdate = null) { Done = false; AddInput = add && inputToUpdate == null; CommandToTest = cmd; InputToUpdate = inputToUpdate; SetPositiveKeyAxis = setPositive && (CommandToTest as ControlMapping.Axis) != null; foreach (var device in ControlerLibrary.Devices) { if (device as Keyboard != null) { (device as Keyboard).KeyPressed += ControlMapSetter_KeyPressed; } else if (device as Joystick != null) { (device as Joystick).ControllChanged += ControlMapSetter_ControllChanged; } } }