예제 #1
0
 public void OnLostConnection(IDoubleServerClient client, DoubleServer.ClientState state)
 {
     if (state == DoubleServer.ClientState.Authenticated)
     {
         UnityFixedDispatcher.InvokeNoDelay(() => {
             if (_server != null)
             {
                 NetworkServerClient serverClient = (NetworkServerClient)client.ExtraData;
                 lock (UdpPayloadLock) {                             //Don't let the TickingThread send before the client is deinitialized
                     _clients.Remove(serverClient);
                     DisconnectHandler(serverClient);
                 }
             }
         });
     }
 }
예제 #2
0
        public void OnLostConnection(IDoubleServerClient client, DoubleServer.ClientState state)
        {
            if (state != DoubleServer.ClientState.Authenticated)
            {
                return;
            }

            Player disconnectedPlayer = (Player)client.ExtraData;

            _players.Remove(disconnectedPlayer);
            _colors.Enqueue(disconnectedPlayer.Color);

            foreach (Player player in _players)
            {
                _server.SendTcp(player.ServerClient, buffer => {
                    buffer.Write(false);
                    buffer.WriteBits(disconnectedPlayer.Id, 2);
                });
            }
        }
예제 #3
0
 public void OnLostConnection(IDoubleServerClient client, DoubleServer.ClientState state)
 {
     Console.WriteLine($"Server lost connection to client ({state})");
 }