示例#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);
        }
        public override bool Handle(IEvent evt)
        {
            if (CVars.Get <bool>("ui_auto_control_mode_switching"))
            {
                GamePadButtonDownEvent gamePadButtonDownEvent = evt as GamePadButtonDownEvent;
                if (gamePadButtonDownEvent != null)
                {
                    if (CVars.Get <bool>("ui_mouse_mode"))
                    {
                        CVars.Get <bool>("ui_mouse_mode") = false;
                        CVars.Get <int>("ui_gamepad_mode_current_operator") = (int)gamePadButtonDownEvent._playerIndex;
                        EventManager.Instance.QueueEvent(new EnterGamePadUIModeEvent(gamePadButtonDownEvent._playerIndex));
                        EventManager.Instance.QueueEvent(new GamePadUIModeOperatorChangedEvent(gamePadButtonDownEvent._playerIndex));
                        return(true);
                    }
                    if ((int)gamePadButtonDownEvent._playerIndex != CVars.Get <int>("ui_gamepad_mode_current_operator"))
                    {
                        CVars.Get <int>("ui_gamepad_mode_current_operator") = (int)gamePadButtonDownEvent._playerIndex;
                        EventManager.Instance.QueueEvent(new GamePadUIModeOperatorChangedEvent(gamePadButtonDownEvent._playerIndex));
                    }
                }
                if (evt is KeyboardKeyDownEvent ||
                    evt is MouseButtonEvent ||
                    evt is MouseMoveEvent)
                {
                    if (!CVars.Get <bool>("ui_mouse_mode"))
                    {
                        CVars.Get <bool>("ui_mouse_mode") = true;
                        EventManager.Instance.QueueEvent(new EnterMouseUIModeEvent());
                    }
                }
            }

            return(false);
        }
        private bool HandleGamePadButtonDownEvent(GamePadButtonDownEvent gamePadButtonDownEvent)
        {
            PlayerIndex gamepadIndex        = gamePadButtonDownEvent._playerIndex;
            string      playerstring        = "controller_" + ((int)gamepadIndex);
            int         isPlayerSeatedIndex = CheckIfSeated(playerstring); // -1 means not found, else in 0,1,2 or 3

            // A button is pressed
            if (gamePadButtonDownEvent._pressedButton == Buttons.A)
            {
                if (isPlayerSeatedIndex == -1)
                {
                    // Player is not seated -- Put them in the next available
                    // seat.
                    SeatPlayer(new Player(playerstring, new ControllerInputMethod(gamepadIndex)));
                    return(true);
                }
                // TODO: If player is seated we can place code here to handle alternative actions such as color changing
            }

            // B button is pressed
            if (gamePadButtonDownEvent._pressedButton == Buttons.B)
            {
                // If not seated; go back to main menu
                if (isPlayerSeatedIndex < 0)
                {
                    ChangeState(new UIMenuGameState(GameManager, SharedState));
                    return(true);
                }
                // when player 1 presses B
                if (isPlayerSeatedIndex == 0)
                {
                    // Blanks all seats
                    _playersSeated = new Player[4];
                    UpdateUI();
                    return(true);
                }
                // Blank only the player's seat
                _playersSeated[isPlayerSeatedIndex] = null;
                UpdateUI();
                return(true);
            }

            // If start button is pressed
            if (gamePadButtonDownEvent._pressedButton == Buttons.Start)
            {
                if (SeatedPlayerCount > 0)
                {
                    StartGame(CondenseSeatedPlayersArray());
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
        private void HandleGamePadSuperShieldOn(GamePadButtonDownEvent gpbde)
        {
            if (gpbde._playerIndex != PlayerIndex)
            {
                return;
            }

            if ((int)gpbde._pressedButton == CVars.Get <int>("controller_" + ((int)gpbde._playerIndex) + "_super_shield"))
            {
                _snapshot.SuperShield = true;
            }
        }
示例#5
0
        private void HandleGamePadRotationOn(GamePadButtonDownEvent gpbde)
        {
            if (gpbde._playerIndex != PlayerIndex)
            {
                return;
            }

            if ((int)gpbde._pressedButton == CVars.Get <int>("controller_" + ((int)gpbde._playerIndex) + "_rotate_counter_clockwise"))
            {
                isRotatingCCW = true;
            }
            if ((int)gpbde._pressedButton == CVars.Get <int>("controller_" + ((int)gpbde._playerIndex) + "_rotate_clockwise"))
            {
                isRotatingCW = true;
            }
        }
        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);
        }
示例#7
0
        public override bool Handle(IEvent evt)
        {
            SliderButton.Handle(evt);

            float distanceToCenterOfButtonX = ((BottomRight.X - TopLeft.X) / 2 + TopLeft.X);
            float distanceToCenterOfButtonY = ((BottomRight.Y - TopLeft.Y) / 2 + TopLeft.Y);

            MouseButtonEvent mouseButtonEvent = evt as MouseButtonEvent;

            if (mouseButtonEvent != null)
            {
                if (mouseButtonEvent.LeftButtonState == Microsoft.Xna.Framework.Input.ButtonState.Pressed && SliderButton.ButtonState == ButtonState.Pressed)
                {
                    isDragging = true;
                }
                if (mouseButtonEvent.LeftButtonState == Microsoft.Xna.Framework.Input.ButtonState.Released)
                {
                    isDragging = false;
                }
            }

            MouseMoveEvent mouseMoveEvent = evt as MouseMoveEvent;

            if (mouseMoveEvent != null)
            {
                if (isDragging == true || SliderButton.ButtonState == ButtonState.Pressed)
                {
                    if (isHorizontal)
                    {
                        int   beta = ((int)Math.Round(MathHelper.Clamp(MathUtils.InverseLerp(TopLeft.X, BottomRight.X, mouseMoveEvent.CurrentPosition.X) * divisions, 0, divisions)));
                        float posX = MathHelper.Lerp(TopLeft.X, BottomRight.X, (float)beta / divisions);
                        SliderButton.HorizontalValue = new FixedValue(posX - (BottomRight.X - TopLeft.X) / 2 - TopLeft.X);
                    }

                    if (isVertical)
                    {
                        int   beta = ((int)Math.Round(MathHelper.Clamp(MathUtils.InverseLerp(TopLeft.Y, BottomRight.Y, mouseMoveEvent.CurrentPosition.Y) * divisions, 0, divisions)));
                        float posY = MathHelper.Lerp(TopLeft.Y, BottomRight.Y, (float)beta / divisions);
                        SliderButton.HorizontalValue = new FixedValue(posY - (BottomRight.Y - TopLeft.Y) / 2 - TopLeft.Y);
                    }
                }
            }

            GamePadButtonDownEvent gamePadButtonDownEvent = evt as GamePadButtonDownEvent;

            if (gamePadButtonDownEvent != null && this.isSelected)
            {
                float oneUnitOfWidth  = (BottomRight.X - TopLeft.X) / divisions;
                float oneUnitOfHeight = (BottomRight.Y - TopLeft.Y) / divisions;

                // This is likely bad news
                if (gamePadButtonDownEvent._pressedButton == Buttons.B)
                {
                    this.isSelected = false;
                    Root.MouseMode  = true;
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadLeft ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickLeft)
                {
                    if (!isHorizontal)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(leftID)).isSelected = true;
                    }
                    if (isHorizontal)
                    {
                        SliderButton.HorizontalValue = new FixedValue(
                            MathHelper.Clamp(SliderButton.Horizontal + distanceToCenterOfButtonX - oneUnitOfWidth, (float)TopLeft.X, (float)BottomRight.X) -
                            distanceToCenterOfButtonX
                            );
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadRight ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickRight)
                {
                    if (!isHorizontal)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(rightID)).isSelected = true;
                    }
                    if (isHorizontal)
                    {
                        SliderButton.HorizontalValue = new FixedValue(
                            MathHelper.Clamp(SliderButton.Horizontal + distanceToCenterOfButtonX + oneUnitOfWidth, (float)TopLeft.X, (float)BottomRight.X) -
                            distanceToCenterOfButtonX
                            );
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadUp ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickUp)
                {
                    if (!isVertical)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(aboveID)).isSelected = true;
                    }
                    if (isVertical)
                    {
                        SliderButton.HorizontalValue = new FixedValue(
                            MathHelper.Clamp(SliderButton.Vertical + distanceToCenterOfButtonY - oneUnitOfHeight, (float)BottomRight.Y, (float)TopLeft.Y) -
                            distanceToCenterOfButtonY
                            );
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadDown ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickDown)
                {
                    if (!isVertical)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(belowID)).isSelected = true;
                    }
                    if (isVertical)
                    {
                        SliderButton.HorizontalValue = new FixedValue(
                            MathHelper.Clamp(SliderButton.Vertical + distanceToCenterOfButtonY + oneUnitOfHeight, (float)BottomRight.Y, (float)TopLeft.Y) -
                            distanceToCenterOfButtonY
                            );
                    }
                }
            }

            horizontalValue = ((int)Math.Round(MathHelper.Clamp(MathUtils.InverseLerp(TopLeft.X, BottomRight.X, (SliderButton.Horizontal + distanceToCenterOfButtonX)) * divisions, 0, divisions)));
            verticalValue   = ((int)Math.Round(MathHelper.Clamp(MathUtils.InverseLerp(TopLeft.Y, BottomRight.Y, (SliderButton.Vertical + distanceToCenterOfButtonY)) * divisions, 0, divisions)));

            //Console.WriteLine("Horizontal Value = " + horizontalValue);
            //Console.WriteLine("Vertical Value = " + verticalValue);

            if (isHorizontal)
            {
                CVars.Get <float>(cvar) = (float)horizontalValue / divisions;
            }
            if (isVertical)
            {
                CVars.Get <float>(cvar) = (float)verticalValue / divisions;
            }

            return(false);
        }
