| 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 */ |
| 3 |
import * as flatbuffers from 'flatbuffers'; |
| 4 |
export class Stat { |
| 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 |
static getRootAsStat(bb, obj) { |
| 15 |
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 16 |
} |
| 17 |
static getSizePrefixedRootAsStat(bb, obj) { |
| 18 |
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 19 |
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 20 |
} |
| 21 |
id(optionalEncoding) { |
| 22 |
const offset = this.bb.__offset(this.bb_pos, 4); |
| 23 |
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 24 |
} |
| 25 |
val() { |
| 26 |
const offset = this.bb.__offset(this.bb_pos, 6); |
| 27 |
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0'); |
| 28 |
} |
| 29 |
mutate_val(value) { |
| 30 |
const offset = this.bb.__offset(this.bb_pos, 6); |
| 31 |
if (offset === 0) { |
| 32 |
return false; |
| 33 |
} |
| 34 |
this.bb.writeInt64(this.bb_pos + offset, value); |
| 35 |
return true; |
| 36 |
} |
| 37 |
count() { |
| 38 |
const offset = this.bb.__offset(this.bb_pos, 8); |
| 39 |
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0; |
| 40 |
} |
| 41 |
mutate_count(value) { |
| 42 |
const offset = this.bb.__offset(this.bb_pos, 8); |
| 43 |
if (offset === 0) { |
| 44 |
return false; |
| 45 |
} |
| 46 |
this.bb.writeUint16(this.bb_pos + offset, value); |
| 47 |
return true; |
| 48 |
} |
| 49 |
static getFullyQualifiedName() { |
| 50 |
return 'MyGame.Example.Stat'; |
| 51 |
} |
| 52 |
static startStat(builder) { |
| 53 |
builder.startObject(3); |
| 54 |
} |
| 55 |
static addId(builder, idOffset) { |
| 56 |
builder.addFieldOffset(0, idOffset, 0); |
| 57 |
} |
| 58 |
static addVal(builder, val) { |
| 59 |
builder.addFieldInt64(1, val, BigInt('0')); |
| 60 |
} |
| 61 |
static addCount(builder, count) { |
| 62 |
builder.addFieldInt16(2, count, 0); |
| 63 |
} |
| 64 |
static endStat(builder) { |
| 65 |
const offset = builder.endObject(); |
| 66 |
return offset; |
| 67 |
} |
| 68 |
static createStat(builder, idOffset, val, count) { |
| 69 |
Stat.startStat(builder); |
| 70 |
Stat.addId(builder, idOffset); |
| 71 |
Stat.addVal(builder, val); |
| 72 |
Stat.addCount(builder, count); |
| 73 |
return Stat.endStat(builder); |
| 74 |
} |
| 75 |
serialize() { |
| 76 |
return this.bb.bytes(); |
| 77 |
} |
| 78 |
static deserialize(buffer) { |
| 79 |
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer)); |
| 80 |
} |
| 81 |
unpack() { |
| 82 |
return new StatT(this.id(), this.val(), this.count()); |
| 83 |
} |
| 84 |
unpackTo(_o) { |
| 85 |
_o.id = this.id(); |
| 86 |
_o.val = this.val(); |
| 87 |
_o.count = this.count(); |
| 88 |
} |
| 89 |
} |
| 90 |
export class StatT { |
| 91 |
constructor(id = null, val = BigInt('0'), count = 0) { |
| 92 |
this.id = id; |
| 93 |
this.val = val; |
| 94 |
this.count = count; |
| 95 |
} |
| 96 |
pack(builder) { |
| 97 |
const id = (this.id !== null ? builder.createString(this.id) : 0); |
| 98 |
return Stat.createStat(builder, id, this.val, this.count); |
| 99 |
} |
| 100 |
} |