1*890232f2SAndroid Build Coastguard Worker// automatically generated by the FlatBuffers compiler, do not modify 2*890232f2SAndroid Build Coastguard Worker 3*890232f2SAndroid Build Coastguard Workerimport * as flatbuffers from 'flatbuffers'; 4*890232f2SAndroid Build Coastguard Worker 5*890232f2SAndroid Build Coastguard Workerimport { Color } from '../../my-game/example/color'; 6*890232f2SAndroid Build Coastguard Worker 7*890232f2SAndroid Build Coastguard Worker 8*890232f2SAndroid Build Coastguard Workerexport class TestSimpleTableWithEnum { 9*890232f2SAndroid Build Coastguard Worker bb: flatbuffers.ByteBuffer|null = null; 10*890232f2SAndroid Build Coastguard Worker bb_pos = 0; 11*890232f2SAndroid Build Coastguard Worker __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum { 12*890232f2SAndroid Build Coastguard Worker this.bb_pos = i; 13*890232f2SAndroid Build Coastguard Worker this.bb = bb; 14*890232f2SAndroid Build Coastguard Worker return this; 15*890232f2SAndroid Build Coastguard Worker} 16*890232f2SAndroid Build Coastguard Worker 17*890232f2SAndroid Build Coastguard Workerstatic getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum { 18*890232f2SAndroid Build Coastguard Worker return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 19*890232f2SAndroid Build Coastguard Worker} 20*890232f2SAndroid Build Coastguard Worker 21*890232f2SAndroid Build Coastguard Workerstatic getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum { 22*890232f2SAndroid Build Coastguard Worker bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 23*890232f2SAndroid Build Coastguard Worker return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 24*890232f2SAndroid Build Coastguard Worker} 25*890232f2SAndroid Build Coastguard Worker 26*890232f2SAndroid Build Coastguard Workercolor():Color { 27*890232f2SAndroid Build Coastguard Worker const offset = this.bb!.__offset(this.bb_pos, 4); 28*890232f2SAndroid Build Coastguard Worker return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Green; 29*890232f2SAndroid Build Coastguard Worker} 30*890232f2SAndroid Build Coastguard Worker 31*890232f2SAndroid Build Coastguard Workermutate_color(value:Color):boolean { 32*890232f2SAndroid Build Coastguard Worker const offset = this.bb!.__offset(this.bb_pos, 4); 33*890232f2SAndroid Build Coastguard Worker 34*890232f2SAndroid Build Coastguard Worker if (offset === 0) { 35*890232f2SAndroid Build Coastguard Worker return false; 36*890232f2SAndroid Build Coastguard Worker } 37*890232f2SAndroid Build Coastguard Worker 38*890232f2SAndroid Build Coastguard Worker this.bb!.writeUint8(this.bb_pos + offset, value); 39*890232f2SAndroid Build Coastguard Worker return true; 40*890232f2SAndroid Build Coastguard Worker} 41*890232f2SAndroid Build Coastguard Worker 42*890232f2SAndroid Build Coastguard Workerstatic getFullyQualifiedName():string { 43*890232f2SAndroid Build Coastguard Worker return 'MyGame_Example_TestSimpleTableWithEnum'; 44*890232f2SAndroid Build Coastguard Worker} 45*890232f2SAndroid Build Coastguard Worker 46*890232f2SAndroid Build Coastguard Workerstatic startTestSimpleTableWithEnum(builder:flatbuffers.Builder) { 47*890232f2SAndroid Build Coastguard Worker builder.startObject(1); 48*890232f2SAndroid Build Coastguard Worker} 49*890232f2SAndroid Build Coastguard Worker 50*890232f2SAndroid Build Coastguard Workerstatic addColor(builder:flatbuffers.Builder, color:Color) { 51*890232f2SAndroid Build Coastguard Worker builder.addFieldInt8(0, color, Color.Green); 52*890232f2SAndroid Build Coastguard Worker} 53*890232f2SAndroid Build Coastguard Worker 54*890232f2SAndroid Build Coastguard Workerstatic endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset { 55*890232f2SAndroid Build Coastguard Worker const offset = builder.endObject(); 56*890232f2SAndroid Build Coastguard Worker return offset; 57*890232f2SAndroid Build Coastguard Worker} 58*890232f2SAndroid Build Coastguard Worker 59*890232f2SAndroid Build Coastguard Workerstatic createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:Color):flatbuffers.Offset { 60*890232f2SAndroid Build Coastguard Worker TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder); 61*890232f2SAndroid Build Coastguard Worker TestSimpleTableWithEnum.addColor(builder, color); 62*890232f2SAndroid Build Coastguard Worker return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); 63*890232f2SAndroid Build Coastguard Worker} 64*890232f2SAndroid Build Coastguard Worker 65*890232f2SAndroid Build Coastguard Workerserialize():Uint8Array { 66*890232f2SAndroid Build Coastguard Worker return this.bb!.bytes(); 67*890232f2SAndroid Build Coastguard Worker} 68*890232f2SAndroid Build Coastguard Worker 69*890232f2SAndroid Build Coastguard Workerstatic deserialize(buffer: Uint8Array):TestSimpleTableWithEnum { 70*890232f2SAndroid Build Coastguard Worker return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer)) 71*890232f2SAndroid Build Coastguard Worker} 72*890232f2SAndroid Build Coastguard Worker 73*890232f2SAndroid Build Coastguard Workerunpack(): TestSimpleTableWithEnumT { 74*890232f2SAndroid Build Coastguard Worker return new TestSimpleTableWithEnumT( 75*890232f2SAndroid Build Coastguard Worker this.color() 76*890232f2SAndroid Build Coastguard Worker ); 77*890232f2SAndroid Build Coastguard Worker} 78*890232f2SAndroid Build Coastguard Worker 79*890232f2SAndroid Build Coastguard Worker 80*890232f2SAndroid Build Coastguard WorkerunpackTo(_o: TestSimpleTableWithEnumT): void { 81*890232f2SAndroid Build Coastguard Worker _o.color = this.color(); 82*890232f2SAndroid Build Coastguard Worker} 83*890232f2SAndroid Build Coastguard Worker} 84*890232f2SAndroid Build Coastguard Worker 85*890232f2SAndroid Build Coastguard Workerexport class TestSimpleTableWithEnumT { 86*890232f2SAndroid Build Coastguard Workerconstructor( 87*890232f2SAndroid Build Coastguard Worker public color: Color = Color.Green 88*890232f2SAndroid Build Coastguard Worker){} 89*890232f2SAndroid Build Coastguard Worker 90*890232f2SAndroid Build Coastguard Worker 91*890232f2SAndroid Build Coastguard Workerpack(builder:flatbuffers.Builder): flatbuffers.Offset { 92*890232f2SAndroid Build Coastguard Worker return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, 93*890232f2SAndroid Build Coastguard Worker this.color 94*890232f2SAndroid Build Coastguard Worker ); 95*890232f2SAndroid Build Coastguard Worker} 96*890232f2SAndroid Build Coastguard Worker} 97