Ejemplo n.º 1
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        /// <param name="host">Whether or not this player is the host.</param>
        /// <param name="multiplayer">Whether or not this game is multiplayer.</param>
        public HostSettingsMenuScreen(bool host)
            : base(host ? "Host Game" : "Join Game")
        {
            this.host = host; // Is this player the host?

            if (!host) // If we're not the host, then we need to specify an address
            {
                hostAddressMenuEntry = new MenuEntry(string.Empty);
                hostAddressMenuEntry.Selected += HostAddressMenuEntrySelected;
                hostAddressMenuEntry.Typed += HostAddressMenuEntryTyped;
                MenuEntries.Add(hostAddressMenuEntry);
            }

            // Both the host and the client should specify ports
            hostPortMenuEntry = new MenuEntry(string.Empty);
            hostPortMenuEntry.Selected += HostPortMenuEntrySelected;
            hostPortMenuEntry.Typed += HostPortMenuEntryTyped;
            MenuEntries.Add(hostPortMenuEntry);

            SetMenuEntryText(); // Set the initial menu text

            // Add the select and back options
            MenuEntry continueMenuEntry = new MenuEntry(host ? "Create Game" : "Connect to Game");
            continueMenuEntry.Selected += ContinueMenuEntrySelected;
            MenuEntries.Add(continueMenuEntry);

            MenuEntry backMenuEntry = new MenuEntry("Back");
            backMenuEntry.Selected += OnCancel;
            MenuEntries.Add(backMenuEntry);

            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MultiplayerMenuScreen()
            : base("Multiplayer")
        {
            // Create our menu entries.
            MenuEntry hostGameMenuEntry = new MenuEntry("Host Game");
            MenuEntry joinGameMenuEntry = new MenuEntry("Join Game");
            MenuEntry back = new MenuEntry("Back");

            // Hook up menu event handlers.
            hostGameMenuEntry.Selected += HostGameMenuEntrySelected;
            joinGameMenuEntry.Selected += JoinGameMenuEntrySelected;
            back.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(hostGameMenuEntry);
            MenuEntries.Add(joinGameMenuEntry);
            MenuEntries.Add(back);
            return;
        }
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        /// <param name="host">Whether or not this player is the host.</param>
        /// <param name="multiplayer">Whether or not this game is multiplayer.</param>
        public CharacterSelectMenuScreen(bool host, bool multiplayer)
            : base("Character Select", true)
        {
            // Set up the host and multiplayer settings
            this.host = host;
            this.multiplayer = multiplayer;

            // Create the single invisible menu entry
            MenuEntry startGameMenuEntry = new MenuEntry(string.Empty, true);
            startGameMenuEntry.Selected += StartGameMenuEntrySelected;
            MenuEntries.Add(startGameMenuEntry);

            // Set up the initial character selections
            characterSelections = new PlayerCharacter.Type[ProjectSkyCrane.MAX_PLAYERS];
            characterSelectionsLocked = new bool[ProjectSkyCrane.MAX_PLAYERS];
            playersConnected = new bool[ProjectSkyCrane.MAX_PLAYERS];
            for (int i = 0; i < ProjectSkyCrane.MAX_PLAYERS; i += 1)
            {
                characterSelections[i] = 0;
                characterSelectionsLocked[i] = false;
                playersConnected[i] = false;
            }

            if (host) // Set up which player slot this person currently fills
            {
                playerId = 0;
                hostIds = new Queue<int>(ProjectSkyCrane.MAX_PLAYERS - 1);
                connectionToPlayerIdHash = new Dictionary<int, int>(ProjectSkyCrane.MAX_PLAYERS - 1);
                playerIdToConnectionHash = new Dictionary<int, ConnectionID>(ProjectSkyCrane.MAX_PLAYERS - 1);
                for (int i = 1; i < ProjectSkyCrane.MAX_PLAYERS; i += 1) // Serve up id's
                {
                    hostIds.Enqueue(i);
                }
                playersConnected[0] = true;
            }
            else
            {
                playerId = -1;
            }

            return;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ResolutionsMenuScreen()
            : base("Resolutions")
        {
            for (int i = 0; i < resolutions.Length; i += 1) // Add an option for each resolution
            {
                MenuEntry resolution = new MenuEntry(resolutions[i]);
                resolution.Selected += ResolutionMenuEntrySelected;
                MenuEntries.Add(resolution);

                if (string.Compare(resolutions[i], currentResolution) == 0) // Select the most recent entry
                {
                    SelectedEntry = i;
                }
            }

            // Set up the back menu option
            MenuEntry back = new MenuEntry("Back");
            back.Selected += OnCancel;
            MenuEntries.Add(back);
            return;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen()
            : base("Paused")
        {
            MediaPlayer.Pause();

            // Create our menu entries.
            MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");

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

            // Add entries to the menu.
            MenuEntries.Add(resumeGameMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(quitGameMenuEntry);
            return;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen()
            : base("Options")
        {
            // Create our menu entries
            fullScreenOnMenuEntry = new MenuEntry(string.Empty, true);
            borderlessOnMenuEntry = new MenuEntry(string.Empty, true, fullScreenOn == OnOff.Off);
            resolutionMenuEntry = new MenuEntry(string.Empty, false, fullScreenOn == OnOff.Off);
            vsyncOnMenuEntry = new MenuEntry(string.Empty, true);
            musicOnMenuEntry = new MenuEntry(string.Empty, true);
            musicVolumeMenuEntry = new MenuEntry(string.Empty, true, musicOn == OnOff.On);
            soundFXOnMenuEntry = new MenuEntry(string.Empty, true);
            soundFXVolumeMenuEntry = new MenuEntry(string.Empty, true, soundFXOn == OnOff.On);

            SetMenuEntryText();
            MenuEntry back = new MenuEntry("Back");

            // Hook up menu event handlers.
            fullScreenOnMenuEntry.Selected += FullScreenOnMenuEntrySelected;
            borderlessOnMenuEntry.Selected += BorderlessOnMenuEntrySelected;
            resolutionMenuEntry.Selected += ResolutionMenuEntrySelected;
            vsyncOnMenuEntry.Selected += VsyncOnMenuEntrySelected;
            musicOnMenuEntry.Selected += MusicOnMenuEntrySelected;
            musicVolumeMenuEntry.Selected += MusicVolumeMenuEntrySelected;
            soundFXOnMenuEntry.Selected += SoundFXOnEntrySelected;
            soundFXVolumeMenuEntry.Selected += SoundFXVolumeMenuEntrySelected;
            back.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(fullScreenOnMenuEntry);
            MenuEntries.Add(borderlessOnMenuEntry);
            MenuEntries.Add(resolutionMenuEntry);
            MenuEntries.Add(vsyncOnMenuEntry);
            MenuEntries.Add(musicOnMenuEntry);
            MenuEntries.Add(musicVolumeMenuEntry);
            MenuEntries.Add(soundFXOnMenuEntry);
            MenuEntries.Add(soundFXVolumeMenuEntry);
            MenuEntries.Add(back);
            return;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("Main Menu")
        {
            // Create our menu entries.
            MenuEntry newGameMenuEntry = new MenuEntry("New Game");
            MenuEntry multiplayerMenuEntry = new MenuEntry("Multiplayer");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            // Hook up menu event handlers.
            newGameMenuEntry.Selected += NewGameMenuEntrySelected;
            multiplayerMenuEntry.Selected += MultiplayerMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(newGameMenuEntry);
            MenuEntries.Add(multiplayerMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(exitMenuEntry);
            return;
        }