-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathAssetTypeInstance.cs
More file actions
41 lines (37 loc) · 1.36 KB
/
AssetTypeInstance.cs
File metadata and controls
41 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace AssetsTools.NET
{
public class AssetTypeInstance
{
public int baseFieldCount;
public AssetTypeValueField[] baseFields;
public AssetTypeInstance(AssetTypeTemplateField[] baseFields, AssetsFileReader reader, long filePos)
{
reader.bigEndian = false;
reader.Position = filePos;
this.baseFieldCount = baseFields.Length;
this.baseFields = new AssetTypeValueField[baseFieldCount];
for (int i = 0; i < baseFieldCount; i++)
{
AssetTypeTemplateField templateBaseField = baseFields[i];
AssetTypeValueField atvf = templateBaseField.MakeValue(reader);
this.baseFields[i] = atvf;
}
}
public AssetTypeInstance(AssetTypeTemplateField baseField, AssetsFileReader reader, long filePos)
: this(new[] { baseField }, reader, filePos)
{
}
public static AssetTypeValueField GetDummyAssetTypeField()
{
AssetTypeValueField atvf = new AssetTypeValueField();
atvf.childrenCount = -1;
return atvf;
}
public AssetTypeValueField GetBaseField(int index = 0)
{
if (index >= baseFieldCount)
return GetDummyAssetTypeField();
return baseFields[index];
}
}
}