예제 #1
0
        /// <summary>
        /// Constructs the interface of resolution selection
        /// @Author Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void createWindowState(Screen mainScreen)
        {
            LabelControl winTitleLabel = GuiHelper.CreateLabel("Display Mode",
                                                               UIConstants.OPTION_WINDOW_LABEL.X, UIConstants.OPTION_WINDOW_LABEL.Y,
                                                               UIConstants.OPTION_WINDOW_LABEL.Width, UIConstants.OPTION_WINDOW_LABEL.Height);

            mainScreen.Desktop.Children.Add(winTitleLabel);

            ButtonControl leftWinToggle = GuiHelper.CreateButton("<",
                                                                 UIConstants.OPTION_LEFT_BTN.X, UIConstants.OPTION_LEFT_BTN.Y,
                                                                 UIConstants.OPTION_LEFT_BTN.Width, UIConstants.OPTION_LEFT_BTN.Height);

            leftWinToggle.Pressed += delegate(object sender, EventArgs arugments)
            {
                toggleWindowState(-1);
            };
            mainScreen.Desktop.Children.Add(leftWinToggle);

            currentWinLabel = GuiHelper.CreateLabel(game.windowState,
                                                    UIConstants.OPTION_CURWIN_LABEL.X, UIConstants.OPTION_CURWIN_LABEL.Y,
                                                    UIConstants.OPTION_CURWIN_LABEL.Width, UIConstants.OPTION_CURWIN_LABEL.Height);
            mainScreen.Desktop.Children.Add(currentWinLabel);

            ButtonControl rightWinToggle = GuiHelper.CreateButton(">",
                                                                  UIConstants.OPTION_RIGHT_BTN.X, UIConstants.OPTION_RIGHT_BTN.Y,
                                                                  UIConstants.OPTION_RIGHT_BTN.Width, UIConstants.OPTION_RIGHT_BTN.Height);

            rightWinToggle.Pressed += delegate(object sender, EventArgs arugments)
            {
                toggleWindowState(1);
            };
            mainScreen.Desktop.Children.Add(rightWinToggle);
        }
예제 #2
0
        /// <summary>
        /// @Author Steven
        /// </summary>
        /// <param name="game"></param>
        /// <param name="title"></param>
        public LobbyMenu(Game1 game, String title)
        {
            this.game = game;
            game.mainScreen.Desktop.Children.Clear(); //Clear the gui
            lobbyTitle = title;

            /* White background for UI */
            WhiteBackground = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.LOBBY_WHITE_BG.X, (int)game.mainScreen.Height / 2 - UIConstants.LOBBY_WHITE_BG.Y,
                                            UIConstants.LOBBY_WHITE_BG.Width, UIConstants.LOBBY_WHITE_BG.Height);

            /* Scrolling background */

            /* Menu's Banner */
            TexBanner = Game1.Assets.suMultiLobby;
            Banner    = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.SU_BANNER.X, (int)game.mainScreen.Height / 2 - UIConstants.SU_BANNER.Y,
                                      UIConstants.SU_BANNER.Width, UIConstants.SU_BANNER.Height);

            /* For constructing the list of players with LabelControls */
            playerLabelList = new List <LabelControl>();
            playerLabelList.Add(player1Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player2Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player3Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player4Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player5Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));
            playerLabelList.Add(player6Label = GuiHelper.CreateLabel("Empty", 0, 0, UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height));

            /* List of names used to correlate to the labels */
            playerNameList = new List <string>();
            playerNameList.Add("Player 1");
            playerNameList.Add("Player 2");
            playerNameList.Add("Player 3");
            playerNameList.Add("Player 4");
            playerNameList.Add("Player 5");
            playerNameList.Add("Player 6");

            /* List of Ships */
            shipSelectionList = new List <ShipButton>();
            shipSelectionList.Add(new ShipButton(new UFO(game)));
            shipSelectionList.Add(new ShipButton(new Scout(game)));
            shipSelectionList.Add(new ShipButton(new Zoid(game)));

            /* List of choices for ships */
            shipChoiceList = new List <ChoiceControl>();
            shipChoiceList.Add(shipChoice_1 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));
            shipChoiceList.Add(shipChoice_2 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));
            shipChoiceList.Add(shipChoice_3 = GuiHelper.CreateChoice("", 0, 0, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height));

            /* Sets the default selected ship */
            lastButton = shipSelectionList[0];
            shipSelectionList[0].selected = true;
            shipChoiceList[0].Selected    = true;

            setGridDisplay(game.getScreenWidth() - UIConstants.LOBBY_SHIP_GRID.X, game.getScreenHeight() - UIConstants.LOBBY_SHIP_GRID.Y);

            CreateMenuControls(game.mainScreen);
            Background = Game1.Assets.guiRectangle;
            new Thread(updatePlayerList).Start();
        }
