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 Stat : IFlatbufferObject 13 { 14 private Table __p; 15 public ByteBuffer ByteBuffer { get { return __p.bb; } } ValidateVersionMyGame.Example.Stat16 public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); } GetRootAsStatMyGame.Example.Stat17 public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); } GetRootAsStatMyGame.Example.Stat18 public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } __initMyGame.Example.Stat19 public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); } __assignMyGame.Example.Stat20 public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } 21 22 public string Id { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } 23 #if ENABLE_SPAN_T GetIdBytesMyGame.Example.Stat24 public Span<byte> GetIdBytes() { return __p.__vector_as_span<byte>(4, 1); } 25 #else GetIdBytesMyGame.Example.Stat26 public ArraySegment<byte>? GetIdBytes() { return __p.__vector_as_arraysegment(4); } 27 #endif GetIdArrayMyGame.Example.Stat28 public byte[] GetIdArray() { return __p.__vector_as_array<byte>(4); } 29 public long Val { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } } MutateValMyGame.Example.Stat30 public bool MutateVal(long val) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, val); return true; } else { return false; } } 31 public ushort Count { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } } MutateCountMyGame.Example.Stat32 public bool MutateCount(ushort count) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, count); return true; } else { return false; } } 33 CreateStatMyGame.Example.Stat34 public static Offset<MyGame.Example.Stat> CreateStat(FlatBufferBuilder builder, 35 StringOffset idOffset = default(StringOffset), 36 long val = 0, 37 ushort count = 0) { 38 builder.StartTable(3); 39 Stat.AddVal(builder, val); 40 Stat.AddId(builder, idOffset); 41 Stat.AddCount(builder, count); 42 return Stat.EndStat(builder); 43 } 44 StartStatMyGame.Example.Stat45 public static void StartStat(FlatBufferBuilder builder) { builder.StartTable(3); } AddIdMyGame.Example.Stat46 public static void AddId(FlatBufferBuilder builder, StringOffset idOffset) { builder.AddOffset(0, idOffset.Value, 0); } AddValMyGame.Example.Stat47 public static void AddVal(FlatBufferBuilder builder, long val) { builder.AddLong(1, val, 0); } AddCountMyGame.Example.Stat48 public static void AddCount(FlatBufferBuilder builder, ushort count) { builder.AddUshort(2, count, 0); } EndStatMyGame.Example.Stat49 public static Offset<MyGame.Example.Stat> EndStat(FlatBufferBuilder builder) { 50 int o = builder.EndTable(); 51 return new Offset<MyGame.Example.Stat>(o); 52 } 53 CreateSortedVectorOfStatMyGame.Example.Stat54 public static VectorOffset CreateSortedVectorOfStat(FlatBufferBuilder builder, Offset<Stat>[] offsets) { 55 Array.Sort(offsets, (Offset<Stat> o1, Offset<Stat> o2) => builder.DataBuffer.GetUshort(Table.__offset(8, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUshort(Table.__offset(8, o2.Value, builder.DataBuffer)))); 56 return builder.CreateVectorOfTables(offsets); 57 } 58 __lookup_by_keyMyGame.Example.Stat59 public static Stat? __lookup_by_key(int vectorLocation, ushort key, ByteBuffer bb) { 60 int span = bb.GetInt(vectorLocation - 4); 61 int start = 0; 62 while (span != 0) { 63 int middle = span / 2; 64 int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb); 65 int comp = bb.GetUshort(Table.__offset(8, bb.Length - tableOffset, bb)).CompareTo(key); 66 if (comp > 0) { 67 span = middle; 68 } else if (comp < 0) { 69 middle++; 70 start += middle; 71 span -= middle; 72 } else { 73 return new Stat().__assign(tableOffset, bb); 74 } 75 } 76 return null; 77 } UnPackMyGame.Example.Stat78 public StatT UnPack() { 79 var _o = new StatT(); 80 this.UnPackTo(_o); 81 return _o; 82 } UnPackToMyGame.Example.Stat83 public void UnPackTo(StatT _o) { 84 _o.Id = this.Id; 85 _o.Val = this.Val; 86 _o.Count = this.Count; 87 } PackMyGame.Example.Stat88 public static Offset<MyGame.Example.Stat> Pack(FlatBufferBuilder builder, StatT _o) { 89 if (_o == null) return default(Offset<MyGame.Example.Stat>); 90 var _id = _o.Id == null ? default(StringOffset) : builder.CreateString(_o.Id); 91 return CreateStat( 92 builder, 93 _id, 94 _o.Val, 95 _o.Count); 96 } 97 }; 98 99 public class StatT 100 { 101 [Newtonsoft.Json.JsonProperty("id")] 102 public string Id { get; set; } 103 [Newtonsoft.Json.JsonProperty("val")] 104 public long Val { get; set; } 105 [Newtonsoft.Json.JsonProperty("count")] 106 public ushort Count { get; set; } 107 StatT()108 public StatT() { 109 this.Id = null; 110 this.Val = 0; 111 this.Count = 0; 112 } 113 } 114 115 116 } 117