private void OnPlayerRemoved(string playfabId) { ConnectedPlayer player = _connectedPlayers.Find(x => x.PlayerId.Equals(playfabId, StringComparison.OrdinalIgnoreCase)); _connectedPlayers.Remove(player); PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(_connectedPlayers); }
private void OnReceivePlayerInfo(PlayerInfo netMsg) { var playerConnection = playerConnections.Find(c => c.ConnectionId == netMsg.ConnectionId); playerConnection.ConnectedPlayer = new ConnectedPlayer(netMsg.PlayFabId); connectedPlayers.Add(playerConnection.ConnectedPlayer); PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(connectedPlayers); }
public override void OnServerDisconnect(NetworkConnection conn) { base.OnServerDisconnect(conn); Debug.Log("Client disconnected from server, ConnectionId: " + conn.connectionId); var playerConnection = playerConnections.Find(c => c.ConnectionId == conn.connectionId); connectedPlayers.Remove(playerConnection.ConnectedPlayer); playerConnections.Remove(playerConnection); PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(connectedPlayers); if (playerConnections.Count == 0) { StartCoroutine(Shutdown()); } }
private void OnServerRemovedPlayer(string infabid) { H.klog1($"A Player just left the server, fab will update and shutdown if neccessary", this.name); ///* // look in fab book, if existing then remove //foreach (ConnectedPlayer pl in _fabPlayerBook) for (int i = 0; i < _fabPlayerBook.Count; i++) { ConnectedPlayer pl = _fabPlayerBook[i]; if (pl.PlayerId.Equals(infabid, StringComparison.OrdinalIgnoreCase)) { _fabPlayerBook.Remove(pl); break; } }//*/ PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(_fabPlayerBook); CheckConnToShutDown(); }
private void OnPlayerAdded(string playfabId) { _connectedPlayers.Add(new ConnectedPlayer(playfabId)); PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(_connectedPlayers); }
private void OnServerAddedPlayer(string infabid) { H.klog1($"Fab server Got 1 client Connecting -> update connected player", this.name); _fabPlayerBook.Add(new ConnectedPlayer(infabid)); PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(_fabPlayerBook); }