예제 #3
0
        /// <summary>
        /// Constructs the drop down menu for available resolutions
        /// @Author Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void createResolutionDropDown(Screen mainScreen)
        {
            resoTitleLabel = GuiHelper.CreateLabel("Resolution",
                                                   UIConstants.OPTION_RESO_LABEL.X, UIConstants.OPTION_RESO_LABEL.Y,
                                                   UIConstants.OPTION_RESO_LABEL.Width, UIConstants.OPTION_RESO_LABEL.Height);
            mainScreen.Desktop.Children.Add(resoTitleLabel);

            currentResoLabel = GuiHelper.CreateLabel(game.width + "x" + game.height,
                                                     UIConstants.OPTION_RESO_CUR_LABEL.X, UIConstants.OPTION_RESO_CUR_LABEL.Y,
                                                     UIConstants.OPTION_RESO_CUR_LABEL.Width, UIConstants.OPTION_RESO_CUR_LABEL.Height);
            mainScreen.Desktop.Children.Add(currentResoLabel);

            //Toggle resolution list button.
            ButtonControl toggleResoButton = GuiHelper.CreateButton("V",
                                                                    UIConstants.OPTION_RESO_BTN.X, UIConstants.OPTION_RESO_BTN.Y,
                                                                    UIConstants.OPTION_RESO_BTN.Width, UIConstants.OPTION_RESO_BTN.Height);

            toggleResoButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if (toggleReso)
                {
                    resoList.Bounds = GuiHelper.CenterBound(UIConstants.OPTION_RESO_HIDE_LIST.X, UIConstants.OPTION_RESO_HIDE_LIST.Y,
                                                            UIConstants.OPTION_RESO_HIDE_LIST.Width, UIConstants.OPTION_RESO_HIDE_LIST.Height);
                }
                else
                {
                    resoList.Bounds = GuiHelper.CenterBound(UIConstants.OPTION_RESO_SHOW_LIST.X, UIConstants.OPTION_RESO_SHOW_LIST.Y,
                                                            UIConstants.OPTION_RESO_SHOW_LIST.Width, UIConstants.OPTION_RESO_SHOW_LIST.Height);
                }
                toggleReso = !toggleReso;
            };
            mainScreen.Desktop.Children.Add(toggleResoButton);

            //Resolution list
            resoList = new ListControl();
            resoList.SelectionMode = ListSelectionMode.Single;

            foreach (String reso in Resolution.GetScreenResolutions())
            {
                resoList.Items.Add(reso);
            }
            resoList.Bounds = GuiHelper.CenterBound(UIConstants.OPTION_RESO_HIDE_LIST.X, UIConstants.OPTION_RESO_HIDE_LIST.Y,
                                                    UIConstants.OPTION_RESO_HIDE_LIST.Width, UIConstants.OPTION_RESO_HIDE_LIST.Height);

            resoList.SelectionChanged += delegate(object sender, EventArgs arguments)
            {
                if (resoList.SelectedItems.Count != 0)
                {
                    currentResoLabel.Text = resoList.Items[resoList.SelectedItems[0]].ToString();
                    currentWinLabel.Text  = "Windowed";
                    winState   = 0;
                    toggleReso = false;
                }
                resoList.Bounds = GuiHelper.CenterBound(UIConstants.OPTION_RESO_HIDE_LIST.X, UIConstants.OPTION_RESO_HIDE_LIST.Y,
                                                        UIConstants.OPTION_RESO_HIDE_LIST.Width, UIConstants.OPTION_RESO_HIDE_LIST.Height);
            };
            mainScreen.Desktop.Children.Add(resoList);
        }
예제 #4
0
        /// <summary>
        /// Builds the UI for the ships to be selected
        /// @Author Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void createShipSelection(Screen mainScreen)
        {
            //Choose Ship Label
            LabelControl chooseShipLabel = GuiHelper.CreateLabel("Choose Your Ship",
                                                                 UIConstants.LOBBY_SHIP_LABEL.X, UIConstants.LOBBY_SHIP_LABEL.Y,
                                                                 UIConstants.LOBBY_SHIP_LABEL.Width, UIConstants.LOBBY_SHIP_LABEL.Height);

            mainScreen.Desktop.Children.Add(chooseShipLabel);

            int i = 0;

            foreach (ChoiceControl choice in shipChoiceList)
            {
                choice.Bounds = GuiHelper.CenterBound(UIConstants.LOBBY_CHOICE_RADIO.X + i * UIConstants.LOBBY_CHOICE_RADIO_SPACE,
                                                      UIConstants.LOBBY_CHOICE_RADIO.Y, UIConstants.LOBBY_CHOICE_RADIO.Width, UIConstants.LOBBY_CHOICE_RADIO.Height);
                mainScreen.Desktop.Children.Add(choice);
                i++;
            }
        }
