/// <summary>
        /// Constructs a menu screen listing the available network sessions.
        /// </summary>
        public JoinSessionScreen(AvailableNetworkSessionCollection availableSessions)
            : base(Resources.JoinSession)
        {
            this.availableSessions = availableSessions;

            foreach (AvailableNetworkSession availableSession in availableSessions)
            {
                // Create menu entries for each available session.
                MenuEntry menuEntry = new AvailableSessionMenuEntry(availableSession);
                menuEntry.Selected += AvailableSessionMenuEntrySelected;
                MenuEntries.Add(menuEntry);

                // Matchmaking can return up to 25 available sessions at a time, but
                // we don't have room to fit that many on the screen. In a perfect
                // world we should make the menu scroll if there are too many, but it
                // is easier to just not bother displaying more than we have room for.
                if (MenuEntries.Count >= MaxSearchResults)
                    break;
            }

            // Add the Back menu entry.
            MenuEntry backMenuEntry = new MenuEntry(Resources.Back);
            backMenuEntry.Selected += BackMenuEntrySelected;
            MenuEntries.Add(backMenuEntry);
        }
예제 #2
0
        public MainMenuScreen()
            : base("")
        {
            MediaPlayer.Play(Game1.songLiberty.background);

            // Create our menu entries.
            MenuEntry singlePlayerMenuEntry = new MenuEntry(Mario.Resource.SinglePlayer);
            MenuEntry twoPlayerMenuEntry = new MenuEntry(Mario.Resource.TwoPlayers);
            MenuEntry SettingsMenuEntry = new MenuEntry(Mario.Resource.Settings);
            MenuEntry Developers = new MenuEntry(Mario.Resource.Developers);
            MenuEntry exitMenuEntry = new MenuEntry(Mario.Resource.Exit);

            // Hook up menu event handlers.
            singlePlayerMenuEntry.Selected += SinglePlayerMenuEntrySelected;
            twoPlayerMenuEntry.Selected += twoPlayerMenuEntrySelected;
            SettingsMenuEntry.Selected += SettingsMenuEntrySelected;
            Developers.Selected += DevelopersMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(singlePlayerMenuEntry);
            MenuEntries.Add(twoPlayerMenuEntry);
            MenuEntries.Add(SettingsMenuEntry);
            MenuEntries.Add(Developers);
            MenuEntries.Add(exitMenuEntry);
        }
예제 #3
0
		/// <summary>
		/// Constructor.
		/// </summary>
		public PauseMenuScreen (NetworkSession networkSession)
		: base(Resources.Paused)
			{
			this.networkSession = networkSession;

			// Add the Resume Game menu entry.
			MenuEntry resumeGameMenuEntry = new MenuEntry (Resources.ResumeGame);
			resumeGameMenuEntry.Selected += OnCancel;
			MenuEntries.Add (resumeGameMenuEntry);

			if (networkSession == null) {
				// If this is a single player game, add the Quit menu entry.
				MenuEntry quitGameMenuEntry = new MenuEntry (Resources.QuitGame);
				quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
				MenuEntries.Add (quitGameMenuEntry);
			} else {
				// If we are hosting a network game, add the Return to Lobby menu entry.
				if (networkSession.IsHost) {
					MenuEntry lobbyMenuEntry = new MenuEntry (Resources.ReturnToLobby);
					lobbyMenuEntry.Selected += ReturnToLobbyMenuEntrySelected;
					MenuEntries.Add (lobbyMenuEntry);
				}

				// Add the End/Leave Session menu entry.
				string leaveEntryText = networkSession.IsHost ? Resources.EndSession : 
								Resources.LeaveSession;

				MenuEntry leaveSessionMenuEntry = new MenuEntry (leaveEntryText);
				leaveSessionMenuEntry.Selected += LeaveSessionMenuEntrySelected;
				MenuEntries.Add (leaveSessionMenuEntry);
			}
		}
