示例#1
0
        protected void MouseControls()
        {
            if (baseState.IsOverlayDisplayed)
            {
                if (ControlManager.IsLeftMouseButtonClicked() &&
                    Game.IsActive)
                {
                    ActiveMenuState.ButtonActions();
                }
            }
            else
            {
                for (int i = 0; i < allButtons.Count; i++)
                {
                    if (ControlManager.IsMouseOverArea(allButtons[i].Bounds))
                    {
                        if (ControlManager.IsMouseMoving())
                        {
                            activeButtonIndexY = i;
                        }

                        if (ControlManager.IsLeftMouseButtonClicked())
                        {
                            ActiveMenuState.ButtonActions();
                        }
                    }
                }
            }
        }
示例#2
0
        public virtual void Update(GameTime gameTime)
        {
            activeMenuState.Update(gameTime);

            MouseControls();

            if (buttonControl == ButtonControl.Menu)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    activeButtonIndexY++;
                    WrapActiveButton();
                    ActiveMenuState.CursorActions();
                }

                else if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    activeButtonIndexY--;
                    WrapActiveButton();
                    ActiveMenuState.CursorActions();
                }

                previousButton = activeButton;
                activeButton   = allButtons[activeButtonIndexY];
            }

            else if (buttonControl.Equals(ButtonControl.Mission) ||
                     buttonControl.Equals(ButtonControl.Response) ||
                     buttonControl.Equals(ButtonControl.Confirm))
            {
                activeButton = null;
            }

            if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter))
            {
                ActiveMenuState.ButtonActions();
            }

            foreach (MenuDisplayObject button in allButtons)
            {
                if (button != null)
                {
                    button.isActive = false;
                }
            }

            if (activeButton != null)
            {
                activeButton.isActive = true;
            }

            missionMenuState.UpdateTextCursorPos();

            foreach (TextBox txtBox in textBoxes)
            {
                txtBox.Update(gameTime);
            }
        }