예제 #5
0
        private void CreateMenuControls(Screen mainScreen)
        {
            //Logout Button.
            ButtonControl backButton = GuiHelper.CreateButton("Back",
                                                              UIConstants.BROWSE_BACK_BTN.X, UIConstants.BROWSE_BACK_BTN.Y,
                                                              UIConstants.BROWSE_BACK_BTN.Width, UIConstants.BROWSE_BACK_BTN.Height);

            backButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                game.EnterMultiplayerMenu();
            };
            mainScreen.Desktop.Children.Add(backButton);
            prevPageButton = GuiHelper.CreateButton("Prev",
                                                    UIConstants.BROWSE_PREV_BTN.X, UIConstants.BROWSE_PREV_BTN.Y,
                                                    UIConstants.BROWSE_PREV_BTN.Width, UIConstants.BROWSE_PREV_BTN.Height);
            prevPageButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                LobbyBrowserTable.PrevPage();
            };

            nextPageButton = GuiHelper.CreateButton("Next",
                                                    UIConstants.BROWSE_NEXT_BTN.X, UIConstants.BROWSE_NEXT_BTN.Y,
                                                    UIConstants.BROWSE_NEXT_BTN.Width, UIConstants.BROWSE_NEXT_BTN.Height);
            nextPageButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                LobbyBrowserTable.NextPage();
            };

            mainScreen.Desktop.Children.Add(nextPageButton);
            mainScreen.Desktop.Children.Add(prevPageButton);

            pagesLabel = GuiHelper.CreateLabel(LobbyBrowserTable.currentPage + "/" + LobbyBrowserTable.maxPage,
                                               UIConstants.BROWSE_PAGE_LABEL.X, UIConstants.BROWSE_PAGE_LABEL.Y,
                                               UIConstants.BROWSE_PAGE_LABEL.Width, UIConstants.BROWSE_PAGE_LABEL.Height);

            mainScreen.Desktop.Children.Add(pagesLabel);
        }
예제 #6
0
        public ControlMenu(Game1 game)
        {
            this.game = game;
            game.mainScreen.Desktop.Children.Clear();             //Clear the gui
            screen = game.mainScreen;

            TexBanner = Game1.Assets.suOptionKeys;
            Banner    = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.SU_BANNER.X, (int)game.mainScreen.Height / 2 - UIConstants.SU_BANNER.Y,
                                      UIConstants.SU_BANNER.Width, UIConstants.SU_BANNER.Height);

            Background = Game1.Assets.guiRectangle;

            nonInputKeys = new List <Keys>();
            nonInputKeys.Add(Keys.LeftControl);
            nonInputKeys.Add(Keys.LeftAlt);
            nonInputKeys.Add(Keys.LeftShift);
            nonInputKeys.Add(Keys.RightAlt);
            nonInputKeys.Add(Keys.RightControl);
            nonInputKeys.Add(Keys.RightShift);

            keyLabelList = new List <LabelControl>();
            keyLabelList.Add(forwardLabel = GuiHelper.CreateLabel("Forward Thrust", 0, 0, UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height));
            keyLabelList.Add(leftLabel    = GuiHelper.CreateLabel("Turn Left", 0, 0, UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height));
            keyLabelList.Add(rightLabel   = GuiHelper.CreateLabel("Turn Right", 0, 0, UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height));
            keyLabelList.Add(fireLabel    = GuiHelper.CreateLabel("Primary Fire", 0, 0, UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height));
            keyLabelList.Add(altFireLabel = GuiHelper.CreateLabel("Secondary Fire", 0, 0, UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height));

            keyButtonList = new List <ButtonControl>();
            keyButtonList.Add(keyButton0 = GuiHelper.CreateButton(game.keylist[0].ToString(), 0, 0, UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height));
            keyButtonList.Add(keyButton1 = GuiHelper.CreateButton(game.keylist[1].ToString(), 0, 0, UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height));
            keyButtonList.Add(keyButton2 = GuiHelper.CreateButton(game.keylist[2].ToString(), 0, 0, UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height));
            keyButtonList.Add(keyButton3 = GuiHelper.CreateButton(game.keylist[3].ToString(), 0, 0, UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height));
            keyButtonList.Add(keyButton4 = GuiHelper.CreateButton(game.keylist[4].ToString(), 0, 0, UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height));

            CreateMenuControls(game.mainScreen);
        }
