/// <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);
        }
        /// <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);
        }
        /// <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);

            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);
            }
        }
        void Initialize(ParentGame parentGame)
        {
            for (int i = 0; i < 12; ++i)
            {
                MenuEntry me = new MenuEntry((i + 1).ToString());
                me.LevelNum = (i + 1);
                me.Selected += SinglePlayerMenuEntrySelected;
                MenuEntries.Add(me);
            }

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
            ButtonA = parentGame.Content.Load<Texture2D>("Menu\\buttona");
            ButtonB = parentGame.Content.Load<Texture2D>("Menu\\buttonb");
        }
        void Initialize(ParentGame parentGame)
        {
            // Create our menu entries.
            MenuEntry continueEntry = new MenuEntry("Continue");
            continueEntry.LevelNum = 0;
            continueEntry.Selected += SinglePlayerMenuEntrySelected;
            MenuEntries.Add(continueEntry);

            MenuEntry mode = new MenuEntry(Mode2);
            if (!NormalMode)
                mode.Text = Mode1;
            mode.LevelNum = 0;
            mode.Selected += ModeSelected;
            MenuEntries.Add(mode);

            MenuEntry levelSelect = new MenuEntry("Level Select");
            levelSelect.Selected += LevelSelectSelected;
            MenuEntries.Add(levelSelect);

            MenuEntry options = new MenuEntry("Options");
            //levelSelect.Selected += LevelSelectSelected;
            MenuEntries.Add(options);

            MenuEntry exitMenuEntry = new MenuEntry(Resources.Exit);
            exitMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitMenuEntry);

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
            ButtonA = parentGame.Content.Load<Texture2D>("Menu\\buttona");
            ButtonB = parentGame.Content.Load<Texture2D>("Menu\\buttonb");

            //if (parentGame.LoadingLevel)
            //    parentGame.LoadingLevel = false;
        }
        void Initialize(ParentGame parentGame)
        {
            // Create our menu entries.
            MenuEntry continueEntry = new MenuEntry("Continue");
            continueEntry.LevelNum = 0;
            continueEntry.Selected += SinglePlayerMenuEntrySelected;
            MenuEntries.Add(continueEntry);

            MenuEntry mode = new MenuEntry("Time Trial Mode");
            mode.LevelNum = 0;
            mode.Selected += ModeSelected;
            MenuEntries.Add(mode);

            for (int i = 0; i < 12; ++i)
            {
                MenuEntry me = new MenuEntry((i+1).ToString());
                me.LevelNum = (i + 1);
                me.Selected += SinglePlayerMenuEntrySelected;
                MenuEntries.Add(me);
            }

            MenuEntry exitMenuEntry = new MenuEntry(Resources.Exit);
            exitMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitMenuEntry);

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
        }