Esempio 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;
            }
        }
Esempio n. 2
0
        //
        // On attends que le client nous dise s'il veut faire un donjon, auquel cas on le redirige vers un service approprié
        //
        public override void ProcessClient(Client c)
        {
            ByteMessage byteMessage = c.GetByteMessage();

            switch (byteMessage.ReadTag())
            {
            case "OMV":     // Movement intent
            {
                int          id       = byteMessage.ReadInt();
                int          segments = byteMessage.ReadInt();
                List <float> dx       = new List <float>();
                List <float> dy       = new List <float>();
                List <float> rx       = new List <float>();
                List <float> ry       = new List <float>();
                List <float> time     = new List <float>();
                for (int i = 0; i < segments; i++)
                {
                    dx.Add(byteMessage.ReadFloat());
                    dy.Add(byteMessage.ReadFloat());
                    rx.Add(byteMessage.ReadFloat());
                    ry.Add(byteMessage.ReadFloat());
                    time.Add(byteMessage.ReadFloat());
                }
                c.actions[0] = new Actions.MoveAction(dx, dy, rx, ry, time);
            }
            break;

            case "PNG":
            {
                c.HeartBeat();
            }
            break;
            }
        }
Esempio n. 3
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;
            }
        }