예제 #7
0
        public CreditsMenu(Game1 game)
        {
            this.game = game;



            TexBanner = Game1.Assets.suCredits;
            Banner    = new Rectangle((int)game.mainScreen.Width / 2 - UIConstants.SU_BANNER.X,
                                      (int)game.mainScreen.Height / 2 - UIConstants.SU_BANNER.Y,
                                      UIConstants.SU_BANNER.Width, UIConstants.SU_BANNER.Height);

            game.mainScreen.Desktop.Children.Clear();             //Clear the gui
            LabelControl KonstantinBoyarinovLabel;
            LabelControl MikhailDimchukLabel;
            LabelControl KyleWiltonLabel;
            LabelControl MiguelGatmaytanLabel;
            LabelControl RobertPurdeyLabel;
            LabelControl RobertPurdeyLabel2;
            LabelControl MichaelGordonLabel;
            LabelControl AndrewKimLabel;
            LabelControl TroyCarefootLabel;
            LabelControl KevinMcKeenLabel;
            LabelControl TristanGillonLabel;
            LabelControl TristanGillonLabel2;
            LabelControl MatthewBaldockLabel;
            LabelControl StevenChenLabel;

            Background = Game1.Assets.guiRectangle;
            LabelControl GameLogicAssetsLabel;
            LabelControl DatabaseLabel;
            LabelControl ClientServerLabel;
            LabelControl WebDevLabel;
            LabelControl ProjectManagersLabel;
            LabelControl ProjectNameLabel;

            ProjectNameLabel = GuiHelper.CreateLabel("SPACE UNION - Set 4L Production", -200, -230, 30, 30);
            game.mainScreen.Desktop.Children.Add(ProjectNameLabel);

            ProjectManagersLabel = GuiHelper.CreateLabel("Project Managers", -300, -200, 30, 30);
            game.mainScreen.Desktop.Children.Add(ProjectManagersLabel);
            RobertPurdeyLabel2 = GuiHelper.CreateLabel("Robert Purdey (Lead Manager)", -100, -200, 30, 30);
            game.mainScreen.Desktop.Children.Add(RobertPurdeyLabel2);
            TristanGillonLabel2 = GuiHelper.CreateLabel("Tristan Gillon (Technical Manager)", -100, -175, 30, 30);
            game.mainScreen.Desktop.Children.Add(TristanGillonLabel2);

            GameLogicAssetsLabel = GuiHelper.CreateLabel("Game Logic And Assets", -300, -125, 30, 30);
            game.mainScreen.Desktop.Children.Add(GameLogicAssetsLabel);
            TroyCarefootLabel = GuiHelper.CreateLabel("Troy Carefoot (Leader)", -100, -125, 30, 30);
            game.mainScreen.Desktop.Children.Add(TroyCarefootLabel);
            TristanGillonLabel = GuiHelper.CreateLabel("Tristan Gillon (Leader)", -100, -100, 30, 30);
            game.mainScreen.Desktop.Children.Add(TristanGillonLabel);
            KonstantinBoyarinovLabel = GuiHelper.CreateLabel("Konstantin Boyarinov", -100, -75, 30, 30);
            game.mainScreen.Desktop.Children.Add(KonstantinBoyarinovLabel);
            KyleWiltonLabel = GuiHelper.CreateLabel("Kyle Wilton", -100, -50, 30, 30);
            game.mainScreen.Desktop.Children.Add(KyleWiltonLabel);
            MatthewBaldockLabel = GuiHelper.CreateLabel("Matthew Baldock", -100, -25, 30, 30);
            game.mainScreen.Desktop.Children.Add(MatthewBaldockLabel);
            StevenChenLabel = GuiHelper.CreateLabel("Steven Chen", -100, 0, 30, 30);
            game.mainScreen.Desktop.Children.Add(StevenChenLabel);


            DatabaseLabel = GuiHelper.CreateLabel("Database", -300, 50, 30, 30);
            game.mainScreen.Desktop.Children.Add(DatabaseLabel);
            MichaelGordonLabel = GuiHelper.CreateLabel("Michael Gordon (Leader)", -100, 50, 30, 30);
            game.mainScreen.Desktop.Children.Add(MichaelGordonLabel);
            RobertPurdeyLabel = GuiHelper.CreateLabel("Robert Purdey", -100, 75, 30, 30);
            game.mainScreen.Desktop.Children.Add(RobertPurdeyLabel);


            ClientServerLabel = GuiHelper.CreateLabel("Client/Server", -300, 125, 30, 30);
            game.mainScreen.Desktop.Children.Add(ClientServerLabel);
            MikhailDimchukLabel = GuiHelper.CreateLabel("Mikhail Dimchuk", -100, 125, 30, 30);
            game.mainScreen.Desktop.Children.Add(MikhailDimchukLabel);
            AndrewKimLabel = GuiHelper.CreateLabel("Andrew Kim", -100, 150, 30, 30);
            game.mainScreen.Desktop.Children.Add(AndrewKimLabel);

            WebDevLabel = GuiHelper.CreateLabel("Web Development", -300, 200, 30, 30);
            game.mainScreen.Desktop.Children.Add(WebDevLabel);
            KevinMcKeenLabel = GuiHelper.CreateLabel("Kevin McKeen (Leader)", -100, 200, 30, 30);
            game.mainScreen.Desktop.Children.Add(KevinMcKeenLabel);
            MiguelGatmaytanLabel = GuiHelper.CreateLabel("Miguel Gatmaytan", -100, 225, 30, 30);
            game.mainScreen.Desktop.Children.Add(MiguelGatmaytanLabel);

            CreateMenuControls(game.mainScreen);
        }
