11namespace SharpNeedle . Ninja . Csd ;
22
33[ StructLayout ( LayoutKind . Sequential ) ]
4- public struct CastInfo
4+ public struct CastInfo : IBinarySerializable
55{
66 public uint HideFlag ;
77 public Vector2 Translation ;
@@ -16,4 +16,44 @@ public struct CastInfo
1616 public uint Field30 ;
1717 public uint Field34 ;
1818 public uint Field38 ;
19+
20+ public void Read ( BinaryObjectReader reader )
21+ {
22+ HideFlag = reader . Read < uint > ( ) ;
23+ Translation = reader . Read < Vector2 > ( ) ;
24+ Rotation = reader . Read < float > ( ) ;
25+ Scale = reader . Read < Vector2 > ( ) ;
26+ SpriteIndex = reader . Read < float > ( ) ;
27+
28+ // Colours are handled as uints for endianness
29+ Unsafe . As < Color < byte > , uint > ( ref Color ) = reader. Read < uint > ( ) ;
30+ Unsafe . As < Color < byte > , uint > ( ref GradientTopLeft ) = reader. Read < uint > ( ) ;
31+ Unsafe . As < Color < byte > , uint > ( ref GradientBottomLeft ) = reader. Read < uint > ( ) ;
32+ Unsafe . As < Color < byte > , uint > ( ref GradientTopRight ) = reader. Read < uint > ( ) ;
33+ Unsafe . As < Color < byte > , uint > ( ref GradientBottomRight ) = reader. Read < uint > ( ) ;
34+
35+ Field30 = reader . Read < uint > ( ) ;
36+ Field34 = reader . Read < uint > ( ) ;
37+ Field38 = reader . Read < uint > ( ) ;
38+ }
39+
40+ public void Write ( BinaryObjectWriter writer )
41+ {
42+ writer . Write ( HideFlag ) ;
43+ writer . Write ( Translation ) ;
44+ writer . Write ( Rotation ) ;
45+ writer . Write ( Scale ) ;
46+ writer . Write ( SpriteIndex ) ;
47+
48+ // Colours are handled as uints for endianness
49+ writer . Write ( Unsafe . As < Color < byte > , uint > ( ref Color ) ) ;
50+ writer . Write ( Unsafe . As < Color < byte > , uint > ( ref GradientTopLeft ) ) ;
51+ writer . Write ( Unsafe . As < Color < byte > , uint > ( ref GradientBottomLeft ) ) ;
52+ writer . Write ( Unsafe . As < Color < byte > , uint > ( ref GradientTopRight ) ) ;
53+ writer . Write ( Unsafe . As < Color < byte > , uint > ( ref GradientBottomRight ) ) ;
54+
55+ writer . Write ( Field30 ) ;
56+ writer . Write ( Field34 ) ;
57+ writer . Write ( Field38 ) ;
58+ }
1959}
0 commit comments