(UnityObject): added Type property.

This commit is contained in:
morkt
2018-10-04 07:54:36 +04:00
parent f376104f47
commit 1c049dc6ca
4 changed files with 37 additions and 32 deletions

View File

@@ -198,15 +198,23 @@ namespace GameRes.Formats.Unity
reader.ReadByte();
}
public string Type {
public string TypeName {
get {
var type_tree = Asset.Tree.TypeTrees;
if (type_tree.ContainsKey (TypeId))
return type_tree[TypeId].Type;
var type = this.Type;
if (type != null)
return type.Type;
return string.Format ("[TypeId:{0}]", TypeId);
}
}
public TypeTree Type {
get {
TypeTree type;
Asset.Tree.TypeTrees.TryGetValue (TypeId, out type);
return type;
}
}
public override string ToString ()
{
return string.Format ("<{0} {1}>", Type, ClassId);
@@ -260,6 +268,8 @@ namespace GameRes.Formats.Unity
}
else if ("int" == node.Type)
obj = input.ReadInt32();
else if ("unsigned int" == node.Type)
obj = input.ReadUInt32();
else if ("bool" == node.Type)
obj = input.ReadBool();
else