예제 #8
0
        /// <summary>
        /// @Author Troy, Edited by Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void CreateMenuControls(Screen mainScreen)
        {
            //Menu Name Label
            LabelControl menuNameLabel = new LabelControl();

            //NETWORKING
            //menuNameLabel.Text = "Lobby: " + game.roomInfo.RoomName;
            menuNameLabel.Text = "Lobby: ";

            menuNameLabel.Bounds = GuiHelper.MENU_TITLE_LABEL;
            mainScreen.Desktop.Children.Add(menuNameLabel);

            //Players Labels
            playersLabel = GuiHelper.CreateLabel("Players:",
                                                 UIConstants.LOBBY_PLAYER_LABEL.X, UIConstants.LOBBY_PLAYER_LABEL.Y - UIConstants.LOBBY_PLAYER_LABEL_SPACE,
                                                 UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height);
            mainScreen.Desktop.Children.Add(playersLabel);

            int i = 0;

            foreach (LabelControl ctrl in playerLabelList)
            {
                //ctrl.Text = playerNameList[i]; // Use if using the List<string> to store player names
                ctrl.Bounds = GuiHelper.CenterBound(
                    UIConstants.LOBBY_PLAYER_LABEL.X, UIConstants.LOBBY_PLAYER_LABEL.Y + i * UIConstants.LOBBY_PLAYER_LABEL_SPACE,
                    UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height);
                mainScreen.Desktop.Children.Add(ctrl);
                i++;
            }

            shipChoice_1.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(0);
            };
            shipChoice_2.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(1);
            };
            shipChoice_3.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(2);
            };

            createShipSelection(mainScreen);

            //Ready Up Button.
            OptionControl readyUpButton = GuiHelper.CreateOption("I'm Ready!",
                                                                 UIConstants.LOBBY_READY_BTN.X, UIConstants.LOBBY_READY_BTN.Y,
                                                                 UIConstants.LOBBY_READY_BTN.Width, UIConstants.LOBBY_READY_BTN.Height);

            mainScreen.Desktop.Children.Add(readyUpButton);

            //Start Game Button
            ButtonControl startGameButton = GuiHelper.CreateButton("Start Game",
                                                                   UIConstants.LOBBY_START_BTN.X, UIConstants.LOBBY_START_BTN.Y,
                                                                   UIConstants.LOBBY_START_BTN.Width, UIConstants.LOBBY_START_BTN.Height);

            startGameButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if (readyUpButton.Selected == true &&
                    (shipChoice_1.Selected == true || shipChoice_2.Selected == true || shipChoice_3.Selected == true))
                {
                    menuNameLabel.Text = "You are ready";
                }
                else
                {
                    menuNameLabel.Text = "You are not ready";
                }
            };
            if (!isLeader)
            {
                startGameButton.Enabled = false;
            }

            mainScreen.Desktop.Children.Add(startGameButton);

            //Cancel Button
            ButtonControl cancelGameButton = GuiHelper.CreateButton("Cancel",
                                                                    UIConstants.LOBBY_CANCEL_BTN.X, UIConstants.LOBBY_CANCEL_BTN.Y,
                                                                    UIConstants.LOBBY_CANCEL_BTN.Width, UIConstants.LOBBY_CANCEL_BTN.Height);

            cancelGameButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                //NETWORKING
                //game.Communication.sendRoomExitRequest(game.Player, game.roomInfo.RoomNumber);
                game.EnterLobbyBrowserMenu();
            };
            mainScreen.Desktop.Children.Add(cancelGameButton);
        }
