Example #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            //Update fps measurer
            Fps.Update(gameTime);

            GraphicsDevice.Clear(BackgroundColor);
            _spriteBatch.Begin(SpriteSortMode.Deferred, null);
            if (ScriptExecuter.IsInPlayingMovie)//Movie
            {
                ScriptExecuter.DrawVideo(_spriteBatch);
            }
            else
            {
                switch (GameState.State)
                {
                case GameState.StateType.Start:
                    break;

                case GameState.StateType.Title:
                    break;

                case GameState.StateType.Playing:
                    DrawGamePlay(gameTime);
                    if (Globals.ShowMapPos || Globals.ScriptShowMapPos)
                    {
                        DrawMapPos(_spriteBatch);
                    }
                    break;

                case GameState.StateType.EndAds:
                    DrawAds(gameTime);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                //GUI
                GuiManager.Draw(_spriteBatch);
            }

            if (IsInEditMode)
            {
                DrawGameInfo(_spriteBatch);
            }

            _spriteBatch.End();

            base.Draw(gameTime);
        }