コード例 #1
0
ファイル: MainMenuScreen.cs プロジェクト: rroveri/triolozzi
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("")
        {
            exitAction = new InputAction(
                new Buttons[] { Buttons.X, Buttons.Back },
                new Keys[] { Keys.Escape, Keys.X },
                true);

            optionsMenuEntry = new MenuEntry(_newGameTextures, _newGameSelectedTextures);
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            MenuEntries.Add(optionsMenuEntry);

            playersMenuEntry = new MenuEntry(_playersTextures, _playersSelectedTextures);
            playersMenuEntry.LeftClick += PlayersMenuEntryDecrement;
            playersMenuEntry.RightClick += PlayersMenuEntryIncrement;
            MenuEntries.Add(playersMenuEntry);

            resolutionMenuEntry = new MenuEntry(_resolutionTextures, _resolutionSelectedTextures);
            resolutionMenuEntry.LeftClick += ResolutionMenuEntryDecrement;
            resolutionMenuEntry.RightClick += ResolutionMenuEntryIncrement;
            MenuEntries.Add(resolutionMenuEntry);

            creditsMenuEntry = new MenuEntry(_creditsTextures, _creditsSelectedTextures);
            creditsMenuEntry.Selected += CreditsMenuEntrySelected;
            MenuEntries.Add(creditsMenuEntry);

            _exitButton = GameServices.GetService<ContentManager>().Load<Texture2D>("Images/MainMenu/exit_menu");
            _exitButtonPosition = new Vector2(100, 850);

            GameServices.GetService<SoundManager>().PlaySong(SoundManager.MenuSong, true);
        }
コード例 #2
0
ファイル: PauseMenuScreen.cs プロジェクト: rroveri/triolozzi
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen()
            : base("")
        {
            // Create our menu entries.
            MenuEntry resumeGameMenuEntry = new MenuEntry(_resumeTextures, _resumeTexturesSelected);
            MenuEntry quitGameMenuEntry = new MenuEntry(_quitTextures, _quitTexturesSelected);

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

            // Add entries to the menu.
            MenuEntries.Add(resumeGameMenuEntry);
            MenuEntries.Add(quitGameMenuEntry);

            // Prepare the dialog for quitting the game.
            QuitDialog = new MessageBoxScreen();
            QuitDialog.Accepted += ConfirmQuitMessageBoxAccepted;
        }