예제 #1
0
        public ulong Read(AssetsFileReader reader, ulong filePos, int version)
        {
            classId   = reader.ReadInt32();
            baseClass = reader.ReadInt32();
            name      = new ClassDatabaseFileString();
            name.Read(reader, reader.Position);
            uint fieldCount = reader.ReadUInt32();

            fields = new List <ClassDatabaseTypeField>();
            for (int j = 0; j < fieldCount; j++)
            {
                ClassDatabaseTypeField cdtf = new ClassDatabaseTypeField();
                cdtf.Read(reader, filePos, version);
                fields.Add(cdtf);
            }
            return(reader.Position);
        }
예제 #2
0
        public bool FromClassDatabase(ClassDatabaseFile pFile, ClassDatabaseType pType, uint fieldIndex)
        {
            ClassDatabaseTypeField field = pType.fields[(int)fieldIndex];

            name      = field.fieldName.GetString(pFile);
            type      = field.typeName.GetString(pFile);
            valueType = AssetTypeValueField.GetValueTypeByTypeName(type);
            isArray   = field.isArray == 1 ? true : false;
            align     = (field.flags2 & 0x4000) != 0x00 ? true : false;
            hasValue  = (valueType == EnumValueTypes.ValueType_None) ? false : true;

            List <int> childrenIndexes = new List <int>();
            int        thisDepth       = pType.fields[(int)fieldIndex].depth;

            for (int i = (int)fieldIndex + 1; i < pType.fields.Count; i++)
            {
                if (pType.fields[i].depth == thisDepth + 1)
                {
                    childrenCount++;
                    childrenIndexes.Add(i);
                }
                if (pType.fields[i].depth <= thisDepth)
                {
                    break;
                }
            }
            children = new AssetTypeTemplateField[childrenCount];
            int child = 0;

            for (int i = (int)fieldIndex + 1; i < pType.fields.Count; i++)
            {
                if (pType.fields[i].depth == thisDepth + 1)
                {
                    children[child] = new AssetTypeTemplateField();
                    children[child].FromClassDatabase(pFile, pType, (uint)childrenIndexes[child]);
                    child++;
                }
                if (pType.fields[i].depth <= thisDepth)
                {
                    break;
                }
            }
            return(true);
        }