public void CmdAddPlayerToList(int NewFactionID) { //the server will share all the lobby settings for the new player foreach (NetworkLobbyPlayer NetworkPlayer in NetworkMgr.lobbySlots) //go through all the lobby slots { if (NetworkPlayer != null) { MFactionLobby_UNET LobbyPlayer = NetworkPlayer.gameObject.GetComponent <MFactionLobby_UNET>(); //remove any slots for players who disconnected and are not anymore present in the lobby if (LobbyPlayer != null) { if (LobbyPlayer.FactionID != NewFactionID) //making sure that this is not the new player that just joined { LobbyPlayer.CmdServerUpdateMap(); LobbyPlayer.CmdUpdateFactionColor(LobbyPlayer.FactionColorID, NetworkMgr.AllowedColors[LobbyPlayer.FactionColorID]); LobbyPlayer.CmdUpdateFactionName(LobbyPlayer.FactionNameInput.text); LobbyPlayer.CmdUpdateFactionType(LobbyPlayer.FactionTypeMenu.value); LobbyPlayer.CmdUpdateReadyStatus(); LobbyPlayer.CmdUpdateFactionTeam(LobbyPlayer.TeamDropDown.value); LobbyPlayer.CmdUpdatePlayerType(LobbyPlayer.PlayerType.value); } } } } }
public void CmdAddPlayerToList(int NewFactionID) { //the server will share all the lobby settings for the new player foreach (NetworkLobbyPlayer NetworkPlayer in NetworkMgr.lobbySlots) //go through all the lobby slots { if (NetworkPlayer != null) { MFactionLobby_UNET LobbyPlayer = NetworkPlayer.gameObject.GetComponent <MFactionLobby_UNET>(); //remove any slots for players who disconnected and are not anymore present in the lobby if (LobbyPlayer != null) { if (LobbyPlayer.FactionID != NewFactionID) //making sure that this is not the new player that just joined { LobbyPlayer.CmdServerUpdateMap(); //ask server to share the current map ID LobbyPlayer.CmdUpdateFactionColor(LobbyPlayer.FactionColorID); LobbyPlayer.CmdUpdateFactionName(LobbyPlayer.FactionName); LobbyPlayer.CmdUpdateFactionType(LobbyPlayer.FactionTypeID); LobbyPlayer.CmdUpdateReadyStatus(); } } } } }