Ejemplo n.º 1
0
        public override void ProcessClient(Client c)
        {
            ByteMessage byteMessage = c.GetByteMessage();

            switch (byteMessage.ReadTag())
            {
            case "CRD":
                string username = byteMessage.ReadString();
                string password = byteMessage.ReadString();
                Console.WriteLine("Incoming credentials: Username {0}, Password {1}, Clients logging in: {2}", username, password, clients.Count);

                // Successfully received credentials, tell user it's allright, give it an id and transfer it to the game service
                ByteMessage ok = new ByteMessage();
                ok.WriteTag("LOK");
                ok.WriteInt(id);
                var x = 3.0f;
                var z = 3.0f;
                ok.WriteFloat(x);     // x
                ok.WriteFloat(z);     // z
                c.id = id;
                c.transform.setPosition(new Vector2(x, z));
                id++;
                c.SendMessage(ok);
                //c.Load();
                SslTcpServer.ServiceBay.gameService.ReceiveClient(c);
                DropClient(c);
                break;
            }
        }
Ejemplo n.º 2
0
        public override void ProcessClient(Client c)
        {
            ByteMessage byteMessage = c.GetByteMessage();

            switch (byteMessage.ReadTag())
            {
            case "VER":
                string version = byteMessage.ReadString();
                Console.WriteLine("Client Version: {0}", version);

                SslTcpServer.ServiceBay.loginService.ReceiveClient(c);

                //Sends user to the login service and ask for credentials (AFC)
                ByteMessage creds = new ByteMessage();
                creds.WriteTag("AFC");
                c.SendMessage(creds);

                DropClient(c);
                break;
            }
        }