Пример #1
0
        public void Disconnect()
        {
            networkStream.Close();
            socket.Close();

            Server.clients.Remove(this);
            Server.NotifyAll(name + " left the server");
        }
Пример #2
0
        private static void AddClient(Client client)
        {
            if (clients.Count >= maxPlayers)
            {
                Server.NotifyAll("Server full!");
                return;
            }

            clients.Add(client);

            if (clients.Count == 1)
            {
                client.admin = true;
            }

            Server.NotifyAll(client.name + " joined the server!");
        }