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 Referrable : IFlatbufferObject
13 {
14   private Table __p;
15   public ByteBuffer ByteBuffer { get { return __p.bb; } }
ValidateVersionMyGame.Example.Referrable16   public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_1_12_0(); }
GetRootAsReferrableMyGame.Example.Referrable17   public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); }
GetRootAsReferrableMyGame.Example.Referrable18   public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
__initMyGame.Example.Referrable19   public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
__assignMyGame.Example.Referrable20   public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
21 
22   public ulong Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } }
MutateIdMyGame.Example.Referrable23   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; } }
24 
CreateReferrableMyGame.Example.Referrable25   public static Offset<MyGame.Example.Referrable> CreateReferrable(FlatBufferBuilder builder,
26       ulong id = 0) {
27     builder.StartTable(1);
28     Referrable.AddId(builder, id);
29     return Referrable.EndReferrable(builder);
30   }
31 
StartReferrableMyGame.Example.Referrable32   public static void StartReferrable(FlatBufferBuilder builder) { builder.StartTable(1); }
AddIdMyGame.Example.Referrable33   public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); }
EndReferrableMyGame.Example.Referrable34   public static Offset<MyGame.Example.Referrable> EndReferrable(FlatBufferBuilder builder) {
35     int o = builder.EndTable();
36     return new Offset<MyGame.Example.Referrable>(o);
37   }
38 
CreateSortedVectorOfReferrableMyGame.Example.Referrable39   public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset<Referrable>[] offsets) {
40     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))));
41     return builder.CreateVectorOfTables(offsets);
42   }
43 
__lookup_by_keyMyGame.Example.Referrable44   public static Referrable? __lookup_by_key(int vectorLocation, ulong key, ByteBuffer bb) {
45     int span = bb.GetInt(vectorLocation - 4);
46     int start = 0;
47     while (span != 0) {
48       int middle = span / 2;
49       int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
50       int comp = bb.GetUlong(Table.__offset(4, bb.Length - tableOffset, bb)).CompareTo(key);
51       if (comp > 0) {
52         span = middle;
53       } else if (comp < 0) {
54         middle++;
55         start += middle;
56         span -= middle;
57       } else {
58         return new Referrable().__assign(tableOffset, bb);
59       }
60     }
61     return null;
62   }
UnPackMyGame.Example.Referrable63   public ReferrableT UnPack() {
64     var _o = new ReferrableT();
65     this.UnPackTo(_o);
66     return _o;
67   }
UnPackToMyGame.Example.Referrable68   public void UnPackTo(ReferrableT _o) {
69     _o.Id = this.Id;
70   }
PackMyGame.Example.Referrable71   public static Offset<MyGame.Example.Referrable> Pack(FlatBufferBuilder builder, ReferrableT _o) {
72     if (_o == null) return default(Offset<MyGame.Example.Referrable>);
73     return CreateReferrable(
74       builder,
75       _o.Id);
76   }
77 };
78 
79 public class ReferrableT
80 {
81   [Newtonsoft.Json.JsonProperty("id")]
82   [Newtonsoft.Json.JsonIgnore()]
83   public ulong Id { get; set; }
84 
ReferrableT()85   public ReferrableT() {
86     this.Id = 0;
87   }
88 }
89 
90 
91 }
92