public KeyBinding(KeyBindingType type, string text) { Type = type; textRepresentation = ""; string[] keyBindings = text.Split('+'); foreach (string keyBinding in keyBindings) { if (TryParseEnum <KeyCode>(keyBinding, out KeyCode keyCode)) { if (keyCode != KeyCode.None) { keyCodes.Add(keyCode); textRepresentation += keyCode + "+"; } } } if (keyCodes.Count == 0) { textRepresentation = "NONE"; } else { textRepresentation = textRepresentation.TrimEnd('+'); } }
public ScriptedKeyBinding(Keys key, KeyBindingType type, string text, bool save) { base.Key = key; BindingType = type; m_text = text; m_save = save; }
public MouseButtonBinding(String button, KeyBindingType bindingType) { this.button = button; this.bindingType = bindingType; buttonProperty = typeof(MouseState).GetProperty(button); if (buttonProperty == null || buttonProperty.PropertyType != typeof(ButtonState)) { throw new InvalidProgramException("Could not find button " + button); } }
public void AddAction(String Action, KeyBindingType BindingType) { if (InputActions.ContainsKey(Action)) { return; // throw new InvalidOperationException(); } InputActions.Add(Action, new InputAction { Type = BindingType }); }
public KeyBinding(BoundKeyFunction function, KeyBindingType bindingType, Keyboard.Key baseKey, Keyboard.Key mod1 = Keyboard.Key.Unknown, Keyboard.Key mod2 = Keyboard.Key.Unknown, Keyboard.Key mod3 = Keyboard.Key.Unknown) { Function = function; BindingType = bindingType; PackedKeyCombo = PackKeyCombo(baseKey, mod1, mod2, mod3); }
public KeyBinding(BoundKeyFunction function, KeyBindingType bindingType, Keyboard.Key baseKey, bool canFocus, bool canRepeat, Keyboard.Key mod1 = Keyboard.Key.Unknown, Keyboard.Key mod2 = Keyboard.Key.Unknown, Keyboard.Key mod3 = Keyboard.Key.Unknown) { Function = function; BindingType = bindingType; CanFocus = canFocus; CanRepeat = canRepeat; PackedKeyCombo = PackKeyCombo(baseKey, mod1, mod2, mod3); }
public KeyBinding(InputManager inputManager, BoundKeyFunction function, KeyBindingType bindingType, Key baseKey, bool canFocus, bool canRepeat, int priority, Key mod1 = Key.Unknown, Key mod2 = Key.Unknown, Key mod3 = Key.Unknown) { Function = function; BindingType = bindingType; CanFocus = canFocus; CanRepeat = canRepeat; Priority = priority; _inputManager = inputManager; PackedKeyCombo = new PackedKeyCombo(baseKey, mod1, mod2, mod3); }
private void listView_SelectedIndexChanged(object sender, EventArgs e) { if (listView.SelectedItems.Count == 0) { keyTextBox.Clear(); m_currentKey = Keys.None; styleRadioButton1.Checked = false; actionTextBox.Clear(); return; } ListViewItem item = listView.SelectedItems[0]; if (item.Tag is ScriptedKeyBinding) { ScriptedKeyBinding binding = (ScriptedKeyBinding)item.Tag; KeyBindingType type = binding.BindingType; if (type == KeyBindingType.Send) { styleRadioButton1.Checked = true; } else if (type == KeyBindingType.Script) { styleRadioButton2.Checked = true; } keyTextBox.Text = KeyCodeToString(binding.Key); m_currentKey = binding.Key; actionTextBox.Text = binding.Text; assignButton.Enabled = true; } else { keyTextBox.Clear(); m_currentKey = Keys.None; actionTextBox.Clear(); assignButton.Enabled = false; } }
public KeyBinding(KeyBindingType type, params KeyCode[] keyCodes) { Type = type; textRepresentation = ""; foreach (KeyCode keyCode in keyCodes) { if (keyCode != KeyCode.None) { this.keyCodes.Add(keyCode); textRepresentation += keyCode + "+"; } } if (this.keyCodes.Count == 0) { textRepresentation = "NONE"; } else { textRepresentation = textRepresentation.TrimEnd('+'); } }
public KeyboardBinding(Keys key, KeyBindingType bindingType) { this.key = key; this.bindingType = bindingType; }
public GamepadButtonBinding(Buttons button, KeyBindingType bindingType) { this.button = button; this.bindingType = bindingType; }
public void AddAndBindAction(Keys Key, String Action, KeyBindingType BindingType, Action Handler) { AddAction(Action, BindingType); BindKey(Action, Key); BindHandler(Action, Handler); }
public Keys this[KeyBindingType type] { get { return _bindings[type]; } set { _bindings[type] = value; } }
public MouseButtonBinding(String button, KeyBindingType bindingType) { this.button = button; this.bindingType = bindingType; buttonProperty = typeof(MouseState).GetProperty(button); if (buttonProperty == null || buttonProperty.PropertyType != typeof(ButtonState)) throw new InvalidProgramException("Could not find button " + button); }
public KeyBinding(KeyCode keyCode, KeyBindingType type) { KeyCode = keyCode; Type = type; }