Ejemplo n.º 1
0
        public override bool Handle(IEvent evt)
        {
            KeyboardKeyDownEvent keyboardKeyDownEvent = evt as KeyboardKeyDownEvent;

            if (keyboardKeyDownEvent != null)
            {
                if (keyboardKeyDownEvent._key == (Keys)CVars.Get <int>("input_keyboard_pause"))
                {
                    EventManager.Instance.QueueEvent(new TogglePauseGameEvent());
                    return(true);
                }
            }

            GamePadButtonDownEvent gamePadButtonDownEvent = evt as GamePadButtonDownEvent;

            if (gamePadButtonDownEvent != null)
            {
                if (gamePadButtonDownEvent._pressedButton == (Buttons)CVars.Get <int>("input_controller_pause"))
                {
                    EventManager.Instance.QueueEvent(new TogglePauseGameEvent());
                    return(true);
                }
            }

            return(false);
        }
 private void HandleKeyboardControlsPressed(KeyboardKeyDownEvent keyboardKeyDownEvent)
 {
     if ((int)keyboardKeyDownEvent._key == CVars.Get <int>("input_keyboard_secondary_rotate_counter_clockwise"))
     {
         isRotatingCCW = true;
     }
     if ((int)keyboardKeyDownEvent._key == CVars.Get <int>("input_keyboard_secondary_rotate_clockwise"))
     {
         isRotatingCW = true;
     }
     if ((int)keyboardKeyDownEvent._key == CVars.Get <int>("input_keyboard_secondary_super_shield"))
     {
         _snapshot.SuperShield = true;
     }
 }
        public bool Handle(IEvent evt)
        {
            LogEvent(evt);

            KeyboardKeyDownEvent keyboardKeyDownEvent = evt as KeyboardKeyDownEvent;

            if (keyboardKeyDownEvent != null)
            {
                switch (keyboardKeyDownEvent._key)
                {
                case Keys.F1:
                    CVars.Get <bool>("debug_show_cvar_viewer") = !CVars.Get <bool>("debug_show_cvar_viewer");
                    return(true);

                case Keys.F2:
                    CVars.Get <bool>("debug_show_playback_controls") = !CVars.Get <bool>("debug_show_playback_controls");
                    return(true);

                case Keys.F3:
                    CVars.Get <bool>("debug_show_statistics") = !CVars.Get <bool>("debug_show_statistics");
                    return(true);

                case Keys.F4:
                    CVars.Get <bool>("debug_show_collision_shapes") = !CVars.Get <bool>("debug_show_collision_shapes");
                    return(true);

                case Keys.F5:
                    CVars.Get <bool>("debug_show_render_culling") = !CVars.Get <bool>("debug_show_render_culling");
                    return(true);

                case Keys.F6:
                    CVars.Get <bool>("debug_force_debug_camera") = !CVars.Get <bool>("debug_force_debug_camera");
                    return(true);

                case Keys.F7:
                    CVars.Get <bool>("debug_show_quad_trees") = !CVars.Get <bool>("debug_show_quad_trees");
                    return(true);

                case Keys.OemTilde:
                    CVars.Get <bool>("debug_show_console") = !CVars.Get <bool>("debug_show_console");
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public bool Handle(IEvent evt)
        {
            GamePadButtonDownEvent buttonPressed = evt as GamePadButtonDownEvent;

            if (buttonPressed != null)
            {
                return(HandleGamePadButtonDownEvent(buttonPressed));
            }

            // Keyboard Lobby Support
            KeyboardKeyDownEvent keyPressed = evt as KeyboardKeyDownEvent;

            if (keyPressed != null)
            {
                HandleKeyboardKeyDownEvent(keyPressed);
            }

            return(false);
        }
Ejemplo n.º 5
0
        private bool HandleKeyboardKeyDownEvent(KeyboardKeyDownEvent keyboardKeyDownEvent)
        {
            string playerString = "keyboard_";

            InputMethod inputMethod = null;

            if (keyboardKeyDownEvent._key == (Keys)CVars.Get <int>("input_keyboard_primary_rotate_counter_clockwise") ||
                keyboardKeyDownEvent._key == (Keys)CVars.Get <int>("input_keyboard_primary_rotate_clockwise"))
            {
                inputMethod   = new PrimaryKeyboardInputMethod();
                playerString += "primary";
            }
            if (keyboardKeyDownEvent._key == (Keys)CVars.Get <int>("input_keyboard_secondary_rotate_counter_clockwise") ||
                keyboardKeyDownEvent._key == (Keys)CVars.Get <int>("input_keyboard_secondary_rotate_clockwise"))
            {
                inputMethod   = new SecondaryKeyboardInputMethod();
                playerString += "secondary";
            }

            int isPlayerSeatedIndex = CheckIfSeated(playerString); // -1 means not found, else in 0,1,2 or 3

            if (isPlayerSeatedIndex == -1 && inputMethod != null)
            {
                // Player is not seated -- Put them in the next available
                // seat.
                SeatPlayer(new Player(playerString, inputMethod));
                return(true);
            }
            // TODO: If player is seated we can place code here to handle alternative actions such as color changing

            if (keyboardKeyDownEvent._key == Keys.Enter)
            {
                if (SeatedPlayerCount > 0)
                {
                    StartGame(CondenseSeatedPlayersArray());
                }
            }

            if (keyboardKeyDownEvent._key == Keys.Escape)
            {
                // Remove keyboard player (if there is one)
                for (int i = _playersSeated.Length - 1; i >= 0; i--)
                {
                    if (_playersSeated[i] == null)
                    {
                        continue;
                    }
                    if (_playersSeated[i].InputMethod is PrimaryKeyboardInputMethod ||
                        _playersSeated[i].InputMethod is SecondaryKeyboardInputMethod)
                    {
                        if (i == 0)
                        {
                            // Player 1 pressed Escape
                            // Blanks all seats
                            _playersSeated = new Player[4];
                            UpdateUI();
                            return(true);
                        }

                        _playersSeated[i] = null;
                        UpdateUI();
                        return(true);
                    }
                }

                // Player not removed
                // If not seated; go back to main menu
                if (isPlayerSeatedIndex < 0)
                {
                    ChangeState(new UIMenuGameState(GameManager, SharedState));
                    return(true);
                }
            }

            return(false);
        }
        public bool Handle(IEvent evt)
        {
            if (evt is EnterMouseUIModeEvent)
            {
                UpdateButtonBindingsForKeyboard();
            }
            if (evt is EnterGamePadUIModeEvent)
            {
                UpdateButtonBindingsForGamePad(((EnterGamePadUIModeEvent)evt).PlayerIndex);
            }
            if (evt is GamePadUIModeOperatorChangedEvent)
            {
                UpdateButtonBindingsForGamePad(((GamePadUIModeOperatorChangedEvent)evt).PlayerIndex);
            }

            GamePadButtonDownEvent gpbde = evt as GamePadButtonDownEvent;

            if (gpbde != null)
            {
                if (bindingMode == BindingMode.none && gpbde._pressedButton == Buttons.B)
                {
                    _root.FindSelectedWidget().isSelected = false;
                    if (isOnLeftSide == true)
                    {
                        ChangeState(new UIMenuGameState(GameManager, SharedState));
                        return(true);
                    }
                    if (isOnLeftSide == false)
                    {
                        foreach (DropDownPanel ddp in _root.FindWidgetsByClass("DropDown"))
                        {
                            ddp.ShowDropDown = false;
                            ddp.isSelected   = false;
                        }

                        switch (leftSideIndex)
                        {
                        case 0:
                            ((Panel)_root.FindWidgetByID("display_options_menu_right_panel")).Hidden = true;
                            ((Button)_root.FindWidgetByID("Display")).isSelected = true;
                            isOnLeftSide = true;
                            break;

                        case 1:
                            ((Panel)_root.FindWidgetByID("controls_options_menu_right_panel")).Hidden = true;
                            ((Button)_root.FindWidgetByID("Controls")).isSelected = true;
                            isOnLeftSide = true;
                            break;

                        case 2:
                            ((Panel)_root.FindWidgetByID("game_options_menu_right_panel")).Hidden = true;
                            ((Button)_root.FindWidgetByID("GameSettings")).isSelected             = true;
                            isOnLeftSide = true;
                            break;
                        }
                    }
                }
                if (bindingMode == BindingMode.gamepad)
                {
                    BindingControl other1 = BindingControl.none;
                    BindingControl other2 = BindingControl.none;
                    switch (gpbde._pressedButton)
                    {
                    case Buttons.A:
                    case Buttons.B:
                    case Buttons.X:
                    case Buttons.Y:
                    case Buttons.LeftTrigger:
                    case Buttons.LeftShoulder:
                    case Buttons.LeftStick:
                    case Buttons.RightTrigger:
                    case Buttons.RightShoulder:
                    case Buttons.RightStick:
                    case Buttons.DPadUp:
                    case Buttons.DPadDown:
                    case Buttons.DPadLeft:
                    case Buttons.DPadRight:
                    case Buttons.LeftThumbstickUp:
                    case Buttons.LeftThumbstickDown:
                    case Buttons.LeftThumbstickLeft:
                    case Buttons.LeftThumbstickRight:
                    case Buttons.RightThumbstickUp:
                    case Buttons.RightThumbstickDown:
                    case Buttons.RightThumbstickLeft:
                    case Buttons.RightThumbstickRight:
                        switch (bindingControl)
                        {
                        case BindingControl.rotate_counter_clockwise:
                            other1 = BindingControl.rotate_clockwise;
                            other2 = BindingControl.super_shield;
                            break;

                        case BindingControl.rotate_clockwise:
                            other1 = BindingControl.rotate_counter_clockwise;
                            other2 = BindingControl.super_shield;
                            break;

                        case BindingControl.super_shield:
                            other1 = BindingControl.rotate_counter_clockwise;
                            other2 = BindingControl.rotate_clockwise;
                            break;
                        }
                        // if 'other1' is assigned to the value the user attempts to bind to 'bindingControl' then the two will swap values
                        if (CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{other1}")) == (int)gpbde._pressedButton)
                        {
                            CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{other1}")) = CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{bindingControl}"));
                        }
                        // if 'other2' is assigned to the value the user attempts to bind to 'bindingControl' then the two will swap values
                        if (CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{other2}")) == (int)gpbde._pressedButton)
                        {
                            CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{other2}")) = CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{bindingControl}"));
                        }
                        CVars.Get <int>(string.Format($"input_controller_{(int)gpbde._playerIndex}_{bindingControl}")) = (int)gpbde._pressedButton;
                        break;

                    default:
                        return(true);
                    }
                    CVars.Save();
                    UpdateButtonBindingsForGamePad(gpbde._playerIndex);
                    ((Button)_root.FindWidgetByID(string.Format($"{bindingControl}"))).isSelected = true;
                    bindingControl = BindingControl.none;
                    _root.AutoControlModeSwitching = true;
                    return(true);
                }
            }

            KeyboardKeyDownEvent kbkde = evt as KeyboardKeyDownEvent;

            if (kbkde != null)
            {
                return(HandleKeyboardKeyDownEvent(kbkde));
            }

            // Listen for the 3 types of button settings pressed
            // Consider buttonSelectedEvent and buttonDeselectedEvent to allow showing of right side
            DisplaySettingsButtonPressedEvent displaySBPE = evt as DisplaySettingsButtonPressedEvent;

            if (displaySBPE != null)
            {
                isOnLeftSide  = false;
                leftSideIndex = 0;
                Console.WriteLine("displaySBPE");

                //_root.FindSelectedWidget().isSelected = false;
                ((Button)_root.FindWidgetByID("Display")).isSelected = false;
                ((DropDownPanel)_root.FindWidgetByID("Screen_Size_Settings_Dropdown")).isSelected = true;

                ((Panel)_root.FindWidgetByID("controls_options_menu_right_panel")).Hidden = true;
                ((Panel)_root.FindWidgetByID("game_options_menu_right_panel")).Hidden     = true;
                ((Panel)_root.FindWidgetByID("display_options_menu_right_panel")).Hidden  = false;
            }
            ControlsSettingsButtonPressedEvent controlsSBPE = evt as ControlsSettingsButtonPressedEvent;

            if (controlsSBPE != null)
            {
                isOnLeftSide  = false;
                leftSideIndex = 1;
                Console.WriteLine("controlSBPE");

                //_root.FindSelectedWidget().isSelected = false;
                ((Button)_root.FindWidgetByID("Controls")).isSelected = false;
                ((Button)_root.FindWidgetByID("primary_rotate_counter_clockwise")).isSelected = true;

                ((Panel)_root.FindWidgetByID("controls_options_menu_right_panel")).Hidden = false;
                ((Panel)_root.FindWidgetByID("game_options_menu_right_panel")).Hidden     = true;
                ((Panel)_root.FindWidgetByID("display_options_menu_right_panel")).Hidden  = true;
            }
            GameSettingsButtonPressedEvent gameSBPE = evt as GameSettingsButtonPressedEvent;

            if (gameSBPE != null)
            {
                isOnLeftSide  = false;
                leftSideIndex = 2;
                Console.WriteLine("gameSBPE");

                //_root.FindSelectedWidget().isSelected = false;
                ((Button)_root.FindWidgetByID("GameSettings")).isSelected          = false;
                ((DropDownPanel)_root.FindWidgetByID("Speed_Dropdown")).isSelected = true;

                ((Panel)_root.FindWidgetByID("controls_options_menu_right_panel")).Hidden = true;
                ((Panel)_root.FindWidgetByID("game_options_menu_right_panel")).Hidden     = false;
                ((Panel)_root.FindWidgetByID("display_options_menu_right_panel")).Hidden  = true;
            }

            FullScreenSettingsButtonPressedEvent fullscreenSBPE = evt as FullScreenSettingsButtonPressedEvent;

            if (fullscreenSBPE != null)
            {
                ((Label)_root.FindWidgetByID("Screen_Size_Settings_Dropdown_Label")).Content = "Screen Size: Full Screen";
                // Set to full screen
                CVars.Get <bool>("display_windowed")   = false;
                CVars.Get <bool>("display_borderless") = false;
                CVars.Get <bool>("display_fullscreen") = true;
                // Generate event to force GameManager to change to correct settings
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }
            WindowedSettingsButtonPressed windowedSBPE = evt as WindowedSettingsButtonPressed;

            if (windowedSBPE != null)
            {
                ((Label)_root.FindWidgetByID("Screen_Size_Settings_Dropdown_Label")).Content = "Screen Size: Windowed";
                // Set to windowed
                CVars.Get <bool>("display_windowed")   = true;
                CVars.Get <bool>("display_borderless") = false;
                CVars.Get <bool>("display_fullscreen") = false;
                // Generate event to force GameManager to change to correct settings
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }
            BorderlessWindowButtonPressedEvent borderlessWindowSBPE = evt as BorderlessWindowButtonPressedEvent;

            if (borderlessWindowSBPE != null)
            {
                ((Label)_root.FindWidgetByID("Screen_Size_Settings_Dropdown_Label")).Content = "Screen Size: Borderless";
                // Set to borderless window
                CVars.Get <bool>("display_windowed")   = false;
                CVars.Get <bool>("display_borderless") = true;
                CVars.Get <bool>("display_fullscreen") = false;
                // Generate event to force GameManager to change to correct settings
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }

            /*
             * AAFXAASettingsButtonPressedEvent aafxaaSBPE = evt as AAFXAASettingsButtonPressedEvent;
             * if (aafxaaSBPE != null)
             * {
             *  ((Label)_root.FindWidgetByID("FXAA_Settings_Dropdown_Label")).Content = "Anti-Alias: FXAA";
             *  CVars.Get<bool>("graphics_fxaa") = true;
             *  CVars.Get<bool>("graphics_feathering") = false;
             *  EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
             * }
             */
            AASMAASettingsButtonPressedEvent aasmaaSBPE = evt as AASMAASettingsButtonPressedEvent;

            if (aasmaaSBPE != null)
            {
                ((Label)_root.FindWidgetByID("AA_Settings_Dropdown_Label")).Content = "Anti-Alias: SMAA";
                CVars.Get <bool>("graphics_smaa")       = true;
                CVars.Get <bool>("graphics_feathering") = false;
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }
            AAFeatheringButtonPressedEvent aafeatherSBPE = evt as AAFeatheringButtonPressedEvent;

            if (aafeatherSBPE != null)
            {
                ((Label)_root.FindWidgetByID("AA_Settings_Dropdown_Label")).Content = "Anti-Alias: Feathering";
                CVars.Get <bool>("graphics_smaa")       = false;
                CVars.Get <bool>("graphics_feathering") = true;
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }
            AAOffButtonPressedEvent aaoffSBPE = evt as AAOffButtonPressedEvent;

            if (aaoffSBPE != null)
            {
                ((Label)_root.FindWidgetByID("AA_Settings_Dropdown_Label")).Content = "Anti-Alias: Off";
                CVars.Get <bool>("graphics_smaa")       = false;
                CVars.Get <bool>("graphics_feathering") = false;
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }

            RotateLeftSettingsButtonPressedEvent rlSBPE = evt as RotateLeftSettingsButtonPressedEvent;

            if (rlSBPE != null)
            {
                Console.WriteLine("rlSBPE");
                // Rotate Left Button Clicked, enter into button binding state
                bindingControl = BindingControl.rotate_counter_clockwise;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.primary : BindingMode.gamepad;

                /*
                 * bindingMode = BindingMode.primary;
                 * bindingGamepad = !_root.MouseMode;
                 */
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("primary_rotate_counter_clockwise")).isSelected = false;
            }
            RotateRightSettingsButtonPressedEvent rrSBPE = evt as RotateRightSettingsButtonPressedEvent;

            if (rrSBPE != null)
            {
                Console.WriteLine("rrSBPE");
                // Rotate Right Button Clicked, enter into button binding state
                bindingControl = BindingControl.rotate_clockwise;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.primary : BindingMode.gamepad;
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("primary_rotate_clockwise")).isSelected = false;
            }
            if (evt is SuperShieldSettingsButtonPressedEvent)
            {
                Console.WriteLine("Super Shield Pressed");
                bindingControl = BindingControl.super_shield;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.primary : BindingMode.gamepad;
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("primary_super_shield")).isSelected = false;
            }
            if (evt is SecondaryRotateLeftSettingsButtonPressedEvent)
            {
                Console.WriteLine("secondary_rlSBPE");
                // Rotate Left Button Clicked, enter into button binding state
                bindingControl = BindingControl.rotate_counter_clockwise;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.secondary : BindingMode.gamepad;
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("secondary_rotate_counter_clockwise")).isSelected = false;
            }
            if (evt is SecondaryRotateRightSettingsButtonPressedEvent)
            {
                Console.WriteLine("secondary_rrSBPE");
                // Rotate Right Button Clicked, enter into button binding state
                bindingControl = BindingControl.rotate_clockwise;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.secondary : BindingMode.gamepad;
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("secondary_rotate_clockwise")).isSelected = false;
            }
            if (evt is SecondarySuperShieldSettingsButtonPressedEvent)
            {
                Console.WriteLine("Super Shield Pressed");
                bindingControl = BindingControl.super_shield;
                bindingMode    = (_root.MouseMode == true) ? BindingMode.secondary : BindingMode.gamepad;
                _root.AutoControlModeSwitching = false;
                ((Button)_root.FindWidgetByID("secondary_super_shield")).isSelected = false;
            }
            if (evt is ResolutionButtonPressedEvent)
            {
                ((Label)_root.FindWidgetByID("Resolution_Button_Label")).Content = SetNextResolution();
                GameManager.Graphics.IsFullScreen       = false;
                GameManager.Graphics.HardwareModeSwitch = true;
                GameManager.Graphics.ApplyChanges();
                EventManager.Instance.QueueEvent(new ReloadDisplayOptionsEvent());
            }
            if (evt is VSyncButtonPressedEvent)
            {
                bool replacement = !(CVars.Get <bool>("display_vsync"));
                CVars.Get <bool>("display_vsync") = replacement;
                ((Label)_root.FindWidgetByID("VSync_Button_Label")).Content =
                    (replacement == true) ?
                    "V-Sync: On" :
                    "V-Sync: Off";
            }

            return(false);
        }
        private bool HandleKeyboardKeyDownEvent(KeyboardKeyDownEvent keyboardKeyDownEvent)
        {
            if (bindingMode == BindingMode.primary || bindingMode == BindingMode.secondary)
            {
                BindingControl other1 = BindingControl.none;
                BindingControl other2 = BindingControl.none;
                switch (keyboardKeyDownEvent._key)
                {
                case Keys.D0:
                case Keys.D1:
                case Keys.D2:
                case Keys.D3:
                case Keys.D4:
                case Keys.D5:
                case Keys.D6:
                case Keys.D7:
                case Keys.D8:
                case Keys.D9:

                case Keys.A:
                case Keys.B:
                case Keys.C:
                case Keys.D:
                case Keys.E:
                case Keys.F:
                case Keys.G:
                case Keys.H:
                case Keys.I:
                case Keys.J:
                case Keys.K:
                case Keys.L:
                case Keys.M:
                case Keys.N:
                case Keys.O:
                case Keys.P:
                case Keys.Q:
                case Keys.R:
                case Keys.S:
                case Keys.T:
                case Keys.U:
                case Keys.V:
                case Keys.W:
                case Keys.X:
                case Keys.Y:
                case Keys.Z:

                case Keys.Up:
                case Keys.Down:
                case Keys.Left:
                case Keys.Right:

                case Keys.OemOpenBrackets:
                case Keys.OemCloseBrackets:
                case Keys.OemSemicolon:
                case Keys.OemQuotes:
                case Keys.OemComma:
                case Keys.OemPeriod:
                case Keys.OemQuestion:
                case Keys.OemBackslash:
                case Keys.OemMinus:
                case Keys.OemPlus:
                case Keys.Space:
                    switch (bindingControl)
                    {
                    case BindingControl.rotate_counter_clockwise:
                        other1 = BindingControl.rotate_clockwise;
                        other2 = BindingControl.super_shield;
                        break;

                    case BindingControl.rotate_clockwise:
                        other1 = BindingControl.rotate_counter_clockwise;
                        other2 = BindingControl.super_shield;
                        break;

                    case BindingControl.super_shield:
                        other1 = BindingControl.rotate_counter_clockwise;
                        other2 = BindingControl.rotate_clockwise;
                        break;
                    }
                    // if 'other1' is assigned to the value the user attempts to bind to 'bindingControl' then the two will swap values
                    if (CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{other1}")) == (int)keyboardKeyDownEvent._key)
                    {
                        CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{other1}")) = CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{bindingControl}"));
                    }
                    // if 'other2' is assigned to the value the user attempts to bind to 'bindingControl' then the two will swap values
                    if (CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{other2}")) == (int)keyboardKeyDownEvent._key)
                    {
                        CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{other2}")) = CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{bindingControl}"));
                    }
                    CVars.Get <int>(string.Format($"input_keyboard_{bindingMode}_{bindingControl}")) = (int)keyboardKeyDownEvent._key;
                    CVars.Save();
                    UpdateButtonBindingsForKeyboard();
                    bindingMode    = BindingMode.none;
                    bindingControl = BindingControl.none;
                    //((Button)_root.FindWidgetByID("primary_rotate_rotate_counter_clockwise")).isSelected = true;
                    _root.AutoControlModeSwitching = true;
                    return(true);

                default:
                    break;
                }
            }
            else
            {
                if (keyboardKeyDownEvent._key == Keys.Escape)
                {
                    if (isOnLeftSide)
                    {
                        ChangeState(new UIMenuGameState(GameManager, SharedState));
                    }
                    if (!isOnLeftSide)
                    {
                        switch (leftSideIndex)
                        {
                        case 0:
                            ((Button)_root.FindWidgetByID("Display")).isSelected = true;
                            isOnLeftSide = true;
                            // Deslection of button/slider should be handled in the button/slider class
                            ((Panel)_root.FindWidgetByID("display_options_menu_right_panel")).Hidden = true;
                            break;

                        case 1:
                            ((Button)_root.FindWidgetByID("Controls")).isSelected = true;
                            isOnLeftSide = true;
                            // Deslection of button/slider should be handled in the button/slider class
                            ((Panel)_root.FindWidgetByID("controls_options_menu_right_panel")).Hidden = true;
                            break;

                        case 2:
                            ((Button)_root.FindWidgetByID("GameSettings")).isSelected = true;
                            isOnLeftSide = true;
                            // Deslection of button/slider should be handled in the button/slider class
                            ((Panel)_root.FindWidgetByID("game_options_menu_right_panel")).Hidden = true;
                            break;
                        }
                    }
                    return(true);
                }
            }

            return(false);
        }