void Lobby_OnPlayerLeaveRoomEvent(SWLeaveRoomEventData eventData) { Debug.Log("Player left room: " + eventData); if (NetworkClient.Lobby.IsOwner) { // Remove the players from both team. roomData_.team2.players.RemoveAll(eventData.leavePlayerIds.Contains); roomData_.team1.players.RemoveAll(eventData.leavePlayerIds.Contains); // 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); } }); } }
private void OnPlayerLeaveRoomEvent(SWLeaveRoomEventData eventData) { if (State == LobbyState.JoinedRoom) { SceneManager.LoadScene("LobbyScene"); } Debug.Log("OnPlayerLeaveRoomEvent:: eventData:" + eventData); }
//Check Left Player void CheckLeftRoom(SWLeaveRoomEventData eventData) { if (NetworkClient.Lobby.IsOwner) { //check player left or oppenent if (eventData.leavePlayerIds[0] == myId) { print("You Losse , You Left The Room"); } else { print("You Winner , Oppenent Left Room"); } } }
private void OnPlayerLeaveRoom(SWLeaveRoomEventData eventData) { if (NetworkClient.Lobby.IsOwner) { foreach (string id in eventData.leavePlayerIds) { lobbyData.players.RemoveAll((player) => { return(player.playerId.Equals(id)); }); } NetworkClient.Lobby.ChangeRoomCustomData(lobbyData, (success, error) => { if (success) { RefreshPlayerList(); } else { Debug.Log("Error changing lobby data: " + error); } }); } }
void OnPlayerLeaveRoomEvent(SWLeaveRoomEventData eventData) { Debug.Log("Player left room " + eventData); if (NetworkClient.Lobby.IsOwner) { roomData_.team1.players.RemoveAll(eventData.leavePlayerIds.Contains); roomData_.team2.players.RemoveAll(eventData.leavePlayerIds.Contains); NetworkClient.Lobby.ChangeRoomCustomData(roomData_, (bool successful, SWLobbyError error) => { if (successful) { Debug.Log("ChangeRoomCustomData successful"); UpdateTeamSelectPanel(); UpdateWaitingPanel(); } else { Debug.Log("ChangeRoomCustomData failed: " + error); } }); } }