private void ProcessMessage(TimeSpan totalGameTime) { bool processingMessage = _messageRenderer != null; bool messageAvailable = !_worldInstance.WorldTime.Paused && _worldInstance.MessageMananger.Count > 0; if (processingMessage || !messageAvailable) { return; } _messageRendererState = new MessageRendererState { Message = _worldInstance.MessageMananger.DequeueMessage() }; _messageRenderer = new MessageRenderer(_messageRendererState); _messageFadeInAndScaleUpdater = new MessageFadeInAndScaleUpdater(_messageRendererState, totalGameTime, MessageOpened); _rendererCollection.Add(_messageRenderer); _updaterCollection.Add(_messageFadeInAndScaleUpdater); _inputManager.ClaimFocus(Focus.Message); }
private void MessageClosed() { IMessage message = _messageRendererState.Message; _updaterCollection.Remove(_messageFadeOutAndScaleUpdater); _rendererCollection.Remove(_messageRenderer); _messageFadeOutAndScaleUpdater = null; _messageRenderer = null; _messageRendererState = null; _inputManager.RelinquishFocus(); _worldInstance.MessageMananger.MessageClosed(message); }