public void HandleInput(ChessGameController gameController)
 {
     if (gameController.ActivePlayer.TeamColor == TeamColor)
     {
         InputHandler.HandleInput(gameController);
     }
 }
Exemple #2
0
        protected override void Update(GameTime gameTime)
        {
            if (this.IsActive)
            {
                if (_wasInactive)
                {
                    _inputHandler.InitiateInput();
                }
                _wasInactive = false;
                _inputHandler.HandleInput(_playerCommandQueue);
            }
            else
            {
                _wasInactive = true;
            }

            while (_playerCommandQueue.Count > 0)
            {
                _playerCommandQueue.Dequeue().Execute(_playerOne, (float)gameTime.ElapsedGameTime.TotalSeconds);
            }
            if (_playerOne.HasFullscreen() != _graphicsDeviceManager.IsFullScreen)
            {
                _graphicsDeviceManager.ToggleFullScreen();
                _graphicsDeviceManager.ApplyChanges();
            }

            if (_playerOne.HasQuit() || Keyboard.GetState().IsKeyDown(Keys.Escape) || GamePad.GetState(0).IsButtonDown(Buttons.Start))
            {
                Exit();
            }
            base.Update(gameTime);
        }
Exemple #3
0
        public void Update(GameTime gameTime, IInputHandler input, bool otherWindowHasFocus)
        {
            //Make a copy of the master screen list, to avoid confusion if the process of updating one screen adds or removes others.
            ScreensToUpdate.Clear();

            //Update the top screen separate from all other screens.
            if (null != TopScreen)
            {
                TopScreen.Update(gameTime, false, false);
                input.HandleInput(TopScreen);
            }

            for (int i = 0; i < Screens.Count; i++)
            {
                ScreensToUpdate.Add(Screens[i]);
            }

            bool coveredByOtherScreen = false;

            // Loop as long as there are screens waiting to be updated.
            while (ScreensToUpdate.Count > 0)
            {
                // Pop the topmost screen off the waiting list.
                var screen = ScreensToUpdate[ScreensToUpdate.Count - 1];
                ScreensToUpdate.RemoveAt(ScreensToUpdate.Count - 1);

                // Update the screen.
                screen.Update(gameTime, otherWindowHasFocus, coveredByOtherScreen);

                //If the screen is active, let it check the input
                if (screen.IsActive)
                {
                    input.HandleInput(screen);

                    //If this is a covering screen, let other screens know they are covered.
                    if (screen.CoverOtherScreens)
                    {
                        coveredByOtherScreen = true;
                    }
                }
            }
        }
        public string Handle()
        {
            if (Request.Form.Count > 0)
            {
                string input = Request.Form["inputText"];

                _inputHandler.HandleInput(input);

                return(_outputHandler.GetOutput());
            }
            return("");
        }
Exemple #5
0
        public void Update()
        {
            if (_ready)
            {
                _cameraInputHandler.HandleInput();

                while (_commands.Count > 0)
                {
                    _commands.Dequeue().Execute();
                    CameraEventManager.CameraPositionChanged(new Vector3(_newPosition.x, _newZoom.y, _newPosition.z));
                }
                UpdateCameraAndEnsureBounds();
            }
        }
Exemple #6
0
    void Update()
    {
        if (isGameActive)
        {
            if (!isPaused)
            {
                timer.HandleTimer();

                HandleStandaloneInput();
                inputHandler.HandleInput();
            }

            if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Pause))
            {
                ChangePauseState();
            }
        }
    }
Exemple #7
0
        private void HandleInput()
        {
            var input = inputHandler.HandleInput();

            SendTrigger(input);
        }