/// <summary>
        /// Event handler for when an available session menu entry is selected.
        /// </summary>
        void AvailableSessionMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            // Which menu entry was selected?
            AvailableSessionMenuEntry menuEntry = (AvailableSessionMenuEntry)sender;
            AvailableNetworkSession availableSession = menuEntry.AvailableSession;

            try
            {
                // Begin an asynchronous join network session operation.
                IAsyncResult asyncResult = NetworkSession.BeginJoin(availableSession,
                                                                    null, null);

                // Activate the network busy screen, which will display
                // an animation until this operation has completed.
                NetworkBusyScreen busyScreen = new NetworkBusyScreen(asyncResult);

                busyScreen.OperationCompleted += JoinSessionOperationCompleted;

                ScreenManager.AddScreen(busyScreen, ControllingPlayer);
            }
            catch (Exception exception)
            {
                NetworkErrorScreen errorScreen = new NetworkErrorScreen(exception);

                ScreenManager.AddScreen(errorScreen, ControllingPlayer);
            }
        }
        /// <summary>
        /// Event handler for when the Create Session menu entry is selected.
        /// </summary>
        void CreateSessionMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            try
            {
                // Which local profiles should we include in this session?
                IEnumerable<SignedInGamer> localGamers =
                        NetworkSessionComponent.ChooseGamers(sessionType,
                                                             ControllingPlayer.Value);

                // Begin an asynchronous create network session operation.
                IAsyncResult asyncResult = NetworkSession.BeginCreate(
                                                    sessionType, localGamers,
                                                    NetworkSessionComponent.MaxGamers,
                                                    0, null, null, null);

                // Activate the network busy screen, which will display
                // an animation until this operation has completed.
                NetworkBusyScreen busyScreen = new NetworkBusyScreen(asyncResult);

                busyScreen.OperationCompleted += CreateSessionOperationCompleted;

                ScreenManager.AddScreen(busyScreen, ControllingPlayer);
            }
            catch (Exception exception)
            {
                NetworkErrorScreen errorScreen = new NetworkErrorScreen(exception);

                ScreenManager.AddScreen(errorScreen, ControllingPlayer);
            }
        }
Пример #3
0
		/// <summary>
		/// Event handler for when the Quit Game menu entry is selected.
		/// </summary>
		void QuitGameMenuEntrySelected (object sender, PlayerIndexEventArgs e)
		{
			MessageBoxScreen confirmQuitMessageBox = 
				new MessageBoxScreen (Resources.ConfirmQuitGame);

			confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

			ScreenManager.AddScreen (confirmQuitMessageBox, ControllingPlayer);
		}
 /// <summary>
 /// Event handler for when the Exit To Windows is selected
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ExitToWindowsSelected(object sender, PlayerIndexEventArgs e)
 {
     this.ScreenManager.Game.Exit();
 }
Пример #5
0
		/// <summary>
		/// Event handler for when the System Link menu entry is selected.
		/// </summary>
		void SystemLinkMenuEntrySelected (object sender, PlayerIndexEventArgs e)
		{
			CreateOrFindSession (NetworkSessionType.SystemLink, e.PlayerIndex);
		}
Пример #6
0
 void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                    new MainMenuScreen());
     MediaPlayer.Play(Game1.songLiberty.background);
     Game1.level.Destroy();
 }
 /// <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);
 }
Пример #8
0
 void CancelledEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ExitScreen();
 }
Пример #9
0
 void CancelledEntrySelected(object sender, PlayerIndexEventArgs e)
 {
 }
 /// <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());
 }
Пример #11
0
 void HandleControlMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new HandleControl(), e.PlayerIndex);
 }
Пример #12
0
 void fullScreenVideoMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     if (!Game1.graphics.IsFullScreen)
         MenuEntries[0].Text = Mario.Resource.smallScreenSettings;
      else
         MenuEntries[0].Text = Mario.Resource.fullScreenSettings;
     Game1.graphics.ToggleFullScreen();
 }