예제 #9
0
        /// <summary>
        /// Constructs the volume interface for both Music and Sound
        /// @Author Konstantin and Edited by Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void createSoundVolume(Screen mainScreen)
        {
            /* Sound volume control */
            LabelControl soundControlLabel = GuiHelper.CreateLabel("Sound",
                                                                   UIConstants.OPTION_SOUND_LABEL.X, UIConstants.OPTION_SOUND_LABEL.Y,
                                                                   UIConstants.OPTION_SOUND_LABEL.Width, UIConstants.OPTION_SOUND_LABEL.Height);

            mainScreen.Desktop.Children.Add(soundControlLabel);

            ButtonControl soundOffButton = GuiHelper.CreateButton("OFF",
                                                                  UIConstants.OPTION_SOUND_OFF_BTN.X, UIConstants.OPTION_SOUND_OFF_BTN.Y,
                                                                  UIConstants.OPTION_SOUND_OFF_BTN.Width, UIConstants.OPTION_SOUND_OFF_BTN.Height);

            soundOffButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentSoundLabel.Text   = "Off";
                game.currentSound        = "Off";
                SoundEffect.MasterVolume = 0f;
            };
            mainScreen.Desktop.Children.Add(soundOffButton);

            ButtonControl soundLowButton = GuiHelper.CreateButton("LOW",
                                                                  UIConstants.OPTION_SOUND_LOW_BTN.X, UIConstants.OPTION_SOUND_LOW_BTN.Y,
                                                                  UIConstants.OPTION_SOUND_LOW_BTN.Width, UIConstants.OPTION_SOUND_LOW_BTN.Height);

            soundLowButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentSoundLabel.Text   = "Low";
                game.currentSound        = "Low";
                SoundEffect.MasterVolume = .10f;
            };
            mainScreen.Desktop.Children.Add(soundLowButton);

            ButtonControl soundMediumButton = GuiHelper.CreateButton("MED",
                                                                     UIConstants.OPTION_SOUND_MED_BTN.X, UIConstants.OPTION_SOUND_MED_BTN.Y,
                                                                     UIConstants.OPTION_SOUND_MED_BTN.Width, UIConstants.OPTION_SOUND_MED_BTN.Height);

            soundMediumButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentSoundLabel.Text   = "Medium";
                game.currentSound        = "Medium";
                SoundEffect.MasterVolume = .50f;
            };
            mainScreen.Desktop.Children.Add(soundMediumButton);

            ButtonControl soundHighButton = GuiHelper.CreateButton("HIGH",
                                                                   UIConstants.OPTION_SOUND_HIGH_BTN.X, UIConstants.OPTION_SOUND_HIGH_BTN.Y,
                                                                   UIConstants.OPTION_SOUND_HIGH_BTN.Width, UIConstants.OPTION_SOUND_HIGH_BTN.Height);

            soundHighButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentSoundLabel.Text   = "High";
                game.currentSound        = "High";
                SoundEffect.MasterVolume = 1f;
            };
            mainScreen.Desktop.Children.Add(soundHighButton);

            currentSoundLabel = GuiHelper.CreateLabel(game.currentSound,
                                                      UIConstants.OPTION_SOUND_CUR_LABEL.X, UIConstants.OPTION_SOUND_CUR_LABEL.Y,
                                                      UIConstants.OPTION_SOUND_CUR_LABEL.Width, UIConstants.OPTION_SOUND_CUR_LABEL.Height);
            mainScreen.Desktop.Children.Add(currentSoundLabel);

            /* Music volume control */
            LabelControl musicControlLabel = GuiHelper.CreateLabel("Music",
                                                                   UIConstants.OPTION_MUSIC_LABEL.X, UIConstants.OPTION_MUSIC_LABEL.Y,
                                                                   UIConstants.OPTION_MUSIC_LABEL.Width, UIConstants.OPTION_MUSIC_LABEL.Height);

            mainScreen.Desktop.Children.Add(musicControlLabel);

            ButtonControl musicOffButton = GuiHelper.CreateButton("OFF",
                                                                  UIConstants.OPTION_MUSIC_OFF_BTN.X, UIConstants.OPTION_MUSIC_OFF_BTN.Y,
                                                                  UIConstants.OPTION_MUSIC_OFF_BTN.Width, UIConstants.OPTION_MUSIC_OFF_BTN.Height);

            musicOffButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentMusicLabel.Text = "Off";
                game.currentMusic      = "Off";
                MediaPlayer.Volume     = 0;
            };
            mainScreen.Desktop.Children.Add(musicOffButton);

            ButtonControl musicLowButton = GuiHelper.CreateButton("LOW",
                                                                  UIConstants.OPTION_MUSIC_LOW_BTN.X, UIConstants.OPTION_MUSIC_LOW_BTN.Y,
                                                                  UIConstants.OPTION_MUSIC_LOW_BTN.Width, UIConstants.OPTION_MUSIC_LOW_BTN.Height);

            musicLowButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentMusicLabel.Text = "Low";
                game.currentMusic      = "Low";
                MediaPlayer.Volume     = .33f;
            };
            mainScreen.Desktop.Children.Add(musicLowButton);

            ButtonControl musicMediumButton = GuiHelper.CreateButton("MED",
                                                                     UIConstants.OPTION_MUSIC_MED_BTN.X, UIConstants.OPTION_MUSIC_MED_BTN.Y,
                                                                     UIConstants.OPTION_MUSIC_MED_BTN.Width, UIConstants.OPTION_MUSIC_MED_BTN.Height);

            musicMediumButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentMusicLabel.Text = "Medium";
                game.currentMusic      = "Medium";
                MediaPlayer.Volume     = .66f;
            };
            mainScreen.Desktop.Children.Add(musicMediumButton);

            ButtonControl musicHighButton = GuiHelper.CreateButton("HIGH",
                                                                   UIConstants.OPTION_MUSIC_HIGH_BTN.X, UIConstants.OPTION_MUSIC_HIGH_BTN.Y,
                                                                   UIConstants.OPTION_MUSIC_HIGH_BTN.Width, UIConstants.OPTION_MUSIC_HIGH_BTN.Height);

            musicHighButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                currentMusicLabel.Text = "High";
                game.currentMusic      = "High";
                MediaPlayer.Volume     = 1f;
            };
            mainScreen.Desktop.Children.Add(musicHighButton);

            currentMusicLabel = GuiHelper.CreateLabel(game.currentMusic,
                                                      UIConstants.OPTION_MUSIC_CUR_LABEL.X, UIConstants.OPTION_MUSIC_CUR_LABEL.Y,
                                                      UIConstants.OPTION_MUSIC_CUR_LABEL.Width, UIConstants.OPTION_MUSIC_CUR_LABEL.Height);
            mainScreen.Desktop.Children.Add(currentMusicLabel);
        }
