Esempio n. 1
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit the game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Esempio n. 2
0
        void RunGame(PlayerIndexEventArgs e, int totalPlayers)
        {
            int[] playerLives = new int[totalPlayers];
            for (int i = 0; i < totalPlayers; i++)
                playerLives[i] = -1;
            int[] playerScores = new int[totalPlayers];
            for (int i = 0; i < totalPlayers; i++)
                playerScores[i] = 0;
            Sprite_Elements.Weapon[][] playerWeapons = new Sprite_Elements.Weapon[totalPlayers][];

            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen(3, totalPlayers, playerLives, playerScores, playerWeapons));
        }
Esempio n. 3
0
 /// <summary>
 /// Event handler for when the user selects ok on the "are you sure
 /// you want to quit" message box. This uses the loading screen to
 /// transition from the game back to the main menu screen.
 /// </summary>
 void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                    new MainMenuScreen());
 }
Esempio n. 4
0
 /// <summary>
 /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler.
 /// </summary>
 protected void OnCancel(object sender, PlayerIndexEventArgs e)
 {
     OnCancel(e.PlayerIndex);
 }
Esempio n. 5
0
 void PlayGameMenuEntrySelected2(object sender, PlayerIndexEventArgs e)
 {
     //set up defaults for level session information
     int totalPlayers = 2;
     RunGame(e, totalPlayers);
 }
Esempio n. 6
0
 /// <summary>
 /// Event handler for when the user selects ok on the "are you sure
 /// you want to exit" message box.
 /// </summary>
 void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.Game.Exit();
 }