Esempio n. 1
0
        public static void RemovePlayerIdReceived(int _fromClient, Packet _packet)
        {
            int _id = _packet.ReadInt();

            Postgres.RemovePlayer(_id);
            ServerSend.SendPlayers(_fromClient, Server.clients[_fromClient].clientData.personalDataId);
        }
Esempio n. 2
0
        public static void NewPlayerReceived(int _fromClient, Packet _packet)
        {
            string _nickname = _packet.ReadString();
            int    _PD_ID    = Server.clients[_fromClient].clientData.personalDataId;

            if (Postgres.AddNewPlayer(_nickname, _PD_ID))
            {
                ServerSend.SendPlayers(_fromClient, _PD_ID);
            }
            else
            {
                ServerSend.PlayerAlreadyExists(_fromClient);
            }
        }
Esempio n. 3
0
        public static void WelcomeReceived(int _fromClient, Packet _packet)
        {
            int    _clientIdCheck = _packet.ReadInt();
            string _email         = _packet.ReadString();
            string _password      = _packet.ReadString();

            if (_fromClient != _clientIdCheck)
            {
                Console.WriteLine($"User with email \"{_email}\" (ID: {_fromClient}) has assumed the wrong client ID ({_clientIdCheck})!");
            }
            else
            {
                Console.WriteLine($"{Server.clients[_fromClient].tcp.socket.Client.RemoteEndPoint} with email {_email} connected and is having ID = {_fromClient}. Checking user data...");
                int _result = Postgres.CheckEmailAndPassword(_email, _password);
                Server.clients[_fromClient].clientData.personalDataId = _result;
                ServerSend.SendPlayers(_fromClient, _result);
            }
        }
Esempio n. 4
0
 public static void UpdatePlayersList(int _fromClient, Packet _packet)
 {
     ServerSend.SendPlayers(_fromClient, Server.clients[_fromClient].clientData.personalDataId);
 }