示例#1
0
        public void Deserialize(INetDataReader reader)
        {
            StarIndex = reader.GetInt();
            int starId = (StarIndex + 1) * 100;
            int count  = reader.GetUShort();

            BulletList = new List <Projectile>(count);
            for (int i = 0; i < count; i++)
            {
                Projectile data = new Projectile
                {
                    PlanetId = reader.GetByte() + starId,
                    Interval = reader.GetByte(),
                    TargetId = reader.GetUShort(),
                    LocalPos = reader.GetFloat3().ToVector3()
                };
                BulletList.Add(data);
            }
            count      = reader.GetUShort();
            RocketList = new List <Projectile>(count);
            for (ushort i = 0; i < count; i++)
            {
                Projectile data = new Projectile
                {
                    PlanetId = reader.GetByte() + starId,
                    Interval = reader.GetByte(),
                    TargetId = reader.GetUShort(),
                    LocalPos = reader.GetFloat3().ToVector3()
                };
                RocketList.Add(data);
            }
        }
示例#2
0
        public void Deserialize_5(INetDataReader reader)
        {
            Username      = reader.GetString();
            PlayerId      = reader.GetUShort();
            LocalPlanetId = reader.GetInt();
            MechaColors   = new Float4[reader.GetInt()];
            for (int i = 0; i < MechaColors.Length; i++)
            {
                MechaColors[i] = reader.GetFloat4();
            }
            LocalPlanetPosition = reader.GetFloat3();
            UPosition           = reader.GetDouble3();
            Rotation            = reader.GetFloat3();
            BodyRotation        = reader.GetFloat3();
            Mecha = new MechaData();
            Mecha.Deserialize(reader);
            bool isAppearancePresent = reader.GetBool();

            if (isAppearancePresent)
            {
                int    len  = reader.GetInt();
                byte[] data = new byte[len];
                reader.GetBytes(data, len);
                using (MemoryStream ms = new MemoryStream(data))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Appearance = new MechaAppearance();
                        Appearance.Init();
                        Appearance.Import(br);
                    }
            }
        }
示例#3
0
 public void Deserialize_4(INetDataReader reader)
 {
     Username      = reader.GetString();
     PlayerId      = reader.GetUShort();
     LocalPlanetId = reader.GetInt();
     MechaColors   = new Float4[reader.GetInt()];
     for (int i = 0; i < MechaColors.Length; i++)
     {
         MechaColors[i] = reader.GetFloat4();
     }
     LocalPlanetPosition = reader.GetFloat3();
     UPosition           = reader.GetDouble3();
     Rotation            = reader.GetFloat3();
     BodyRotation        = reader.GetFloat3();
     Mecha = new MechaData();
     Mecha.Deserialize(reader);
 }