• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3import * as flatbuffers from 'flatbuffers';
4import { Color } from '../../my-game/example/color.js';
5export class TestSimpleTableWithEnum {
6    constructor() {
7        this.bb = null;
8        this.bb_pos = 0;
9    }
10    __init(i, bb) {
11        this.bb_pos = i;
12        this.bb = bb;
13        return this;
14    }
15    static getRootAsTestSimpleTableWithEnum(bb, obj) {
16        return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
17    }
18    static getSizePrefixedRootAsTestSimpleTableWithEnum(bb, obj) {
19        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20        return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21    }
22    color() {
23        const offset = this.bb.__offset(this.bb_pos, 4);
24        return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Green;
25    }
26    mutate_color(value) {
27        const offset = this.bb.__offset(this.bb_pos, 4);
28        if (offset === 0) {
29            return false;
30        }
31        this.bb.writeUint8(this.bb_pos + offset, value);
32        return true;
33    }
34    static getFullyQualifiedName() {
35        return 'MyGame.Example.TestSimpleTableWithEnum';
36    }
37    static startTestSimpleTableWithEnum(builder) {
38        builder.startObject(1);
39    }
40    static addColor(builder, color) {
41        builder.addFieldInt8(0, color, Color.Green);
42    }
43    static endTestSimpleTableWithEnum(builder) {
44        const offset = builder.endObject();
45        return offset;
46    }
47    static createTestSimpleTableWithEnum(builder, color) {
48        TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
49        TestSimpleTableWithEnum.addColor(builder, color);
50        return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
51    }
52    serialize() {
53        return this.bb.bytes();
54    }
55    static deserialize(buffer) {
56        return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer));
57    }
58    unpack() {
59        return new TestSimpleTableWithEnumT(this.color());
60    }
61    unpackTo(_o) {
62        _o.color = this.color();
63    }
64}
65export class TestSimpleTableWithEnumT {
66    constructor(color = Color.Green) {
67        this.color = color;
68    }
69    pack(builder) {
70        return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, this.color);
71    }
72}
73