示例#1
0
        private AaronCarPartAttribute ConvertAttribute(CarPartAttribute rawAttribute)
        {
            AaronCarPartAttribute attribute = new AaronCarPartAttribute();

            attribute.Name = HashResolver.Resolve(rawAttribute.NameHash);

            switch (attribute.Name)
            {
            case "TEXTURE":
            case "LOD_CHARACTERS_OFFSET":
            case "NAME_OFFSET":
                this.LoadSingleAttribString(attribute, rawAttribute);
                break;

            case "LOD_BASE_NAME":
                this.LoadDoubleAttribString(attribute, rawAttribute);
                break;

            default:
                //attribute.Value = rawAttribute.iParam;
                this.SetAttributeValue(attribute, rawAttribute);
                break;
            }
            return(attribute);
        }
示例#2
0
 public override void Read(BinaryReader br)
 {
     this.ClassHash   = br.ReadUInt32();
     this.RowNameHash = br.ReadUInt32();
     br.ReadInt32();
     this.Class   = HashResolver.Resolve(this.ClassHash);
     this.RowName = HashResolver.Resolve(this.RowNameHash);
 }
示例#3
0
        public override void Read(BinaryReader br)
        {
            ClassHash   = br.ReadUInt32();
            RowNameHash = br.ReadUInt32();
            Factor      = br.ReadSingle();

            Class   = HashResolver.Resolve(ClassHash);
            RowName = HashResolver.Resolve(RowNameHash);
        }
示例#4
0
        public override void Read(BinaryReader br)
        {
            ClassHash   = br.ReadUInt32();
            RowNameHash = br.ReadUInt32();
            br.ReadInt32();
            Level = br.ReadUInt32();

            Class   = HashResolver.Resolve(ClassHash);
            RowName = HashResolver.Resolve(RowNameHash);
        }
示例#5
0
        private void ProcessCarHashList(Chunk chunk)
        {
            if (chunk.Size % 4 != 0)
            {
                throw new InvalidDataException("malformed car hash list chunk");
            }

            Progress?.Report("Processing car part collection hash list");

            while (Stream.Position < chunk.EndOffset)
            {
                AaronCarPartCollection carPartCollection = new AaronCarPartCollection();
                carPartCollection.Name  = HashResolver.Resolve(Reader.ReadUInt32());
                carPartCollection.Parts = new SynchronizedObservableCollection <AaronCarPartRecord>();

                this._carPartService.AddCarPartCollection(carPartCollection);
            }
        }
示例#6
0
        private void ProcessCarPartTable(Chunk chunk)
        {
            if (chunk.Size % 0xC != 0)
            {
                throw new InvalidDataException("Malformed car part table chunk");
            }

            DebugTiming.BeginTiming("ProcessCarPartTable");

            Progress?.Report("Processing car parts");

            List <AaronCarPartAttribute> attributes = new List <AaronCarPartAttribute>();

            var allCollections = _carPartService.GetCarPartCollections();
            Dictionary <int, AaronCarPartCollection> collectionsDict =
                allCollections.ToDictionary(c => allCollections.IndexOf(c), c => c);

            while (Stream.Position < chunk.EndOffset)
            {
                DBCarPart dbCarPart = BinaryHelpers.ReadStruct <DBCarPart>(Reader);

                var part = new AaronCarPartRecord();
                part.Name       = HashResolver.Resolve(dbCarPart.Hash);
                part.Attributes = this.PrepareAttributes(dbCarPart);

                attributes.AddRange(part.Attributes);
                //_carPartService.GetCarPartCollections()
                collectionsDict[dbCarPart.CarIndex].Parts.Add(part);
                //_carPartService.GetCarPartCollectionByIndex(dbCarPart.CarIndex).Parts.Add(part);
            }


            var uniqueAttribs = attributes.DistinctBy(a => a.GetHashCode()).Count();

            DebugTiming.EndTiming("ProcessCarPartTable");

            // we can discard internal attribute data now
            _attributeOffsetTables.Clear();
            _attributes.Clear();
        }
示例#7
0
        private void ProcessDataTable(Chunk chunk)
        {
            Progress?.Report("Processing data table");
            Stream.Align(0x10);

            var table = new AaronDataTable();

            table.Name    = HashResolver.Resolve(Reader.ReadUInt32());
            table.Entries = new List <AaronDataTableEntry>();

            while (Stream.Position < chunk.EndOffset)
            {
                var entry = new AaronDataTableEntry();
                entry.Name     = HashResolver.Resolve(Reader.ReadUInt32());
                entry.Unknown  = Reader.ReadUInt32();
                entry.Unknown2 = Reader.ReadSingle();

                table.Entries.Add(entry);
            }

            _dataTableService.AddDataTable(table);
        }
示例#8
0
 public override void Read(BinaryReader br)
 {
     this.Hash  = br.ReadUInt32();
     this.Value = HashResolver.Resolve(this.Hash);
 }
示例#9
0
 public override void Read(BinaryReader br)
 {
     Hash  = br.ReadUInt32();
     Value = HashResolver.Resolve(Hash);
 }