예제 #10
0
        /// <summary>
        /// @Author Troy, Edited by Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void CreateMenuControls(Screen mainScreen)
        {
            //TODO: Change Label Colors to white
            //Account Name Label

            LabelControl accountNameLabel = GuiHelper.CreateLabel("Account Name",
                                                                  UIConstants.LOGIN_ACCOUNT_LABEL.X, UIConstants.LOGIN_ACCOUNT_LABEL.Y,
                                                                  UIConstants.LOGIN_ACCOUNT_LABEL.Width, UIConstants.LOGIN_ACCOUNT_LABEL.Height);

            mainScreen.Desktop.Children.Add(accountNameLabel);

            //Error Text Label
            errorText        = new LabelControl();
            errorText.Bounds = new UniRectangle(275.0f, 300.0f, 110.0f, 25.0f);
            mainScreen.Desktop.Children.Add(errorText);

            //Account Name Input
            accountNameInput = GuiHelper.CreateInput("",
                                                     UIConstants.LOGIN_ACCOUNT_INPUT.X, UIConstants.LOGIN_ACCOUNT_INPUT.Y,
                                                     UIConstants.LOGIN_ACCOUNT_INPUT.Width, UIConstants.LOGIN_ACCOUNT_INPUT.Height);
            mainScreen.Desktop.Children.Add(accountNameInput);

            //Password Label
            passwordLabel = GuiHelper.CreateLabel("Password",
                                                  UIConstants.LOGIN_PASSWORD_LABEL.X, UIConstants.LOGIN_PASSWORD_LABEL.Y,
                                                  UIConstants.LOGIN_ACCOUNT_LABEL.Width, UIConstants.LOGIN_PASSWORD_LABEL.Height);
            mainScreen.Desktop.Children.Add(passwordLabel);

            //TODO: Create Password field where characters show up as black circles
            //Password Input
            passwordInput = GuiHelper.CreatePasswordInput(UIConstants.LOGIN_PASSWORD_INPUT.X, UIConstants.LOGIN_PASSWORD_INPUT.Y,
                                                          UIConstants.LOGIN_PASSWORD_INPUT.Width, UIConstants.LOGIN_PASSWORD_INPUT.Height);
            mainScreen.Desktop.Children.Add(passwordInput);

            //TODO: Change to a contrasting color (Yellow)
            //Login Button.
            ButtonControl loginButton = GuiHelper.CreateButton("Login",
                                                               UIConstants.LOGIN_BUTTON.X, UIConstants.LOGIN_BUTTON.Y,
                                                               UIConstants.LOGIN_BUTTON.Width, UIConstants.LOGIN_BUTTON.Height);

            loginButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                errorText.Text = "";
                errors         = false;
                if (accountNameInput.Text == "")
                {
                    errorText.Text += "Username field cannot be empty!\n";
                    errors          = true;
                }
                if (passwordInput.Text == "")
                {
                    errorText.Text += "Password field cannot be empty!";
                    errors          = true;
                }
                if (errors)
                {
                    return;
                }

                /*
                 * game.Player.Username = accountNameInput.Text;
                 * game.Player.Password = passwordInput.GetText();
                 *
                 * game.Communication.sendLoginRequest(game.Player);
                 * Thread.Sleep(2000);
                 * game.Player = game.Communication.getPlayer();
                 * Console.WriteLine(game.Player.Username);
                 * if (game.Player != null)*/
                game.EnterMainMenu();
            };
            mainScreen.Desktop.Children.Add(loginButton);

            //Debug Button.
            ButtonControl multiplayerButton = GuiHelper.CreateButton("Debug Game", -300, -300, 200, 50);

            multiplayerButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                game.StartGame();
            };
            mainScreen.Desktop.Children.Add(multiplayerButton);

            //Ship Select Button.
            ButtonControl shipSelectButton = GuiHelper.CreateButton("Select Ship", -300, -225, 200, 50);

            shipSelectButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                game.EnterShipSelectionScreen();
            };
            mainScreen.Desktop.Children.Add(shipSelectButton);

            //Button to close game.
            ButtonControl quitButton = GuiHelper.CreateButton("Quit",
                                                              UIConstants.LOGIN_QUIT.X, UIConstants.LOGIN_QUIT.Y,
                                                              UIConstants.LOGIN_QUIT.Width, UIConstants.LOGIN_QUIT.Height);

            quitButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                game.Exit();
            };
            mainScreen.Desktop.Children.Add(quitButton);
        }