Пример #13
0
 void effectSoundEntrySelected(object sender, PlayerIndexEventArgs e)
 {
 }
Пример #14
0
 void ConfirmMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     MediaPlayer.Volume = Game1.songLiberty.VolumeMusic;
     Game1.SetSetting.SettingSetToFile();
     ExitScreen();
 }
Пример #15
0
 void BackMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ExitScreen();
 }
 /// <summary>
 /// Event handler for when the End/Leave Session menu entry is selected.
 /// </summary>
 void LeaveSessionMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     NetworkSessionComponent.LeaveSession(ScreenManager, e.PlayerIndex);
 }
Пример #17
0
 void musicSoundMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
 }
 /// <summary>
 /// Event handler for when the Return to Lobby menu entry is selected.
 /// </summary>
 void ReturnToLobbyMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     if (networkSession.SessionState == NetworkSessionState.Playing)
     {
         networkSession.EndGame();
     }
 }
Пример #19
0
 void DevelopersMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     DevelopersScreen developersScreen = new DevelopersScreen(Mario.Resource.DevelopersText);
     developersScreen.Accepted += ConfirmExitMessageBoxAccepted;
     ScreenManager.AddScreen(developersScreen, null);
 }
Пример #20
0
 void AcceptedEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     if (chPlayer == 1) Game1.heroChoice = heroChoice;
      else
       {
           Game1.heroChoice2 = heroChoice;
           LoadingScreen.Load(ScreenManager, true, null);
           ScreenManager.AddScreen(new ProfileScreen(), null);
           Mario.Game1.isStart = true;
       }
     if (!Game1.isTwoPlayers)
     {
         LoadingScreen.Load(ScreenManager, true, null);
         ScreenManager.AddScreen(new ProfileScreen(), null);
         Mario.Game1.isStart = true;
     }
     if (Game1.isTwoPlayers && chPlayer == 1) ScreenManager.AddScreen(new ElectoralCharacter(2), e.PlayerIndex);
     ExitScreen();
 }
Пример #21
0
 void twoPlayerMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     // LoadingScreen.Load(ScreenManager, true, e.PlayerIndex);
     // ScreenManager.AddScreen(new GameplayScreen(), e.PlayerIndex);
     Mario.Game1.isPaused = false;
     Mario.Game1.isTwoPlayers = true;
     ScreenManager.AddScreen(new ElectoralCharacter(), e.PlayerIndex);
 }
Пример #22
0
 void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.Game.Exit();
 }
Пример #23
0
 void OnCancel(object sender, PlayerIndexEventArgs e)
 {
     Mario.Game1.isPaused = false;
     ExitScreen();
 }
Пример #24
0
 void SettingsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new SettingsScreen(), e.PlayerIndex);
 }
 /// <summary>
 /// Event handler for when the host selects ok on the "are you sure
 /// you want to start even though not everyone is ready" message box.
 /// </summary>
 void ConfirmStartGameMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     if (networkSession.SessionState == NetworkSessionState.Lobby)
     {
         networkSession.StartGame();
     }
 }
Пример #26
0
		/// <summary>
		/// Event handler for when the Single Player menu entry is selected.
		/// </summary>
		void SinglePlayerMenuEntrySelected (object sender, PlayerIndexEventArgs e)
		{
			LoadingScreen.Load (ScreenManager, true, e.PlayerIndex, 
				new GameplayScreen (null));
		}
Пример #27
0
		/// <summary>
		/// Event handler for when the Live menu entry is selected.
		/// </summary>
		void LiveMenuEntrySelected (object sender, PlayerIndexEventArgs e)
		{
			CreateOrFindSession (NetworkSessionType.PlayerMatch, e.PlayerIndex);
		}
Пример #28
0
		/// <summary>
		/// Event handler for when the Back menu entry is selected.
		/// </summary>
		void BackMenuEntrySelected (object sender, PlayerIndexEventArgs e)
		{
			availableSessions.Dispose ();

			ExitScreen ();
		}
Пример #29
0
 void AcceptedEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     Exit();
 }