...
1// automatically generated by the FlatBuffers compiler, do not modify
2
3import * as flatbuffers from 'flatbuffers';
4
5import { Ability, AbilityT } from '../../my-game/example/ability.js';
6import { Test, TestT } from '../../my-game/example/test.js';
7
8
9export class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
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
18a(obj?:Ability):Ability|null {
19 return (obj || new Ability()).__init(this.bb_pos, this.bb!);
20}
21
22b(obj?:Test):Test|null {
23 return (obj || new Test()).__init(this.bb_pos + 8, this.bb!);
24}
25
26c(obj?:Ability):Ability|null {
27 return (obj || new Ability()).__init(this.bb_pos + 12, this.bb!);
28}
29
30static getFullyQualifiedName():string {
31 return 'MyGame.Example.StructOfStructs';
32}
33
34static sizeOf():number {
35 return 20;
36}
37
38static 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
54unpack(): 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
63unpackTo(_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
70export class StructOfStructsT implements flatbuffers.IGeneratedObject {
71constructor(
72 public a: AbilityT|null = null,
73 public b: TestT|null = null,
74 public c: AbilityT|null = null
75){}
76
77
78pack(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}
View as plain text