예제 #1
0
        public virtual void Update(ScreenManager manager, GameTime gameTime, GameSettings gameSettings, GameStatus gameStatus)
        {
            if (!_inputChecker.ButtonForSelectIsCurrentlyPressed(gameSettings) && !_inputChecker.ButtonForSelectMouseIsCurrentlyPressed(gameSettings) && !_inputChecker.GoBackButtonIsCurrentlyPressed(gameSettings) && !_inputChecker.MouseWheelUpIsCurrentlyTurned() && !_inputChecker.MouseWheelDownIsCurrentlyTurned())
            {
                manager.ButtonForSelectIsHeldDown = false;
            }
            if (!_inputChecker.ButtonForAlternateSelectIsCurrentlyPressed(gameSettings) && !_inputChecker.ButtonForAlternateSelectMouseIsCurrentlyPressed(gameSettings))
            {
                manager.ButtonForAlternateSelectIsHeldDown = false;
            }
            if (!manager.ButtonForSelectIsHeldDown && !manager.ButtonForAlternateSelectIsHeldDown && _anyButtonScreen != null && _inputChecker.AnyButtonIsCurrentlyPressed(gameSettings))
            {
                manager.ChangeScreen(gameTime, gameSettings, _anyButtonScreen);
            }
            if (_timeoutScreen != null & gameTime.TotalGameTime.TotalSeconds - _totalGameTimeEnter.TotalSeconds > _timeoutSeconds)
            {
                manager.ChangeScreen(gameTime, gameSettings, _timeoutScreen);
            }
            if (_inputChecker.PreviousVerticalButtonIsCurrentlyPressed(gameSettings))
            {
                _buttonPreviousVerticalAction.DoAction(manager, this, gameTime, gameSettings, gameStatus);
            }
            else if (_inputChecker.NextVerticalButtonIsCurrentlyPressed(gameSettings))
            {
                _buttonNextVerticalAction.DoAction(manager, this, gameTime, gameSettings, gameStatus);
            }
            else
            {
                _totalGameTimeFocusChange = new TimeSpan(0, 0, 0);
            }

            if (_inputChecker.PreviousHorizontalButtonIsCurrentlyPressed(gameSettings))
            {
                _buttonPreviousHorizontalAction.DoAction(manager, this, gameTime, gameSettings, gameStatus);
            }
            else if (_inputChecker.NextHorizontalButtonIsCurrentlyPressed(gameSettings))
            {
                _buttonNextHorizontalAction.DoAction(manager, this, gameTime, gameSettings, gameStatus);
            }

            if (!manager.ButtonForSelectIsHeldDown && _inputChecker.ButtonForSelectIsCurrentlyPressed(gameSettings))
            {
                SelectFocusedButtonArea(gameTime);
            }

            _buttonAreaList.Update(manager, this, gameTime, gameSettings, gameStatus);
            if (_inputChecker.HasMouseMoved(gameTime, gameSettings) || _inputChecker.HasMouseWheelMoved())
            {
                ButtonArea mouseOverButtonArea = _buttonAreaList.GetMouseOverButtonArea(gameTime, gameSettings, _resolutionFactory.GetResolution());
                if (mouseOverButtonArea != null)
                {
                    SetFocusedButtonArea(mouseOverButtonArea);
                }
                else
                {
                    _buttonAreaList.SetAllButtonAreasIdle();
                }
            }
        }
예제 #2
0
 public virtual void Update(ScreenManager manager, Screen aScreen, GameTime gameTime, GameSettings gameSettings, GameStatus gameStatus)
 {
     if (Scrollable)
     {
         int focusedIndex = GetFocusedButtonAreaIndex(true);
         CheckIfScrollUpOrDown(focusedIndex);
     }
     foreach (ButtonArea button in _buttonAreaList)
     {
         button.Update(manager, aScreen, gameTime, gameSettings, gameStatus, ScrollCurrentOffset, _resolution.GetResolution());
     }
     if (Scrollable)
     {
         _scrollUpButtonArea.Update(manager, aScreen, gameTime, gameSettings, gameStatus, new Vector2(0, 0), _resolution.GetResolution());
         _scrollDownButtonArea.Update(manager, aScreen, gameTime, gameSettings, gameStatus, new Vector2(0, 0), _resolution.GetResolution());
     }
 }