public UpdaterParameters(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            _gameTime = gameTime;
            _focus    = focus;
        }
예제 #2
0
        public UpdaterParameters(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            _gameTime = gameTime;
            _focus = focus;
        }
        private void MessageClosing(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageInputHandler);
            _messageInputHandler = null;

            _messageFadeOutAndScaleUpdater = new MessageFadeOutAndScaleUpdater(_messageRendererState, gameTime.TotalGameTime, MessageClosed);
            _updaterCollection.Add(_messageFadeOutAndScaleUpdater);
        }
        public void DequeueOldLogEntries(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            while (_logEntries.Any() && gameTime.TotalGameTime - _logEntries.Peek().LoggedTotalWorldTime > LogEntryLifetime)
            {
                _logEntries.Dequeue();
            }
        }
        private void MessageOpened(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageFadeInAndScaleUpdater);
            _messageFadeInAndScaleUpdater = null;

            _messageInputHandler = new MessageInputHandler(_worldInstance, _messageRendererState, gameTime.TotalGameTime, MessageClosing);
            _updaterCollection.Add(_messageInputHandler);

            _worldInstance.MessageMananger.MessageOpened(_messageRendererState.Message);
        }
        protected override void Draw(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            var spriteBatch = new SpriteBatch(GraphicsDevice);

            _rendererCollection.Render(spriteBatch, gameTime, _fontContent, _textureContent);

            spriteBatch.Dispose();
        }
예제 #7
0
        public RendererParameters(IXnaGameTime gameTime, SpriteBatch spriteBatch, FontContent fontContent, TextureContent textureContent)
        {
            gameTime.ThrowIfNull("gameTime");
            spriteBatch.ThrowIfNull("spriteBatch");
            fontContent.ThrowIfNull("fontContent");
            textureContent.ThrowIfNull("textureContent");

            _gameTime       = gameTime;
            _spriteBatch    = spriteBatch;
            _fontContent    = fontContent;
            _textureContent = textureContent;
        }
예제 #8
0
        public void Update(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            var updaterParameters = new UpdaterParameters(gameTime, focus);

            // Must call ToArray() because collection could be modified during iteration
            foreach (IUpdater updater in _updaters.ToArray())
            {
                updater.Update(updaterParameters);
            }
        }
예제 #9
0
        public void Update(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            var updaterParameters = new UpdaterParameters(gameTime, focus);

            // Must call ToArray() because collection could be modified during iteration
            foreach (IUpdater updater in _updaters.ToArray())
            {
                updater.Update(updaterParameters);
            }
        }
예제 #10
0
        public RendererParameters(IXnaGameTime gameTime, SpriteBatch spriteBatch, FontContent fontContent, TextureContent textureContent)
        {
            gameTime.ThrowIfNull("gameTime");
            spriteBatch.ThrowIfNull("spriteBatch");
            fontContent.ThrowIfNull("fontContent");
            textureContent.ThrowIfNull("textureContent");

            _gameTime = gameTime;
            _spriteBatch = spriteBatch;
            _fontContent = fontContent;
            _textureContent = textureContent;
        }
        protected override void Update(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            ProcessWorldInstanceCommandQueue();

            UpdateFpsRendererState(gameTime.ElapsedGameTime);
            UpdateWorldTimeRendererState(gameTime);
            UpdateLogRendererState(gameTime);
            UpdateBoardRendererState();
            ProcessMessage(gameTime.TotalGameTime);

            _updaterCollection.Update(gameTime, _inputManager.Focus);
        }
        public void UpdateWorldTimes(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            if (Paused)
            {
                return;
            }

            TimeSpan elapsed = TimeSpan.FromTicks((long)(gameTime.ElapsedGameTime.Ticks * _speed));

            ElapsedWorldTime = elapsed;
            TotalWorldTime  += elapsed;
        }
예제 #13
0
        public void Render(SpriteBatch spriteBatch, IXnaGameTime gameTime, FontContent fontContent, TextureContent textureContent)
        {
            spriteBatch.ThrowIfNull("spriteBatch");
            gameTime.ThrowIfNull("gameTime");
            fontContent.ThrowIfNull("fontContent");
            textureContent.ThrowIfNull("textureContent");

            var parameters = new RendererParameters(gameTime, spriteBatch, fontContent, textureContent);

            // Must call ToArray() because collection could be modified during iteration
            foreach (IRenderer renderer in _renderers.ToArray())
            {
                renderer.Render(parameters);
            }
        }
        public void Render(SpriteBatch spriteBatch, IXnaGameTime gameTime, FontContent fontContent, TextureContent textureContent)
        {
            spriteBatch.ThrowIfNull("spriteBatch");
            gameTime.ThrowIfNull("gameTime");
            fontContent.ThrowIfNull("fontContent");
            textureContent.ThrowIfNull("textureContent");

            var parameters = new RendererParameters(gameTime, spriteBatch, fontContent, textureContent);

            // Must call ToArray() because collection could be modified during iteration
            foreach (IRenderer renderer in _renderers.ToArray())
            {
                renderer.Render(parameters);
            }
        }
