| 1 |
|
| 2 |
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js'; |
| 3 |
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js'; |
| 4 |
export class ArrayStruct { |
| 5 |
constructor() { |
| 6 |
this.bb = null; |
| 7 |
this.bb_pos = 0; |
| 8 |
} |
| 9 |
__init(i, bb) { |
| 10 |
this.bb_pos = i; |
| 11 |
this.bb = bb; |
| 12 |
return this; |
| 13 |
} |
| 14 |
aUnderscore() { |
| 15 |
return this.bb.readFloat32(this.bb_pos); |
| 16 |
} |
| 17 |
bUnderscore(index) { |
| 18 |
return this.bb.readInt32(this.bb_pos + 4 + index * 4); |
| 19 |
} |
| 20 |
c() { |
| 21 |
return this.bb.readInt8(this.bb_pos + 64); |
| 22 |
} |
| 23 |
d(index, obj) { |
| 24 |
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb); |
| 25 |
} |
| 26 |
e() { |
| 27 |
return this.bb.readInt32(this.bb_pos + 2216); |
| 28 |
} |
| 29 |
f(index, obj) { |
| 30 |
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb); |
| 31 |
} |
| 32 |
g(index) { |
| 33 |
return this.bb.readInt64(this.bb_pos + 2640 + index * 8); |
| 34 |
} |
| 35 |
static getFullyQualifiedName() { |
| 36 |
return 'MyGame.Example.ArrayStruct'; |
| 37 |
} |
| 38 |
static sizeOf() { |
| 39 |
return 2656; |
| 40 |
} |
| 41 |
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) { |
| 42 |
builder.prep(8, 2656); |
| 43 |
for (let i = 1; i >= 0; --i) { |
| 44 |
builder.writeInt64(BigInt(g?.[i] ?? 0)); |
| 45 |
} |
| 46 |
for (let i = 1; i >= 0; --i) { |
| 47 |
const item = f?.[i]; |
| 48 |
if (item instanceof OuterStructT) { |
| 49 |
item.pack(builder); |
| 50 |
continue; |
| 51 |
} |
| 52 |
OuterStruct.createOuterStruct(builder, item?.a, item?.b, (item?.cUnderscore?.a ?? 0), (item?.cUnderscore?.b ?? []), (item?.cUnderscore?.c ?? 0), (item?.cUnderscore?.dUnderscore ?? BigInt(0)), item?.d, (item?.e?.a ?? 0), (item?.e?.b ?? []), (item?.e?.c ?? 0), (item?.e?.dUnderscore ?? BigInt(0)), item?.f); |
| 53 |
} |
| 54 |
builder.pad(4); |
| 55 |
builder.writeInt32(e); |
| 56 |
for (let i = 1; i >= 0; --i) { |
| 57 |
const item = d?.[i]; |
| 58 |
if (item instanceof NestedStructT) { |
| 59 |
item.pack(builder); |
| 60 |
continue; |
| 61 |
} |
| 62 |
NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e); |
| 63 |
} |
| 64 |
builder.pad(7); |
| 65 |
builder.writeInt8(c); |
| 66 |
for (let i = 14; i >= 0; --i) { |
| 67 |
builder.writeInt32((b_underscore?.[i] ?? 0)); |
| 68 |
} |
| 69 |
builder.writeFloat32(a_underscore); |
| 70 |
return builder.offset(); |
| 71 |
} |
| 72 |
unpack() { |
| 73 |
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2)); |
| 74 |
} |
| 75 |
unpackTo(_o) { |
| 76 |
_o.aUnderscore = this.aUnderscore(); |
| 77 |
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15); |
| 78 |
_o.c = this.c(); |
| 79 |
_o.d = this.bb.createObjList(this.d.bind(this), 2); |
| 80 |
_o.e = this.e(); |
| 81 |
_o.f = this.bb.createObjList(this.f.bind(this), 2); |
| 82 |
_o.g = this.bb.createScalarList(this.g.bind(this), 2); |
| 83 |
} |
| 84 |
} |
| 85 |
export class ArrayStructT { |
| 86 |
constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) { |
| 87 |
this.aUnderscore = aUnderscore; |
| 88 |
this.bUnderscore = bUnderscore; |
| 89 |
this.c = c; |
| 90 |
this.d = d; |
| 91 |
this.e = e; |
| 92 |
this.f = f; |
| 93 |
this.g = g; |
| 94 |
} |
| 95 |
pack(builder) { |
| 96 |
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g); |
| 97 |
} |
| 98 |
} |