private void UpdateServerListGUI( bool _firstPass ) { if ( MenuNetworking.instance.gameHosts != null && MenuNetworking.instance.gameHosts.Length != 0 ) { this.serverRows.Clear(); for ( int i = 0; i < MenuNetworking.instance.gameHosts.Length; ++i ) //for ( int i = 0; i < 10; ++i ) //Testing purposes { HostData hostData = MenuNetworking.instance.gameHosts[0];//[i]; ServerDisplayRow row = new ServerDisplayRow(); this.serverRows.Add( row ); float yPos = this.serverRowListOffset.y + (float)(i) * ( this.serverRowYGap + this.serverRowHeight ); row.nameLabel = new GUIPlaceholder(); row.nameLabel.text = hostData.gameName; row.nameLabel.rect = new Rect( this.serverRowListOffset.x, yPos, this.serverRowNameWidth, this.serverRowHeight ); row.ipLabel = new GUIPlaceholder(); row.ipLabel.text = string.Join( ".", hostData.ip ); row.ipLabel.rect = new Rect( this.serverRowListOffset.x + this.serverRowNameWidth + this.serverRowXGap, yPos, this.serverRowIPWidth, this.serverRowHeight ); row.pingLabel = new GUIPlaceholder( new Rect( this.serverRowListOffset.x + this.serverRowNameWidth + this.serverRowXGap * 2 + this.serverRowIPWidth, yPos, this.serverRowPingWidth, this.serverRowHeight ), "PING" ); row.connectButton = new GUIPlaceholder( new Rect( this.serverRowListOffset.x + this.serverRowNameWidth + this.serverRowXGap * 3 + this.serverRowIPWidth + this.serverRowPingWidth, yPos, this.serverRowButtonWidth, this.serverRowHeight ), "Connect" ); } } if ( _firstPass || Application.isEditor ) { this.serverListBackButton = new GUIPlaceholder(); this.serverListBackButton.text = "Back"; this.serverListBackButton.rect = new Rect( this.serverListButtonOffset.x, this.serverListButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); } }
private void UpdatePopupWindow( bool _firstPass ) { if ( _firstPass ) { this.popupTitleLabel = new GUIPlaceholder(); this.popupTitleLabel.rect = new Rect( this.popupWindowSize.x/2 - this.popupTitleScale.x/2, this.popupTitleGap, this.popupTitleScale.x, this.popupTitleScale.y ); this.popupLabelLabel = new GUIPlaceholder(); this.popupLabelLabel.rect = new Rect( this.popupWindowSize.x/2 - this.popupLabelScale.x/2, this.popupLabelGap, this.popupLabelScale.x, this.popupLabelScale.y ); this.popupCancelButton = new GUIPlaceholder(); this.popupCancelButton.rect = new Rect( this.popupWindowSize.x/2 - this.buttonScale.x - this.popupButtonOffset.x, this.popupButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.popupAcceptButton = new GUIPlaceholder(); this.popupAcceptButton.rect = new Rect( this.popupWindowSize.x/2 + this.popupButtonOffset.x, this.popupButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.popupTextField = new GUIPlaceholder(); this.popupTextField.rect = new Rect( this.popupWindowSize.x/2 - this.popupTextFieldScale.x/2, this.popupTextFieldGap, this.popupTextFieldScale.x, this.popupTextFieldScale.y ); this.popupCloseButton = new GUIPlaceholder(); this.popupCloseButton.rect = new Rect( this.popupWindowSize.x/2 - this.buttonScale.x, this.popupButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); } }
private void UpdateOptionsGUI( bool _firstPass ) { if ( _firstPass || Application.isEditor ) { this.optionsBackButton = new GUIPlaceholder(); this.optionsBackButton.rect = new Rect( this.optionsBackButtonOffset.x, this.optionsBackButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.optionsBackButton.text = "Back"; this.optionsNameLabel = new GUIPlaceholder(); this.optionsNameLabel.rect = new Rect( this.optionsNameLabelOffset.x, this.optionsNameLabelOffset.y, this.optionsNameLabelLength, this.buttonScale.y ); this.optionsNameLabel.text = PlayerOptions.instance.options.playerName; this.optionsNameButton = new GUIPlaceholder(); this.optionsNameButton.rect = new Rect( this.optionsNameLabelOffset.x + this.optionsNameButtonGap + this.optionsNameLabelLength, this.optionsNameLabelOffset.y, this.buttonScale.x, this.buttonScale.y ); this.optionsNameButton.text = "Change"; } }
private void UpdateMainGUI( bool _firstPass ) { if ( _firstPass || Application.isEditor ) { this.mainCreateGameButton = new GUIPlaceholder( this.GetTiledAreaRect( this.mainButtonOffset, this.buttonScale, this.mainButtonGap, new Vector2(0,0) ), "Create Game" ); this.mainServerListButton = new GUIPlaceholder( this.GetTiledAreaRect( this.mainButtonOffset, this.buttonScale, this.mainButtonGap, new Vector2(0,1) ), "Join Game" ); this.mainOptionsButton = new GUIPlaceholder( this.GetTiledAreaRect( this.mainButtonOffset, this.buttonScale, this.mainButtonGap, new Vector2(0,2) ), "Options" ); this.mainQuitButton = new GUIPlaceholder( this.GetTiledAreaRect( this.mainButtonOffset, this.buttonScale, this.mainButtonGap, new Vector2(0,3) ), "Quit Game" ); } }
private void UpdateLobbyGUI( bool _firstPass ) { int fighterCount = MenuNetworking.instance.connectionLimit/2 - 1; if ( _firstPass ) { this.commander1Row = this.CreatePlayerRow( TEAM.TEAM_1, 0, fighterCount ); this.commander2Row = this.CreatePlayerRow( TEAM.TEAM_2, 0, fighterCount ); this.fighters1 = new List<PlayerDisplayRow>(); this.fighters2 = new List<PlayerDisplayRow>(); for ( int i = 0; i < fighterCount; ++i ) { this.fighters1.Add( this.CreatePlayerRow( TEAM.TEAM_1, i+1, fighterCount ) ); this.fighters2.Add( this.CreatePlayerRow( TEAM.TEAM_2, i+1, fighterCount ) ); } this.forceFighter1Button = new GUIPlaceholder(); this.forceFighter1Button.rect = new Rect( this.forceTypeButtonOffset.x, this.forceTypeButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.forceFighter1Button.text = "Fighter 1"; this.forceFighter2Button = new GUIPlaceholder(); this.forceFighter2Button.rect = new Rect( this.forceTypeButtonOffset.x + this.forceTypeButtonGap.x, this.forceTypeButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.forceFighter2Button.text = "Fighter 2"; this.forceCommander1Button = new GUIPlaceholder(); this.forceCommander1Button.rect = new Rect( this.forceTypeButtonOffset.x, this.forceTypeButtonOffset.y + this.forceTypeButtonGap.y, this.buttonScale.x, this.buttonScale.y ); this.forceCommander1Button.text = "Commander 1"; this.forceCommander2Button = new GUIPlaceholder(); this.forceCommander2Button.rect = new Rect( this.forceTypeButtonOffset.x + this.forceTypeButtonGap.x, this.forceTypeButtonOffset.y + this.forceTypeButtonGap.y, this.buttonScale.x, this.buttonScale.y ); this.forceCommander2Button.text = "Commander 2"; this.lobbyBackButton = new GUIPlaceholder(); this.lobbyBackButton.rect = new Rect( this.lobbyControlButtonOffset.x, this.lobbyControlButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.lobbyBackButton.text = "Back"; this.lobbyStartButton = new GUIPlaceholder(); this.lobbyStartButton.rect = new Rect( this.lobbyControlButtonOffset.x + this.buttonScale.x + this.lobbyControlButtonGap, this.lobbyControlButtonOffset.y, this.buttonScale.x, this.buttonScale.y ); this.lobbyStartButton.text = "Start"; this.chatDisplayArea = new GUIPlaceholder(); this.chatDisplayArea.rect = new Rect( this.chatOffset.x, this.chatOffset.y, this.chatEnterWidth, this.chatDisplayHeight ); this.chatDisplayArea.text = ""; this.chatEnterField = new GUIPlaceholder(); this.chatEnterField.rect = new Rect( this.chatOffset.x, this.chatOffset.y + this.chatDisplayHeight, this.chatEnterWidth, this.chatEnterHeight ); this.chatSendButton = new GUIPlaceholder(); this.chatSendButton.rect = new Rect( this.chatOffset.x + this.chatEnterWidth, this.chatOffset.y + this.chatDisplayHeight, this.buttonScale.x, this.buttonScale.y ); this.chatSendButton.text = "Send"; this.lobbyGameNameLabel = new GUIPlaceholder(); this.lobbyGameNameLabel.text = MenuNetworking.instance.gameName; this.lobbyGameNameLabel.rect = this.lobbyGameNameRect; this.lobbyGameCommentLabel = new GUIPlaceholder(); this.lobbyGameCommentLabel.text = MenuNetworking.instance.gameComment; this.lobbyGameCommentLabel.rect = this.lobbyGameCommentRect; } UpdatePlayerRow( this.commander1Row, GamePlayerManager.instance.commander1 ); UpdatePlayerRow( this.commander2Row, GamePlayerManager.instance.commander2 ); for ( int i = 0; i < this.fighters1.Count; ++i ) { GamePlayer player = i < GamePlayerManager.instance.fighters1.Count ? GamePlayerManager.instance.fighters1[i] : null; UpdatePlayerRow( this.fighters1[i], player ); player = i < GamePlayerManager.instance.fighters2.Count ? GamePlayerManager.instance.fighters2[i] : null; UpdatePlayerRow( this.fighters2[i], player ); } string chat = ""; for ( int i = MessageManager.instance.messages.Count - 1; i >= 0; --i ) { chat += MessageManager.instance.GetFormattedMessage( i ); } this.chatDisplayArea.text = chat; }
private void UpdateCreateGameGUI( bool _firstPass ) { if ( _firstPass || Application.isEditor ) { this.createGameNameLabel = new GUIPlaceholder( this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 0, 0 ) ), "Game Name:" ); this.createGameDescriptionLabel = new GUIPlaceholder( this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 0, 1 ) ), "Description:" ); this.createGamePortLabel = new GUIPlaceholder( this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 0, 2 ) ), "Port Number:" ); this.createGamePasswordLabel = new GUIPlaceholder( this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 0, 3 ) ), "Password" ); if ( _firstPass ) { this.createGameNameField = new GUIPlaceholder(); this.createGameNameField.text = this.defaultGameName; this.createGameDescriptionField = new GUIPlaceholder(); this.createGameDescriptionField.text = this.defaultGameDescription; this.createGamePortField = new GUIPlaceholder(); this.createGamePortField.text = this.defaultGamePort; this.createGamePasswordField = new GUIPlaceholder(); this.createGamePasswordField.text = ""; } this.createGameNameField.rect = this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 1, 0 ) ); this.createGameDescriptionField.rect = this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 1, 1 ) ); this.createGamePortField.rect = this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 1, 2 ) ); this.createGamePasswordField.rect = this.GetTiledAreaRect( this.createGameCornerOffset, this.createGameLabelScale, this.createGameTextFieldGap, new Vector2( 1, 3 ) ); this.createGameBackButton = new GUIPlaceholder( new Rect( this.createGameButtonOffset.x, this.createGameButtonOffset.y, this.buttonScale.x, this.buttonScale.y ), "Back" ); this.createGameCreateButton = new GUIPlaceholder( new Rect( this.createGameButtonOffset.x + this.createGameButtonGap.x, this.createGameButtonOffset.y + this.createGameButtonGap.y, this.buttonScale.x, this.buttonScale.y ), "Create" ); } }