コード例 #1
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
        {
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            exitMenuEntry.Selected += ExitMenuEntrySelected;

            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }
コード例 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen()
        {
            MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
            MenuEntry quitGameEntry = new MenuEntry("Quit Game");

            resumeGameMenuEntry.Selected += ResumeGameMenuEntrySelected;
            quitGameEntry.Selected += QuitGameEntrySelected;

            MenuEntries.Add(resumeGameMenuEntry);
            MenuEntries.Add(quitGameEntry);

            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;
        }
コード例 #3
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public GameOverScreen(string message)
        {
            this.message = message;

            MenuEntry playAgainMenuEntry = new MenuEntry("Play Again");
            MenuEntry returnToMenuMenuEntry = new MenuEntry("Return to Menu");

            playAgainMenuEntry.Selected += PlayAgainMenuEntrySelected;
            returnToMenuMenuEntry.Selected += ReturnToMenuMenuEntrySelected;

            MenuEntries.Add(playAgainMenuEntry);
            MenuEntries.Add(returnToMenuMenuEntry);

            TransitionOnTime = TimeSpan.FromSeconds(1.0);
            TransitionOffTime = TimeSpan.FromSeconds(1.0);
            IsPopup = true;
        }