예제 #1
0
        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());
        }
    }
예제 #4
0
파일: FabServer.cs 프로젝트: JK-IT/UnityGit
    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();
    }
예제 #5
0
 private void OnPlayerAdded(string playfabId)
 {
     _connectedPlayers.Add(new ConnectedPlayer(playfabId));
     PlayFabMultiplayerAgentAPI.UpdateConnectedPlayers(_connectedPlayers);
 }
예제 #6
0
파일: FabServer.cs 프로젝트: JK-IT/UnityGit
 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);
 }