Exemplo n.º 1
0
        public static NetworkError RegisterClient(TCPServerInfos client, string password)
        {
            if (NetworkingHelper.GetInstance().Server.Room == null)
            {
                return(NetworkError.NoRoomStarted);
            }

            if (NetworkingHelper.GetInstance().Server.Room.Password != "")
            {
                if (NetworkingHelper.GetInstance().Server.Room.Password != password)
                {
                    return(NetworkError.BadPassword);
                }
            }

            if (client == null)
            {
                return(NetworkError.NullClientSent);
            }

            if (_clients == null)
            {
                _clients = new List <TCPServerInfos>();
            }

            _clients.RemoveAll(x => x.ServerIP == client.ServerIP);

            _clients.Add(client);

            return(NetworkError.None);
        }
Exemplo n.º 2
0
        public static NetworkError RemoveClient(TCPServerInfos client)
        {
            if (client == null)
            {
                return(NetworkError.NullClientSent);
            }

            if (_clients == null)
            {
                _clients = new List <TCPServerInfos>();
            }

            _clients.Remove(client);

            return(NetworkError.None);
        }
Exemplo n.º 3
0
 public ClientUnregisterPacket(TCPServerInfos client) : base(PacketType.CLIENTPACKETUNREGISTER)
 {
     _client = client;
 }
Exemplo n.º 4
0
 public ClientRegisterPacket(TCPServerInfos client, string password) : base(PacketType.CLIENTREGISTER)
 {
     _client  = client;
     Password = password;
 }