Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | import * as flatbuffers from 'flatbuffers'; |
| 4 | |
| 5 | import { Ability, AbilityT } from '../../my-game/example/ability.js'; |
| 6 | import { Test, TestT } from '../../my-game/example/test.js'; |
| 7 | |
| 8 | |
| 9 | export class StructOfStructs { |
| 10 | bb: flatbuffers.ByteBuffer|null = null; |
| 11 | bb_pos = 0; |
| 12 | __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs { |
| 13 | this.bb_pos = i; |
| 14 | this.bb = bb; |
| 15 | return this; |
| 16 | } |
| 17 | |
| 18 | a(obj?:Ability):Ability|null { |
| 19 | return (obj || new Ability()).__init(this.bb_pos, this.bb!); |
| 20 | } |
| 21 | |
| 22 | b(obj?:Test):Test|null { |
| 23 | return (obj || new Test()).__init(this.bb_pos + 8, this.bb!); |
| 24 | } |
| 25 | |
| 26 | c(obj?:Ability):Ability|null { |
| 27 | return (obj || new Ability()).__init(this.bb_pos + 12, this.bb!); |
| 28 | } |
| 29 | |
| 30 | static getFullyQualifiedName():string { |
| 31 | return 'MyGame_Example_StructOfStructs'; |
| 32 | } |
| 33 | |
| 34 | static sizeOf():number { |
| 35 | return 20; |
| 36 | } |
| 37 | |
| 38 | static createStructOfStructs(builder:flatbuffers.Builder, a_id: number, a_distance: number, b_a: number, b_b: number, c_id: number, c_distance: number):flatbuffers.Offset { |
| 39 | builder.prep(4, 20); |
| 40 | builder.prep(4, 8); |
| 41 | builder.writeInt32(c_distance); |
| 42 | builder.writeInt32(c_id); |
| 43 | builder.prep(2, 4); |
| 44 | builder.pad(1); |
| 45 | builder.writeInt8(b_b); |
| 46 | builder.writeInt16(b_a); |
| 47 | builder.prep(4, 8); |
| 48 | builder.writeInt32(a_distance); |
| 49 | builder.writeInt32(a_id); |
| 50 | return builder.offset(); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | unpack(): StructOfStructsT { |
| 55 | return new StructOfStructsT( |
| 56 | (this.a() !== null ? this.a()!.unpack() : null), |
| 57 | (this.b() !== null ? this.b()!.unpack() : null), |
| 58 | (this.c() !== null ? this.c()!.unpack() : null) |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | |
| 63 | unpackTo(_o: StructOfStructsT): void { |
| 64 | _o.a = (this.a() !== null ? this.a()!.unpack() : null); |
| 65 | _o.b = (this.b() !== null ? this.b()!.unpack() : null); |
| 66 | _o.c = (this.c() !== null ? this.c()!.unpack() : null); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | export class StructOfStructsT { |
| 71 | constructor( |
| 72 | public a: AbilityT|null = null, |
| 73 | public b: TestT|null = null, |
| 74 | public c: AbilityT|null = null |
| 75 | ){} |
| 76 | |
| 77 | |
| 78 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 79 | return StructOfStructs.createStructOfStructs(builder, |
| 80 | (this.a?.id ?? 0), |
| 81 | (this.a?.distance ?? 0), |
| 82 | (this.b?.a ?? 0), |
| 83 | (this.b?.b ?? 0), |
| 84 | (this.c?.id ?? 0), |
| 85 | (this.c?.distance ?? 0) |
| 86 | ); |
| 87 | } |
| 88 | } |