blob: 43b569f4e36d005ec376c86a65ded9d35e449b24 [file] [log] [blame]
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Stat {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsStat(bb, obj) {
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsStat(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
val() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_val(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
count() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_count(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame_Example_Stat';
}
static startStat(builder) {
builder.startObject(3);
}
static addId(builder, idOffset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder, val) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder, count) {
builder.addFieldInt16(2, count, 0);
}
static endStat(builder) {
const offset = builder.endObject();
return offset;
}
static createStat(builder, idOffset, val, count) {
Stat.startStat(builder);
Stat.addId(builder, idOffset);
Stat.addVal(builder, val);
Stat.addCount(builder, count);
return Stat.endStat(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new StatT(this.id(), this.val(), this.count());
}
unpackTo(_o) {
_o.id = this.id();
_o.val = this.val();
_o.count = this.count();
}
}
export class StatT {
constructor(id = null, val = BigInt('0'), count = 0) {
this.id = id;
this.val = val;
this.count = count;
}
pack(builder) {
const id = (this.id !== null ? builder.createString(this.id) : 0);
return Stat.createStat(builder, id, this.val, this.count);
}
}