예제 #15
0
        public void Update(UpdaterParameters parameters)
        {
            parameters.ThrowIfNull("parameters");

            _lastGameTime = parameters.GameTime;

            if (parameters.Focus != Focus.Message)
            {
                return;
            }

            _answerKeyboardStateHelper.Update();
            _scrollKeyboardStateHelper.Update();

            switch (_scrollKeyboardStateHelper.LastKeyDown)
            {
            case TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollUpKey:
                _messageRendererState.ScrollPosition -= TextAdventure.Xna.Constants.MessageRenderer.ScrollStep;
                break;

            case TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollDownKey:
                _messageRendererState.ScrollPosition += TextAdventure.Xna.Constants.MessageRenderer.ScrollStep;
                break;

            case TextAdventure.Xna.Constants.MessageRenderer.Input.HomeKey:
                _messageRendererState.ScrollPosition = 0f;
                break;

            case TextAdventure.Xna.Constants.MessageRenderer.Input.EndKey:
                _messageRendererState.ScrollPosition = Single.MaxValue;
                break;

            case TextAdventure.Xna.Constants.MessageRenderer.Input.PageUpKey:
                _messageRendererState.ScrollPosition -= _messageRendererState.VisibleHeight;
                break;

            case TextAdventure.Xna.Constants.MessageRenderer.Input.PageDownKey:
                _messageRendererState.ScrollPosition += _messageRendererState.VisibleHeight;
                break;
            }
        }
예제 #16
0
        public void Update(UpdaterParameters parameters)
        {
            parameters.ThrowIfNull("parameters");

            _lastGameTime = parameters.GameTime;

            if (parameters.Focus != Focus.Message)
            {
                return;
            }

            _answerKeyboardStateHelper.Update();
            _scrollKeyboardStateHelper.Update();

            switch (_scrollKeyboardStateHelper.LastKeyDown)
            {
                case TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollUpKey:
                    _messageRendererState.ScrollPosition -= TextAdventure.Xna.Constants.MessageRenderer.ScrollStep;
                    break;
                case TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollDownKey:
                    _messageRendererState.ScrollPosition += TextAdventure.Xna.Constants.MessageRenderer.ScrollStep;
                    break;
                case TextAdventure.Xna.Constants.MessageRenderer.Input.HomeKey:
                    _messageRendererState.ScrollPosition = 0f;
                    break;
                case TextAdventure.Xna.Constants.MessageRenderer.Input.EndKey:
                    _messageRendererState.ScrollPosition = Single.MaxValue;
                    break;
                case TextAdventure.Xna.Constants.MessageRenderer.Input.PageUpKey:
                    _messageRendererState.ScrollPosition -= _messageRendererState.VisibleHeight;
                    break;
                case TextAdventure.Xna.Constants.MessageRenderer.Input.PageDownKey:
                    _messageRendererState.ScrollPosition += _messageRendererState.VisibleHeight;
                    break;
            }
        }
예제 #17
0
 protected virtual void Update(IXnaGameTime gameTime)
 {
 }
 private void UpdateWorldTimeRendererState(IXnaGameTime gameTime)
 {
     _worldTimeRendererState.Visible = _worldTimeConfiguration.Visible;
     _worldTimeRendererState.UpdateWorldTimes(gameTime);
 }
 protected virtual void Draw(IXnaGameTime gameTime)
 {
 }
 protected virtual void Update(IXnaGameTime gameTime)
 {
 }
 private void UpdateLogRendererState(IXnaGameTime gameTime)
 {
     _logRendererState.Visible = _logConfiguration.Visible;
     _logRendererState.DequeueOldLogEntries(gameTime);
 }
 private void UpdateWorldTimeRendererState(IXnaGameTime gameTime)
 {
     _worldTimeRendererState.Visible = _worldTimeConfiguration.Visible;
     _worldTimeRendererState.UpdateWorldTimes(gameTime);
 }
 private void UpdateLogRendererState(IXnaGameTime gameTime)
 {
     _logRendererState.Visible = _logConfiguration.Visible;
     _logRendererState.DequeueOldLogEntries(gameTime);
 }
        private void MessageOpened(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageFadeInAndScaleUpdater);
            _messageFadeInAndScaleUpdater = null;

            _messageInputHandler = new MessageInputHandler(_worldInstance, _messageRendererState, gameTime.TotalGameTime, MessageClosing);
            _updaterCollection.Add(_messageInputHandler);

            _worldInstance.MessageMananger.MessageOpened(_messageRendererState.Message);
        }
        private void MessageClosing(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageInputHandler);
            _messageInputHandler = null;

            _messageFadeOutAndScaleUpdater = new MessageFadeOutAndScaleUpdater(_messageRendererState, gameTime.TotalGameTime, MessageClosed);
            _updaterCollection.Add(_messageFadeOutAndScaleUpdater);
        }
        protected override void Update(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            ProcessWorldInstanceCommandQueue();

            UpdateFpsRendererState(gameTime.ElapsedGameTime);
            UpdateWorldTimeRendererState(gameTime);
            UpdateLogRendererState(gameTime);
            UpdateBoardRendererState();
            ProcessMessage(gameTime.TotalGameTime);

            _updaterCollection.Update(gameTime, _inputManager.Focus);
        }
예제 #27
0
 protected virtual void Draw(IXnaGameTime gameTime)
 {
 }
        protected override void Draw(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            var spriteBatch = new SpriteBatch(GraphicsDevice);

            _rendererCollection.Render(spriteBatch, gameTime, _fontContent, _textureContent);

            spriteBatch.Dispose();
        }
        public void UpdateWorldTimes(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            if (Paused)
            {
                return;
            }

            TimeSpan elapsed = TimeSpan.FromTicks((long)(gameTime.ElapsedGameTime.Ticks * _speed));

            ElapsedWorldTime = elapsed;
            TotalWorldTime += elapsed;
        }