Ejemplo n.º 1
0
        private void ServerOnClientConnected(INetworkServerClient client)
        {
            Debug.Log("Client connected: " + client.Id);
            CreateStructure(client.Id);
            NetworkServer.SendTcpToAll(client.Id, TcpPacketType.Server_State_Joined, buffer => buffer.Write(client.Id));

            if (NetworkServer.ClientCount > 0)
            {
                NetworkServer.SendTcp(client, TcpPacketType.Server_State_Joined,
                                      buffer => NetworkServer.ForEachClient(client.Id, other => buffer.Write(other.Id)));
            }
        }
Ejemplo n.º 2
0
        private static void ServerOnClientConnected(INetworkServerClient client)
        {
            Debug.Log("Client connected: " + client.Id);
            if (NetworkServer.ClientCount == 0)
            {
                return;
            }

            NetworkServer.SendTcp(client, TcpPacketType.Server_State_Joined, buff => NetworkServer.ForEachClient(other =>
                                                                                                                 other != client && PlayerStructures.ContainsKey(other.Id), other => {
                buff.Write(other.Id);
                byte[] structure = PlayerStructures[other.Id];
                buff.Write(structure.Length);
                buff.Write(structure);
            }));
        }