/// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen()
            : base("Options")
        {
            // Create our menu entries.
            ungulateMenuEntry = new MenuEntry(string.Empty);
            languageMenuEntry = new MenuEntry(string.Empty);
            frobnicateMenuEntry = new MenuEntry(string.Empty);
            elfMenuEntry = new MenuEntry(string.Empty);

            SetMenuEntryText();

            MenuEntry backMenuEntry = new MenuEntry("Back");

            // Hook up menu event handlers.
            ungulateMenuEntry.Selected += UngulateMenuEntrySelected;
            languageMenuEntry.Selected += LanguageMenuEntrySelected;
            frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected;
            elfMenuEntry.Selected += ElfMenuEntrySelected;
            backMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(ungulateMenuEntry);
            MenuEntries.Add(languageMenuEntry);
            MenuEntries.Add(frobnicateMenuEntry);
            MenuEntries.Add(elfMenuEntry);
            MenuEntries.Add(backMenuEntry);
        }
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("The Parchment Dragon")
        {
            // Create our menu entries.
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            // MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            // optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            // MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen()
            : base("Paused")
        {
            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;

            // Create our menu entries.
            MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
            MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");

            // Hook up menu event handlers.
            resumeGameMenuEntry.Selected += OnCancel;
            quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(resumeGameMenuEntry);
            MenuEntries.Add(quitGameMenuEntry);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameOverScreen(PlayerCharacter pc)
            : base("Game Over")
        {
            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;

            // Create our menu entries.
            MenuEntry continueYes = new MenuEntry("Yes");
            MenuEntry continueNo = new MenuEntry("No");
            this.pc = pc;

            // Hook up menu event handlers.
            continueYes.Selected += BackToGameSelected;
            continueNo.Selected += BackToMenuSelected;

            // Add entries to the menu.
            MenuEntries.Add(continueYes);
            MenuEntries.Add(continueNo);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public StageEndScreen(PlayerCharacter pc, bool final, int nextstage)
            : base("Game Clear")
        {
            isFinalStage = final;
            this.nextstage = nextstage;

            // Create our menu entries.
            if(!isFinalStage) {
                MenuEntry nextStage = new MenuEntry("Next Stage");
                nextStage.Selected += NextStageSelected;
                MenuEntries.Add(nextStage);
            }
            else {
                MenuEntry playAgainYes = new MenuEntry("Yes");
                MenuEntry playAgainNo = new MenuEntry("No");
                playAgainYes.Selected += BackToGameSelected;
                playAgainNo.Selected += BackToMenuSelected;
                MenuEntries.Add(playAgainYes);
                MenuEntries.Add(playAgainNo);
            }
            this.pc = pc;
        }
Exemple #6
0
        /// <summary>
        /// Draws the pause menu screen. This darkens down the gameplay screen
        /// that is underneath us, and then chains to the base MenuScreen.Draw.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont  font        = ScreenManager.Font;

            Vector2 position = new Vector2(400, 450);
            Vector2 scorePos = new Vector2(400, 200);
            Vector2 contPos  = new Vector2(400, 375);
            // Make the menu slide into place during transitions, using a
            // power curve to make things look more interesting (this makes
            // the movement slow down as it nears the end).
            float transitionOffset = (float)Math.Pow(TransitionPosition, 2);

            if (ScreenState == ScreenState.TransitionOn)
            {
                position.X -= transitionOffset * 256;
                scorePos.X -= transitionOffset * 256;
                contPos.X  -= transitionOffset * 256;
            }
            else
            {
                position.X += transitionOffset * 512;
                scorePos.X += transitionOffset * 512;
                contPos.X  += transitionOffset * 512;
            }

            spriteBatch.Begin();

            // Draw each menu entry in turn.
            for (int i = 0; i < menuEntries.Count; i++)
            {
                MenuEntry menuEntry = menuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.DrawCenter(this, position, isSelected, gameTime);

                position.Y += menuEntry.GetHeight(this);
            }

            // Draw the menu title.
            Vector2 titlePosition = new Vector2(400, 80);
            Vector2 titleOrigin   = font.MeasureString(menuTitle) / 2;
            Color   titleColor    = new Color(0, 0, 0, TransitionAlpha);
            float   titleScale    = 1.25f;

            titlePosition.Y -= transitionOffset * 100;
            String title;

            if (!isFinalStage)
            {
                title = "Stage " + String.Format("{0:d}", nextstage - 1);
            }
            else
            {
                title = menuTitle;
            }

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

            String  score       = "Score: " + String.Format("{0:d}", pc.getScore());
            Vector2 scoreOrigin = font.MeasureString(score) / 2;

            spriteBatch.DrawString(font, score, scorePos, Color.Black, 0, scoreOrigin, 1, SpriteEffects.None, 0);

            if (isFinalStage)
            {
                String  cont       = "Play Again?";
                Vector2 contOrigin = font.MeasureString(cont) / 2;
                spriteBatch.DrawString(font, cont, contPos, Color.Black, 0, contOrigin, 1, SpriteEffects.None, 0);
                spriteBatch.End();
            }
        }