Example #1
0
        protected void MsgAboutToPlay(BinaryReader reader)
        {
            var packet = new AboutToPlayPacket();

            packet.Unserialize(reader);

            IPacket s;

            if (Server.ValidateServer(this, packet.ServerId))
            {
                s = new PlayOkPacket
                {
                    OneTimeKey = OneTimeKey,
                    ServerId   = packet.ServerId,
                    UserId     = 0
                };
            }
            else
            {
                s = new PlayFailPacket
                {
                    ResultCode = 1
                };

                _disconnect = true;
            }

            var data = CreatePacket(s);

            Socket.BeginSend(data, 0, data.Length, EndSend, true);
        }