Exemplo n.º 1
0
        /// <summary>Send the event to the client for display.</summary>
        /// <param name="logEvent">Describes the event.</param>
        protected override void Write(LogEventInfo logEvent)
        {
            // Could do some preprocessing here...

            var slog = Layout.Render(logEvent);

            ClientNotification?.Invoke(logEvent.Level, slog);
        }
 void ClientDisconnected(ClientDataContainer client)
 {
     ClientDataList.Remove(client);
     OnClientDisconnected?.Invoke(client);
     client.AutonomousObjects.ForEach((r) =>
     {
         DestroyReplicatedObject(r.Id);
     });
     Debug.Log("Client Disconnected : " + client.address);
 }
    void AcceptedClientCallback(System.IAsyncResult ar)
    {
        Debug.Log("Server: Client Connected");
        TcpClient           client = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);
        ClientDataContainer c      = new ClientDataContainer()
        {
            TcpSocket = client, address = ((IPEndPoint)client.Client.RemoteEndPoint).Address, AutonomousObjects = new List <ReplicatiorBase>(), NetworkId = NetIdBuffer++
        };

        Debug.Log("Client IPAddress : " + c.address);
        ClientDataList.Add(c);
        OnNewClientConnected?.Invoke(c);
    }