示例#8
0
        public override bool Handle(IEvent evt)
        {
            if (Hidden)
            {
                return(false);
            }

            MouseMoveEvent mouseMoveEvent = evt as MouseMoveEvent;

            if (mouseMoveEvent != null)
            {
                //this.isSelected = false;
                if (mouseMoveEvent.CurrentPosition.X > TopLeft.X &&
                    mouseMoveEvent.CurrentPosition.X < BottomRight.X &&
                    mouseMoveEvent.CurrentPosition.Y > TopLeft.Y &&
                    mouseMoveEvent.CurrentPosition.Y < BottomRight.Y)
                {
                    if (ButtonState != ButtonState.Pressed)
                    {
                        ButtonState = ButtonState.Hover;
                    }
                }
                else
                {
                    ButtonState = ButtonState.Released;
                }
            }

            MouseButtonEvent mouseButtonEvent = evt as MouseButtonEvent;

            if (mouseButtonEvent != null)
            {
                if (mouseButtonEvent.CurrentPosition.X > TopLeft.X &&
                    mouseButtonEvent.CurrentPosition.X < BottomRight.X &&
                    mouseButtonEvent.CurrentPosition.Y > TopLeft.Y &&
                    mouseButtonEvent.CurrentPosition.Y < BottomRight.Y)
                {
                    if (mouseButtonEvent.LeftButtonState == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
                    {
                        ButtonState = ButtonState.Pressed;
                    }
                    if (ButtonState == ButtonState.Pressed &&
                        mouseButtonEvent.LeftButtonState == Microsoft.Xna.Framework.Input.ButtonState.Released)
                    {
                        if (Action != null && !Hidden)
                        {
                            Action.Invoke();
                        }

                        ButtonState = ButtonState.Released;
                    }
                    return(true);
                }
            }

            GamePadButtonDownEvent gamePadButtonDownEvent = evt as GamePadButtonDownEvent;

            if (gamePadButtonDownEvent != null && this.isSelected)
            {
                if (gamePadButtonDownEvent._pressedButton == Buttons.A)
                {
                    Action.Invoke();
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadLeft ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickLeft)
                {
                    if (leftID.Length > 0)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(leftID)).isSelected = true;
                        return(true);
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadRight ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickRight)
                {
                    if (rightID.Length > 0)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(rightID)).isSelected = true;
                        return(true);
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadUp ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickUp)
                {
                    if (aboveID.Length > 0)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(aboveID)).isSelected = true;
                        return(true);
                    }
                }
                if (gamePadButtonDownEvent._pressedButton == Buttons.DPadDown ||
                    gamePadButtonDownEvent._pressedButton == Buttons.LeftThumbstickDown)
                {
                    if (belowID.Length > 0)
                    {
                        this.isSelected = false;
                        ((ISelectableWidget)Root.FindWidgetByID(belowID)).isSelected = true;
                        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);
        }