public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate) { //If this control is not enable, do nothing if (!IsEnable) { return(false); } if (Visible) { if (((input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift)) && input.IsNewKeyPress(Keys.Tab)) || input.IsNewKeyPress(Keys.Up) || input.IsNewGamepadKeyUpPressed()) { SelectPrev(); } if ((!(input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift)) && input.IsNewKeyPress(Keys.Tab)) || input.IsNewKeyPress(Keys.Down) || input.IsNewGamepadKeyDownPressed()) { SelectNext(); } if (input.IsNewKeyPress(Keys.Escape) || input.IsJoystickButtonNewPressed(MyJoystickButtonsEnum.J02)) { HideScreenIfPossible(); } if (m_displayedItems[m_selected] != null) { if (input.IsNewKeyPress(Keys.Left) || input.IsNewGamepadKeyLeftPressed()) { m_displayedItems[m_selected].ChangeValueDown(); } if (input.IsNewKeyPress(Keys.Right) || input.IsNewGamepadKeyRightPressed()) { m_displayedItems[m_selected].ChangeValueUp(); } if (input.IsNewKeyPress(Keys.Enter) || input.IsNewKeyPress(Keys.Space) || input.IsJoystickButtonNewPressed(MyJoystickButtonsEnum.J01)) { m_displayedItems[m_selected].ChangeValueUp(); } } HandleMouse(input); } if (input.IsNewGameControlPressed(MyGameControlEnums.WHEEL_CONTROL)) { m_first = 0; Visible = !Visible; if (Visible == false) { MyAudio.AddCue2D(MySoundCuesEnum.GuiWheelControlClose); } else { MyAudio.AddCue2D(MySoundCuesEnum.GuiWheelControlOpen); } } return(base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate)); }
public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate) { //If this control is not enable, do nothing if (!IsEnable) return false; if (Visible) { if (((input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift)) && input.IsNewKeyPress(Keys.Tab)) || input.IsNewKeyPress(Keys.Up) || input.IsNewGamepadKeyUpPressed()) SelectPrev(); if ((!(input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift)) && input.IsNewKeyPress(Keys.Tab)) || input.IsNewKeyPress(Keys.Down) || input.IsNewGamepadKeyDownPressed()) SelectNext(); if (input.IsNewKeyPress(Keys.Escape) || input.IsJoystickButtonNewPressed(MyJoystickButtonsEnum.J02)) HideScreenIfPossible(); if (m_displayedItems[m_selected] != null) { if (input.IsNewKeyPress(Keys.Left) || input.IsNewGamepadKeyLeftPressed()) m_displayedItems[m_selected].ChangeValueDown(); if (input.IsNewKeyPress(Keys.Right) || input.IsNewGamepadKeyRightPressed()) m_displayedItems[m_selected].ChangeValueUp(); if (input.IsNewKeyPress(Keys.Enter) || input.IsNewKeyPress(Keys.Space) || input.IsJoystickButtonNewPressed(MyJoystickButtonsEnum.J01)) m_displayedItems[m_selected].ChangeValueUp(); } HandleMouse(input); } if (input.IsNewGameControlPressed(MyGameControlEnums.WHEEL_CONTROL)) { m_first = 0; Visible = !Visible; if (Visible == false) { MyAudio.AddCue2D(MySoundCuesEnum.GuiWheelControlClose); } else { MyAudio.AddCue2D(MySoundCuesEnum.GuiWheelControlOpen); } } return base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate); }