예제 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen()
            : base(Mario.Resource.Paused)
        {
            MenuEntry resumeGameMenuEntry = new MenuEntry(Mario.Resource.ResumeGame);
            resumeGameMenuEntry.Selected += OnCancel;
            MenuEntries.Add(resumeGameMenuEntry);

            MenuEntry SettingsMenuEntry = new MenuEntry(Mario.Resource.Settings);
            SettingsMenuEntry.Selected += SettingsMenuEntrySelected;
            MenuEntries.Add(SettingsMenuEntry);

            MenuEntry quitGameMenuEntry = new MenuEntry(Mario.Resource.QuitGame);
            quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
            MenuEntries.Add(quitGameMenuEntry);

            Game1.isPaused = true;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen(NetworkSession networkSession)
            : base(Resources.Paused)
        {
            this.networkSession = networkSession;

            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;

            // Add the Resume Game menu entry.
            MenuEntry resumeGameMenuEntry = new MenuEntry(Resources.ResumeGame);
            resumeGameMenuEntry.Selected += OnCancel;
            MenuEntries.Add(resumeGameMenuEntry);

            // MODIFIED : Only allow exit to windows option once game has begun.
            MenuEntry exitToWindowsEntry = new MenuEntry(Resources.ExitToWindows);
            exitToWindowsEntry.Selected += ExitToWindowsSelected;
            MenuEntries.Add(exitToWindowsEntry);

            //if (networkSession == null)
            //{
            //    // If this is a single player game, add the Quit menu entry.
            //    MenuEntry quitGameMenuEntry = new MenuEntry(Resources.QuitGame);
            //    quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
            //    MenuEntries.Add(quitGameMenuEntry);
            //}
            //else
            //{
            //    // If we are hosting a network game, add the Return to Lobby menu entry.
            //    if (networkSession.IsHost)
            //    {
            //        MenuEntry lobbyMenuEntry = new MenuEntry(Resources.ReturnToLobby);
            //        lobbyMenuEntry.Selected += ReturnToLobbyMenuEntrySelected;
            //        MenuEntries.Add(lobbyMenuEntry);
            //    }

            //    // Add the End/Leave Session menu entry.
            //    string leaveEntryText = networkSession.IsHost ? Resources.EndSession :
            //                                                    Resources.LeaveSession;

            //    MenuEntry leaveSessionMenuEntry = new MenuEntry(leaveEntryText);
            //    leaveSessionMenuEntry.Selected += LeaveSessionMenuEntrySelected;
            //    MenuEntries.Add(leaveSessionMenuEntry);
            //}
        }
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public CreateOrFindSessionScreen(NetworkSessionType sessionType)
            : base(GetMenuTitle(sessionType))
        {
            this.sessionType = sessionType;

            // Create our menu entries.
            MenuEntry createSessionMenuEntry = new MenuEntry(Resources.CreateSession);
            MenuEntry findSessionsMenuEntry = new MenuEntry(Resources.FindSessions);
            MenuEntry backMenuEntry = new MenuEntry(Resources.Back);

            // Hook up menu event handlers.
            createSessionMenuEntry.Selected += CreateSessionMenuEntrySelected;
            findSessionsMenuEntry.Selected += FindSessionsMenuEntrySelected;
            backMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(createSessionMenuEntry);
            MenuEntries.Add(findSessionsMenuEntry);
            MenuEntries.Add(backMenuEntry);
        }
예제 #7
0
		/// <summary>
		/// Constructor fills in the menu contents.
		/// </summary>
		public MainMenuScreen ()
		: base(Resources.MainMenu)
			{
			// Create our menu entries.
			MenuEntry singlePlayerMenuEntry = new MenuEntry (Resources.SinglePlayer);
			MenuEntry liveMenuEntry = new MenuEntry (Resources.PlayerMatch);
			MenuEntry systemLinkMenuEntry = new MenuEntry (Resources.SystemLink);
			MenuEntry exitMenuEntry = new MenuEntry (Resources.Exit);

			// Hook up menu event handlers.
			singlePlayerMenuEntry.Selected += SinglePlayerMenuEntrySelected;
			liveMenuEntry.Selected += LiveMenuEntrySelected;
			systemLinkMenuEntry.Selected += SystemLinkMenuEntrySelected;
			exitMenuEntry.Selected += OnCancel;

			// Add entries to the menu.
			MenuEntries.Add (singlePlayerMenuEntry);
			MenuEntries.Add (liveMenuEntry);
			MenuEntries.Add (systemLinkMenuEntry);
			MenuEntries.Add (exitMenuEntry);
		}
예제 #8
0
        public SettingsScreen()
            : base(Mario.Resource.Settings)
        {
            // Create our menu entries.
             MenuEntry fullScreenVideoMenuEntry;
            if (Game1.graphics.IsFullScreen)
               fullScreenVideoMenuEntry = new MenuEntry(Mario.Resource.smallScreenSettings);
             else
               fullScreenVideoMenuEntry = new MenuEntry(Mario.Resource.fullScreenSettings);

            MenuEntry musicSoundMenuEntry = new MenuEntry(Mario.Resource.musicSoundSettings);
            MenuEntry effectSoundMenuEntry = new MenuEntry(Mario.Resource.effectSoundSettings);
            MenuEntry HandleControlMenuEntry = new MenuEntry(Mario.Resource.HandleControlSettings);
            MenuEntry ConfirmMenuEntry = new MenuEntry(Mario.Resource.Confirm);
            MenuEntry BackMenuEntry = new MenuEntry(Mario.Resource.Back);

            // Menu entries Position
            fullScreenVideoMenuEntry.Position = new Vector2(position.X + 60, position.Y + 55);
            musicSoundMenuEntry.Position = new Vector2(position.X + 60, position.Y + 120);
            effectSoundMenuEntry.Position = new Vector2(position.X + 60, position.Y + 160);
            HandleControlMenuEntry.Position = new Vector2(position.X + 60, position.Y + 230);
            ConfirmMenuEntry.Position = new Vector2(310, 480);
            BackMenuEntry.Position = new Vector2(650,550);

            // Hook up menu event handlers.
            fullScreenVideoMenuEntry.Selected += fullScreenVideoMenuEntrySelected;
            musicSoundMenuEntry.Selected += musicSoundMenuEntrySelected;
            effectSoundMenuEntry.Selected += effectSoundEntrySelected;
            HandleControlMenuEntry.Selected += HandleControlMenuEntrySelected;
            ConfirmMenuEntry.Selected += ConfirmMenuEntrySelected;
            BackMenuEntry.Selected += BackMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(fullScreenVideoMenuEntry);
            MenuEntries.Add(musicSoundMenuEntry);
            MenuEntries.Add(effectSoundMenuEntry);
            MenuEntries.Add(HandleControlMenuEntry);
            MenuEntries.Add(ConfirmMenuEntry);
            MenuEntries.Add(BackMenuEntry);
        }