コード例 #1
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
コード例 #2
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow,
                                PlayerIndex? controllingPlayer,
                                params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
                screen.ExitScreen();

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager,
                                                            loadingIsSlow,
                                                            screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
コード例 #3
0
        /// <summary>
        /// This is called when the movie should draw itself.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            float transitionOffset = (float)Math.Pow(TransitionPosition, 2);

            spriteBatch.Begin();

            spriteBatch.Draw(background, Vector2.Zero, Color.White);

            // Draw a black, semi-transparent, background to see the text better
            spriteBatch.Draw(blank, new Rectangle(10, 140, 582, 285), new Color(Color.Black, 100));

            #region Draw Title
            // Draw the menu title.
            Vector2 titlePosition = new Vector2(426, 80);
            Vector2 titleOrigin   = font.MeasureString(menuTitle) / 2;
            //Color titleColor = new Color(192, 192, 192, TransitionAlpha);
            Color titleColor = Color.LightCyan;
            float titleScale = 1.25f;

            titlePosition.Y -= transitionOffset * 100;

            spriteBatch.DrawString(font, menuTitle, titlePosition, titleColor, 0,
                                   titleOrigin, titleScale, SpriteEffects.None, 0);

            #endregion

            spriteBatch.DrawString(smallfont, "The aim of the game is simple: eat the fish and avoid the mines", new Vector2(20, 150), Color.White);

            spriteBatch.DrawString(smallfont, "Gray mines will cause instant damage", new Vector2(20, 165), Color.Tomato);
            spriteBatch.DrawString(smallfont, "Yellow/Green mines will poison you. Poison will cause damage over time.", new Vector2(20, 180), Color.YellowGreen);
            spriteBatch.DrawString(smallfont, "When you are poisoned, one fish will turn green. You must eat this fish to be cured.", new Vector2(40, 195), Color.YellowGreen);

            spriteBatch.DrawString(smallfont, "Power-Ups: these can be eaten to provide different beneficial effects", new Vector2(20, 225), Color.White);

            Vector2 puPos = new Vector2(50, 230);
            foreach (PowerUp pu in powerUps)
            {
                puPos += new Vector2(0, 25);
                spriteBatch.Draw(blank,
                                 puPos,
                                 pu.Rectangle,
                                 pu.Color,
                                 0, new Vector2(30, 10), 1,
                                 SpriteEffects.None,
                                 0);
                spriteBatch.DrawString(smallfont, pu.DisplayName, puPos - new Vector2(29, 11), new Color(Color.Black, 175));
            }

            spriteBatch.DrawString(smallfont, "Health +5", new Vector2(87, 248), Color.LightGreen);
            spriteBatch.DrawString(smallfont, "Health +10", new Vector2(87, 273), Color.LightGreen);
            spriteBatch.DrawString(smallfont, "Health +25", new Vector2(87, 298), Color.LightGreen);
            spriteBatch.DrawString(smallfont, "No Chase - while active, mines won't chase you when you get close.", new Vector2(87, 323), Color.LightSkyBlue);
            spriteBatch.DrawString(smallfont, "Repel - while active, mines will move away from you.", new Vector2(87, 348), Color.LightPink);
            spriteBatch.DrawString(smallfont, "Slow Fish - while active, fish will move slower.", new Vector2(87, 373), Color.Yellow);
            spriteBatch.DrawString(smallfont, "Slow Mines - while active, mines will move slower.", new Vector2(87, 398), Color.Salmon);

            spriteBatch.End();

            // If the screen is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0)
            {
                ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
            }
        }