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(); }
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; }
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); } }
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; }
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 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; } }
protected virtual void Update(IXnaGameTime gameTime) { }
private void UpdateWorldTimeRendererState(IXnaGameTime gameTime) { _worldTimeRendererState.Visible = _worldTimeConfiguration.Visible; _worldTimeRendererState.UpdateWorldTimes(gameTime); }
protected virtual void Draw(IXnaGameTime gameTime) { }
private void UpdateLogRendererState(IXnaGameTime gameTime) { _logRendererState.Visible = _logConfiguration.Visible; _logRendererState.DequeueOldLogEntries(gameTime); }