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