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::FlatBuffers; 10 11 public struct Referrable : IFlatbufferObject 12 { 13 private Table __p; 14 public ByteBuffer ByteBuffer { get { return __p.bb; } } GetRootAsReferrableMyGame.Example.Referrable15 public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); } GetRootAsReferrableMyGame.Example.Referrable16 public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } __initMyGame.Example.Referrable17 public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } __assignMyGame.Example.Referrable18 public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 19 20 public ulong Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } } MutateIdMyGame.Example.Referrable21 public bool MutateId(ulong id) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, id); return true; } else { return false; } } 22 CreateReferrableMyGame.Example.Referrable23 public static Offset<Referrable> CreateReferrable(FlatBufferBuilder builder, 24 ulong id = 0) { 25 builder.StartObject(1); 26 Referrable.AddId(builder, id); 27 return Referrable.EndReferrable(builder); 28 } 29 StartReferrableMyGame.Example.Referrable30 public static void StartReferrable(FlatBufferBuilder builder) { builder.StartObject(1); } AddIdMyGame.Example.Referrable31 public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); } EndReferrableMyGame.Example.Referrable32 public static Offset<Referrable> EndReferrable(FlatBufferBuilder builder) { 33 int o = builder.EndObject(); 34 return new Offset<Referrable>(o); 35 } 36 CreateSortedVectorOfReferrableMyGame.Example.Referrable37 public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset<Referrable>[] offsets) { 38 Array.Sort(offsets, (Offset<Referrable> o1, Offset<Referrable> o2) => builder.DataBuffer.GetUlong(Table.__offset(4, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUlong(Table.__offset(4, o2.Value, builder.DataBuffer)))); 39 return builder.CreateVectorOfTables(offsets); 40 } 41 __lookup_by_keyMyGame.Example.Referrable42 public static Referrable? __lookup_by_key(int vectorLocation, ulong key, ByteBuffer bb) { 43 int span = bb.GetInt(vectorLocation - 4); 44 int start = 0; 45 while (span != 0) { 46 int middle = span / 2; 47 int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb); 48 int comp = bb.GetUlong(Table.__offset(4, bb.Length - tableOffset, bb)).CompareTo(key); 49 if (comp > 0) { 50 span = middle; 51 } else if (comp < 0) { 52 middle++; 53 start += middle; 54 span -= middle; 55 } else { 56 return new Referrable().__assign(tableOffset, bb); 57 } 58 } 59 return null; 60 } 61 }; 62 63 64 } 65