void Lobby_OnNewPlayerJoinRoomEvent(SWJoinRoomEventData eventData) { Debug.Log("Player joined room"); Debug.Log(eventData); // Store the new playerId and player name pair playersDict_[eventData.newPlayerId] = eventData.GetString(); if (NetworkClient.Lobby.IsOwner) { // Find the smaller team and assign the new player to it. if (roomData_.team1.players.Count < roomData_.team2.players.Count) { roomData_.team1.players.Add(eventData.newPlayerId); } else { roomData_.team2.players.Add(eventData.newPlayerId); } // Update the room custom data NetworkClient.Lobby.ChangeRoomCustomData(roomData_, (bool successful, SWLobbyError error) => { if (successful) { Debug.Log("ChangeRoomCustomData successful"); RefreshPlayerList(); } else { Debug.Log("ChangeRoomCustomData failed: " + error); } }); } }
void OnNewPlayerJoinRoomEvent(SWJoinRoomEventData eventData) { Debug.Log("Player joined room"); Debug.Log(eventData); // Store the new playerId and player name pair playersDict_[eventData.newPlayerId] = eventData.GetString(); // Update the room custom data NetworkClient.Lobby.ChangeRoomCustomData(roomData_, (bool successful, SWLobbyError error) => { if (successful) { Debug.Log("ChangeRoomCustomData successful"); } else { Debug.Log("ChangeRoomCustomData failed: " + error); } }); }