Ejemplo n.º 1
0
        /// <summary>
        /// Draws the loading screen
        /// </summary>
        /// <param name="aGameTime"></param>
        public override void Draw(GameTime aGameTime)
        {
            // If we are the only active screen, that means all the previous screens
            // must have finished transitioning off. We check for this in the Draw
            // method, rather than in Update, because it isn't enough just for the
            // screens to be gone: in order for the transition to look good we must
            // have actually drawn a frame without them before we perform the load.
            if ((ScreenState == ScreenState.Active) &&
                (ScreenManager.GetScreens().Length == 1))
            {
                mOtherScreensAreGone = true;
            }

            // The gameplay screen takes a while to load, so we display a loading
            // message while that is going on, but the menus load very quickly, and
            // it would look silly if we flashed this up for just a fraction of a
            // second while returning from the game to the menus. This parameter
            // tells us how long the loading is going to take, so we know whether
            // to bother drawing the message.
            if (mLoadingIsSlow)
            {
                SpriteBatch lSpriteBatch = ScreenManager.SpriteBatch;

                //Center the text in the viewport
                Viewport lViewport     = ScreenManager.GraphicsDevice.Viewport;
                Vector2  lViewportSize = new Vector2(lViewport.Width, lViewport.Height);

                Color lColor = new Color(255, 255, 255, TransitionAlpha);

                lSpriteBatch.Begin();
                lSpriteBatch.Draw(mLoadingBlackTexture, mLoadingBlackTextureDestination, Color.White);
                lSpriteBatch.Draw(mLoadingTexture, mLoadingPos, Color.White);
                lSpriteBatch.End();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Activates the loading screen. Will transition all currently active screens off.
        /// </summary>
        /// <param name="aScreenManager"></param>
        /// <param name="aLoadingIsSlow"></param>
        /// <param name="aScreensToLoad"></param>
        public static void Load(ScreenManager aScreenManager, bool aLoadingIsSlow, params GameScreen[] aScreensToLoad)
        {
            //Tell all the current screens to transition off
            foreach(GameScreen lScreen in aScreenManager.GetScreens())
            {
                lScreen.ExitScreen();
            }

            //Create and activate the loading screen
            LoadingScreen lLoadingScreen = new LoadingScreen(aScreenManager, aLoadingIsSlow, aScreensToLoad);
            aScreenManager.AddScreen(lLoadingScreen);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Activates the loading screen. Will transition all currently active screens off.
        /// </summary>
        /// <param name="aScreenManager"></param>
        /// <param name="aLoadingIsSlow"></param>
        /// <param name="aScreensToLoad"></param>
        public static void Load(ScreenManager aScreenManager, bool aLoadingIsSlow, params GameScreen[] aScreensToLoad)
        {
            //Tell all the current screens to transition off
            foreach (GameScreen lScreen in aScreenManager.GetScreens())
            {
                lScreen.ExitScreen();
            }

            //Create and activate the loading screen
            LoadingScreen lLoadingScreen = new LoadingScreen(aScreenManager, aLoadingIsSlow, aScreensToLoad);

            aScreenManager.AddScreen(lLoadingScreen);
        }