xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/Example/StructOfStructs.cs (revision 890232f25432b36107d06881e0a25aaa6b473652)
1 // <auto-generated>
2 //  automatically generated by the FlatBuffers compiler, do not modify
3 // </auto-generated>
4 
5 namespace MyGame.Example
6 {
7 
8 using global::System;
9 using global::System.Collections.Generic;
10 using global::FlatBuffers;
11 
12 public struct StructOfStructs : IFlatbufferObject
13 {
14   private Struct __p;
15   public ByteBuffer ByteBuffer { get { return __p.bb; } }
__initMyGame.Example.StructOfStructs16   public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
__assignMyGame.Example.StructOfStructs17   public StructOfStructs __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
18 
19   public MyGame.Example.Ability A { get { return (new MyGame.Example.Ability()).__assign(__p.bb_pos + 0, __p.bb); } }
20   public MyGame.Example.Test B { get { return (new MyGame.Example.Test()).__assign(__p.bb_pos + 8, __p.bb); } }
21   public MyGame.Example.Ability C { get { return (new MyGame.Example.Ability()).__assign(__p.bb_pos + 12, __p.bb); } }
22 
CreateStructOfStructsMyGame.Example.StructOfStructs23   public static Offset<MyGame.Example.StructOfStructs> CreateStructOfStructs(FlatBufferBuilder builder, uint a_Id, uint a_Distance, short b_A, sbyte b_B, uint c_Id, uint c_Distance) {
24     builder.Prep(4, 20);
25     builder.Prep(4, 8);
26     builder.PutUint(c_Distance);
27     builder.PutUint(c_Id);
28     builder.Prep(2, 4);
29     builder.Pad(1);
30     builder.PutSbyte(b_B);
31     builder.PutShort(b_A);
32     builder.Prep(4, 8);
33     builder.PutUint(a_Distance);
34     builder.PutUint(a_Id);
35     return new Offset<MyGame.Example.StructOfStructs>(builder.Offset);
36   }
UnPackMyGame.Example.StructOfStructs37   public StructOfStructsT UnPack() {
38     var _o = new StructOfStructsT();
39     this.UnPackTo(_o);
40     return _o;
41   }
UnPackToMyGame.Example.StructOfStructs42   public void UnPackTo(StructOfStructsT _o) {
43     _o.A = this.A.UnPack();
44     _o.B = this.B.UnPack();
45     _o.C = this.C.UnPack();
46   }
PackMyGame.Example.StructOfStructs47   public static Offset<MyGame.Example.StructOfStructs> Pack(FlatBufferBuilder builder, StructOfStructsT _o) {
48     if (_o == null) return default(Offset<MyGame.Example.StructOfStructs>);
49     var _a_id = _o.A.Id;
50     var _a_distance = _o.A.Distance;
51     var _b_a = _o.B.A;
52     var _b_b = _o.B.B;
53     var _c_id = _o.C.Id;
54     var _c_distance = _o.C.Distance;
55     return CreateStructOfStructs(
56       builder,
57       _a_id,
58       _a_distance,
59       _b_a,
60       _b_b,
61       _c_id,
62       _c_distance);
63   }
64 }
65 
66 public class StructOfStructsT
67 {
68   [Newtonsoft.Json.JsonProperty("a")]
69   public MyGame.Example.AbilityT A { get; set; }
70   [Newtonsoft.Json.JsonProperty("b")]
71   public MyGame.Example.TestT B { get; set; }
72   [Newtonsoft.Json.JsonProperty("c")]
73   public MyGame.Example.AbilityT C { get; set; }
74 
StructOfStructsT()75   public StructOfStructsT() {
76     this.A = new MyGame.Example.AbilityT();
77     this.B = new MyGame.Example.TestT();
78     this.C = new MyGame.Example.AbilityT();
79   }
80 }
81 
82 
83 }
84