public override void Initialize(System.IO.BinaryReader reader, RecordHeader header)
        {
            var clothingParts = new List <ApparelRecordPiece>();

            while (reader.BaseStream.Position < header.DataEndPos)
            {
                var type = (SubRecordType)reader.ReadInt32();
                var size = reader.ReadInt32();

                switch (type)
                {
                case SubRecordType.Id:
                    name = reader.ReadString(size);
                    break;

                case SubRecordType.Model:
                    model = reader.ReadString(size);
                    break;

                case SubRecordType.Name:
                    fullName = reader.ReadString(size);
                    break;

                case SubRecordType.Script:
                    script = Script.Get(reader.ReadString(size));
                    break;

                case SubRecordType.ItemTexture:
                    CreateSprite(reader.ReadString(size));
                    break;

                case SubRecordType.Enchantment:
                    enchantment = Record.GetRecord <EnchantmentData>(reader.ReadString(size));
                    break;

                case SubRecordType.Index:
                    clothingParts.Add(new ApparelRecordPiece());
                    clothingParts[clothingParts.Count - 1].Index = (BipedPart)reader.ReadByte();
                    break;

                case SubRecordType.BodyName:
                    clothingParts[clothingParts.Count - 1].MalePart = BodyPartRecord.Get(reader.ReadString(size));
                    break;

                case SubRecordType.CreatureName:
                    clothingParts[clothingParts.Count - 1].FemalePart = BodyPartRecord.Get(reader.ReadString(size));
                    break;

                case SubRecordType.ClothingData:
                    data = new ClothingRecordData(reader);
                    break;
                }
            }

            this.clothingParts = clothingParts.ToArray();
        }
Exemple #2
0
        public override void Initialize(System.IO.BinaryReader reader, RecordHeader header)
        {
            while (reader.BaseStream.Position < header.DataEndPos)
            {
                var type = (SubRecordType)reader.ReadInt32();
                var size = reader.ReadInt32();

                switch (type)
                {
                case SubRecordType.Id:
                    name = reader.ReadString(size);
                    break;

                case SubRecordType.Model:
                    model = reader.ReadString(size);
                    break;

                case SubRecordType.Name:
                    fullName = reader.ReadString(size);
                    break;

                case SubRecordType.Script:
                    script = Script.Get(reader.ReadString(size));
                    break;

                case SubRecordType.ItemTexture:
                    CreateSprite(reader.ReadString(size));
                    break;

                case SubRecordType.Enchantment:
                    enchantment = Record.GetRecord <EnchantmentData>(reader.ReadString(size));
                    break;

                case SubRecordType.BookData:
                    data = new BookRecordData(reader);
                    break;

                case SubRecordType.Text:
                    text = reader.ReadString(size);
                    break;
                }
            }
        }