Exemple #1
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel()
        {
            //ScreenManager.Game.Exit();
            const string message = "Are you sure you want to exit?";

            MessageBoxScreen messageBox = new MessageBoxScreen(message);

            messageBox.Accepted += ExitMessageBoxAccepted;

            ScreenManager.AddScreen(messageBox);
        }
Exemple #2
0
        /// <summary>
        /// Responds to user menu selections.
        /// </summary>
        protected override void OnSelectEntry(int entryIndex)
        {
            switch (entryIndex)
            {
                case 0:
                    // Resume the game.
                    if (MenuEntries[0] == "Resume")
                        ExitScreen();
                    else
                        ScreenManager.RemoveScreens();
                        ScreenManager.AddScreen(new GameplayScreen());
                    break;

                case 1:
                    if (MenuEntries[0] == "Resume")
                    {
                        // Quit the game, after a confirmation message box.
                        const string message = "Are you sure you want to quit?";

                        MessageBoxScreen messageBox = new MessageBoxScreen(message);

                        messageBox.Accepted += LoadMainMenuScreen;

                        ScreenManager.AddScreen(messageBox);
                    }
                    else
                        LoadMainMenuScreen(null, null);
                    break;
            }
        }