44
55namespace UnityAsset . NET . SerializedFile ;
66
7- public class SerializedType
7+ public sealed class SerializedType
88{
99 public int ClassID ;
1010
1111 public bool IsStrippedType ;
1212
1313 public short ScriptTypeIndex ;
1414
15+ public Hash128 ScriptIdHash ;
16+
17+ public Hash128 TypeHash ;
18+
19+ public bool IsRefType ;
20+
21+ public List < SerializedType > Nodes ;
22+
23+ public byte [ ] StringBufferBytes ;
24+
25+ public int [ ] TypeDependencies ;
26+
27+ public SerializedTypeReference TypeReference ;
28+
1529 public SerializedType ( AssetReader reader , SerializedFileFormatVersion version , bool typeTreeEnabled , bool isRefType )
1630 {
1731 ClassID = reader . ReadInt32 ( ) ;
@@ -34,7 +48,39 @@ public SerializedType(AssetReader reader, SerializedFileFormatVersion version, b
3448 ( version >= RefactorTypeData && ClassID == ( int ) AssetClassID . MonoBehaviour ) ||
3549 ( isRefType && ScriptTypeIndex > 0 ) )
3650 {
37- //ScriptIdHash = new Hash128(reader);
51+ ScriptIdHash = new Hash128 ( reader ) ;
52+ }
53+
54+ TypeHash = new Hash128 ( reader ) ;
55+ IsRefType = isRefType ;
56+
57+ if ( typeTreeEnabled )
58+ {
59+ int typeTreeNodeCount = reader . ReadInt32 ( ) ;
60+ int stringBufferLen = reader . ReadInt32 ( ) ;
61+ Nodes = new List < SerializedType > ( typeTreeNodeCount ) ;
62+ for ( int i = 0 ; i < typeTreeNodeCount ; i ++ )
63+ {
64+ Nodes . Add ( new SerializedType ( reader , version , typeTreeEnabled , false ) ) ;
65+ }
66+ StringBufferBytes = reader . ReadBytes ( stringBufferLen ) ;
67+ if ( version >= StoresTypeDependencies )
68+ {
69+ if ( ! isRefType )
70+ {
71+ int dependenciesCount = reader . ReadInt32 ( ) ;
72+ TypeDependencies = new int [ dependenciesCount ] ;
73+ for ( int i = 0 ; i < dependenciesCount ; i ++ )
74+ {
75+ TypeDependencies [ i ] = reader . ReadInt32 ( ) ;
76+ }
77+ }
78+ else
79+ {
80+ TypeReference = new SerializedTypeReference ( ) ;
81+ TypeReference . ReadMetadata ( reader ) ;
82+ }
83+ }
3884 }
3985 }
4086}
0 commit comments