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); }
///public AssetTypeTemplateField() ///public void Clear() public bool From0D(Type_0D u5Type, int fieldIndex) { TypeField_0D field = u5Type.typeFieldsEx[fieldIndex]; name = field.GetNameString(u5Type.stringTable); type = field.GetTypeString(u5Type.stringTable); valueType = AssetTypeValueField.GetValueTypeByTypeName(type); isArray = field.isArray == 1 ? true : false; align = (field.flags & 0x4000) != 0x00 ? true : false; hasValue = (valueType == EnumValueTypes.ValueType_None) ? false : true; List <int> childrenIndexes = new List <int>(); int thisDepth = u5Type.typeFieldsEx[fieldIndex].depth; for (int i = fieldIndex + 1; i < u5Type.typeFieldsExCount; i++) { if (u5Type.typeFieldsEx[i].depth == thisDepth + 1) { childrenCount++; childrenIndexes.Add(i); } if (u5Type.typeFieldsEx[i].depth <= thisDepth) { break; } } children = new AssetTypeTemplateField[childrenCount]; int child = 0; for (int i = fieldIndex + 1; i < u5Type.typeFieldsExCount; i++) { if (u5Type.typeFieldsEx[i].depth == thisDepth + 1) { children[child] = new AssetTypeTemplateField(); children[child].From0D(u5Type, childrenIndexes[child]); child++; } if (u5Type.typeFieldsEx[i].depth <= thisDepth) { break; } } return(true); }