예제 #11
0
        private void CreateMenuControls(Screen mainScreen)
        {
            /* Constructs the labels and key buttons UI */
            int i = 0;

            foreach (LabelControl lbl in keyLabelList)
            {
                lbl.Bounds = GuiHelper.CenterBound(UIConstants.CONTROL_KEY_LABEL.X, UIConstants.CONTROL_KEY_LABEL.Y + i * UIConstants.CONTROL_KEY_SPACE,
                                                   UIConstants.CONTROL_KEY_LABEL.Width, UIConstants.CONTROL_KEY_LABEL.Height);
                mainScreen.Desktop.Children.Add(lbl);
                keyButtonList[i].Bounds = GuiHelper.CenterBound(UIConstants.CONTROL_KEY_BTN.X, UIConstants.CONTROL_KEY_BTN.Y + i * UIConstants.CONTROL_KEY_SPACE,
                                                                UIConstants.CONTROL_KEY_BTN.Width, UIConstants.CONTROL_KEY_BTN.Height);
                i++;
            }
            keyButton0.Pressed += delegate(object sender, EventArgs arguments)
            {
                changeKey(0, keyButton0, forwardLabel);
            };
            mainScreen.Desktop.Children.Add(keyButton0);

            keyButton1.Pressed += delegate(object sender, EventArgs arguments)
            {
                changeKey(1, keyButton1, leftLabel);
            };
            mainScreen.Desktop.Children.Add(keyButton1);

            keyButton2.Pressed += delegate(object sender, EventArgs arguments)
            {
                changeKey(2, keyButton2, rightLabel);
            };
            mainScreen.Desktop.Children.Add(keyButton2);

            keyButton3.Pressed += delegate(object sender, EventArgs arguments)
            {
                changeKey(3, keyButton3, fireLabel);
            };
            mainScreen.Desktop.Children.Add(keyButton3);

            keyButton4.Pressed += delegate(object sender, EventArgs arguments)
            {
                changeKey(4, keyButton4, altFireLabel);
            };
            mainScreen.Desktop.Children.Add(keyButton4);

            keyToEnterLabel = GuiHelper.CreateLabel("",
                                                    UIConstants.CONTROL_KEYTOENTER_BTN.X, UIConstants.CONTROL_KEYTOENTER_BTN.Y,
                                                    UIConstants.CONTROL_KEYTOENTER_BTN.Width, UIConstants.CONTROL_KEYTOENTER_BTN.Height);
            mainScreen.Desktop.Children.Add(keyToEnterLabel);

            // Used to determine if the user pressed a key
            keyToEnter = GuiHelper.CreateInput("", UIConstants.CONTROL_KEY_HIDE_LABEL.X, UIConstants.CONTROL_KEY_HIDE_LABEL.Y,
                                               UIConstants.CONTROL_KEY_HIDE_LABEL.Width, UIConstants.CONTROL_KEY_HIDE_LABEL.Height);
            mainScreen.Desktop.Children.Add(keyToEnter);

            // Back button
            backButton = GuiHelper.CreateButton("Back",
                                                UIConstants.CONTROL_BACK_BTN.X, UIConstants.CONTROL_BACK_BTN.Y,
                                                UIConstants.CONTROL_BACK_BTN.Width, UIConstants.CONTROL_BACK_BTN.Height);
            backButton.Pressed += delegate(object sender, EventArgs arugments)
            {
                game.EnterOptionsMenu();
            };
            mainScreen.Desktop.Children.Add(backButton);

            ButtonControl debug = GuiHelper.CreateButton("Debug", 165, 190, 70, 32);

            debug.Pressed += delegate(object sender, EventArgs arugments)
            {
                game.StartGame();
            };
            mainScreen.Desktop.Children.Add(debug);
        }