コード例 #1
0
        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;
        }
コード例 #3
0
        private void MessageClosing(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageInputHandler);
            _messageInputHandler = null;

            _messageFadeOutAndScaleUpdater = new MessageFadeOutAndScaleUpdater(_messageRendererState, gameTime.TotalGameTime, MessageClosed);
            _updaterCollection.Add(_messageFadeOutAndScaleUpdater);
        }
コード例 #4
0
        public void DequeueOldLogEntries(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            while (_logEntries.Any() && gameTime.TotalGameTime - _logEntries.Peek().LoggedTotalWorldTime > LogEntryLifetime)
            {
                _logEntries.Dequeue();
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
            }
        }
コード例 #14
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);
            }
        }
コード例 #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)
 {
 }
コード例 #18
0
 private void UpdateWorldTimeRendererState(IXnaGameTime gameTime)
 {
     _worldTimeRendererState.Visible = _worldTimeConfiguration.Visible;
     _worldTimeRendererState.UpdateWorldTimes(gameTime);
 }
コード例 #19
0
 protected virtual void Draw(IXnaGameTime gameTime)
 {
 }
コード例 #20
0
 protected virtual void Update(IXnaGameTime gameTime)
 {
 }
コード例 #21
0
 private void UpdateLogRendererState(IXnaGameTime gameTime)
 {
     _logRendererState.Visible = _logConfiguration.Visible;
     _logRendererState.DequeueOldLogEntries(gameTime);
 }
コード例 #22
0
 private void UpdateWorldTimeRendererState(IXnaGameTime gameTime)
 {
     _worldTimeRendererState.Visible = _worldTimeConfiguration.Visible;
     _worldTimeRendererState.UpdateWorldTimes(gameTime);
 }
コード例 #23
0
 private void UpdateLogRendererState(IXnaGameTime gameTime)
 {
     _logRendererState.Visible = _logConfiguration.Visible;
     _logRendererState.DequeueOldLogEntries(gameTime);
 }
コード例 #24
0
        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);
        }
コード例 #25
0
        private void MessageClosing(IXnaGameTime gameTime)
        {
            _updaterCollection.Remove(_messageInputHandler);
            _messageInputHandler = null;

            _messageFadeOutAndScaleUpdater = new MessageFadeOutAndScaleUpdater(_messageRendererState, gameTime.TotalGameTime, MessageClosed);
            _updaterCollection.Add(_messageFadeOutAndScaleUpdater);
        }
コード例 #26
0
        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)
 {
 }
コード例 #28
0
        protected override void Draw(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            var spriteBatch = new SpriteBatch(GraphicsDevice);

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

            spriteBatch.Dispose();
        }
コード例 #29
0
        public void UpdateWorldTimes(IXnaGameTime gameTime)
        {
            gameTime.ThrowIfNull("gameTime");

            if (Paused)
            {
                return;
            }

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

            ElapsedWorldTime = elapsed;
            TotalWorldTime += elapsed;
        }