public bool IsHit() { switch (MouseButton) { case null: return(PlayerInput.KeyHit(Key)); case 0: return(PlayerInput.LeftButtonClicked()); case 1: return(PlayerInput.RightButtonClicked()); case 2: return(PlayerInput.MidButtonClicked()); case 3: return(PlayerInput.Mouse4ButtonClicked()); case 4: return(PlayerInput.Mouse5ButtonClicked()); case 5: return(PlayerInput.MouseWheelUpClicked()); case 6: return(PlayerInput.MouseWheelDownClicked()); } return(false); }
public bool IsDown() { switch (MouseButton) { case null: return(PlayerInput.KeyDown(Key)); case 0: return(PlayerInput.LeftButtonHeld()); case 1: return(PlayerInput.RightButtonHeld()); case 2: return(PlayerInput.MidButtonHeld()); case 3: return(PlayerInput.Mouse4ButtonHeld()); case 4: return(PlayerInput.Mouse5ButtonHeld()); case 5: // No real way of "holding" a mouse wheel key, but then again it makes no sense to bind the key to this kind of task. return(PlayerInput.MouseWheelUpClicked()); case 6: return(PlayerInput.MouseWheelDownClicked()); } return(false); }
public bool IsHit() { switch (MouseButton) { case MouseButton.None: return(PlayerInput.KeyHit(Key)); case MouseButton.PrimaryMouse: return(PlayerInput.PrimaryMouseButtonClicked()); case MouseButton.SecondaryMouse: return(PlayerInput.SecondaryMouseButtonClicked()); case MouseButton.LeftMouse: return(PlayerInput.LeftButtonClicked()); case MouseButton.RightMouse: return(PlayerInput.RightButtonClicked()); case MouseButton.MiddleMouse: return(PlayerInput.MidButtonClicked()); case MouseButton.MouseButton4: return(PlayerInput.Mouse4ButtonClicked()); case MouseButton.MouseButton5: return(PlayerInput.Mouse5ButtonClicked()); case MouseButton.MouseWheelUp: return(PlayerInput.MouseWheelUpClicked()); case MouseButton.MouseWheelDown: return(PlayerInput.MouseWheelDownClicked()); } return(false); }
public bool IsDown() { switch (MouseButton) { case MouseButton.None: return(PlayerInput.KeyDown(Key)); case MouseButton.PrimaryMouse: return(PlayerInput.PrimaryMouseButtonHeld()); case MouseButton.SecondaryMouse: return(PlayerInput.SecondaryMouseButtonHeld()); case MouseButton.LeftMouse: return(PlayerInput.LeftButtonHeld()); case MouseButton.RightMouse: return(PlayerInput.RightButtonHeld()); case MouseButton.MiddleMouse: return(PlayerInput.MidButtonHeld()); case MouseButton.MouseButton4: return(PlayerInput.Mouse4ButtonHeld()); case MouseButton.MouseButton5: return(PlayerInput.Mouse5ButtonHeld()); case MouseButton.MouseWheelUp: // No real way of "holding" a mouse wheel key, but then again it makes no sense to bind the key to this kind of task. return(PlayerInput.MouseWheelUpClicked()); case MouseButton.MouseWheelDown: return(PlayerInput.MouseWheelDownClicked()); } return(false); }
private IEnumerable <object> WaitForKeyPress(GUITextBox keyBox) { yield return(CoroutineStatus.Running); while (PlayerInput.LeftButtonHeld() || PlayerInput.LeftButtonClicked()) { //wait for the mouse to be released, so that we don't interpret clicking on the textbox as the keybinding yield return(CoroutineStatus.Running); } while (keyBox.Selected && PlayerInput.GetKeyboardState.GetPressedKeys().Length == 0 && !PlayerInput.LeftButtonClicked() && !PlayerInput.RightButtonClicked() && !PlayerInput.MidButtonClicked() && !PlayerInput.Mouse4ButtonClicked() && !PlayerInput.Mouse5ButtonClicked() && !PlayerInput.MouseWheelUpClicked() && !PlayerInput.MouseWheelDownClicked()) { if (Screen.Selected != GameMain.MainMenuScreen && !GUI.SettingsMenuOpen) { yield return(CoroutineStatus.Success); } yield return(CoroutineStatus.Running); } UnsavedSettings = true; int keyIndex = (int)keyBox.UserData; if (PlayerInput.LeftButtonClicked()) { keyMapping[keyIndex] = new KeyOrMouse(0); keyBox.Text = "Mouse1"; } else if (PlayerInput.RightButtonClicked()) { keyMapping[keyIndex] = new KeyOrMouse(1); keyBox.Text = "Mouse2"; } else if (PlayerInput.MidButtonClicked()) { keyMapping[keyIndex] = new KeyOrMouse(2); keyBox.Text = "Mouse3"; } else if (PlayerInput.Mouse4ButtonClicked()) { keyMapping[keyIndex] = new KeyOrMouse(3); keyBox.Text = "Mouse4"; } else if (PlayerInput.Mouse5ButtonClicked()) { keyMapping[keyIndex] = new KeyOrMouse(4); keyBox.Text = "Mouse5"; } else if (PlayerInput.MouseWheelUpClicked()) { keyMapping[keyIndex] = new KeyOrMouse(5); keyBox.Text = "MouseWheelUp"; } else if (PlayerInput.MouseWheelDownClicked()) { keyMapping[keyIndex] = new KeyOrMouse(6); keyBox.Text = "MouseWheelDown"; } else if (PlayerInput.GetKeyboardState.GetPressedKeys().Length > 0) { Keys key = PlayerInput.GetKeyboardState.GetPressedKeys()[0]; keyMapping[keyIndex] = new KeyOrMouse(key); keyBox.Text = key.ToString("G"); } else { yield return(CoroutineStatus.Success); } keyBox.Deselect(); RefreshItemMessages(); yield return(CoroutineStatus.Success); }