1// automatically generated by the FlatBuffers compiler, do not modify 2 3/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ 4 5import * as flatbuffers from 'flatbuffers'; 6 7 8 9export class Stat implements flatbuffers.IUnpackableObject<StatT> { 10 bb: flatbuffers.ByteBuffer|null = null; 11 bb_pos = 0; 12 __init(i:number, bb:flatbuffers.ByteBuffer):Stat { 13 this.bb_pos = i; 14 this.bb = bb; 15 return this; 16} 17 18static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat { 19 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 20} 21 22static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat { 23 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 24 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 25} 26 27id():string|null 28id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 29id(optionalEncoding?:any):string|Uint8Array|null { 30 const offset = this.bb!.__offset(this.bb_pos, 4); 31 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 32} 33 34val():bigint { 35 const offset = this.bb!.__offset(this.bb_pos, 6); 36 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 37} 38 39mutate_val(value:bigint):boolean { 40 const offset = this.bb!.__offset(this.bb_pos, 6); 41 42 if (offset === 0) { 43 return false; 44 } 45 46 this.bb!.writeInt64(this.bb_pos + offset, value); 47 return true; 48} 49 50count():number { 51 const offset = this.bb!.__offset(this.bb_pos, 8); 52 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 53} 54 55mutate_count(value:number):boolean { 56 const offset = this.bb!.__offset(this.bb_pos, 8); 57 58 if (offset === 0) { 59 return false; 60 } 61 62 this.bb!.writeUint16(this.bb_pos + offset, value); 63 return true; 64} 65 66static getFullyQualifiedName():string { 67 return 'MyGame.Example.Stat'; 68} 69 70static startStat(builder:flatbuffers.Builder) { 71 builder.startObject(3); 72} 73 74static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { 75 builder.addFieldOffset(0, idOffset, 0); 76} 77 78static addVal(builder:flatbuffers.Builder, val:bigint) { 79 builder.addFieldInt64(1, val, BigInt('0')); 80} 81 82static addCount(builder:flatbuffers.Builder, count:number) { 83 builder.addFieldInt16(2, count, 0); 84} 85 86static endStat(builder:flatbuffers.Builder):flatbuffers.Offset { 87 const offset = builder.endObject(); 88 return offset; 89} 90 91static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset { 92 Stat.startStat(builder); 93 Stat.addId(builder, idOffset); 94 Stat.addVal(builder, val); 95 Stat.addCount(builder, count); 96 return Stat.endStat(builder); 97} 98 99serialize():Uint8Array { 100 return this.bb!.bytes(); 101} 102 103static deserialize(buffer: Uint8Array):Stat { 104 return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer)) 105} 106 107unpack(): StatT { 108 return new StatT( 109 this.id(), 110 this.val(), 111 this.count() 112 ); 113} 114 115 116unpackTo(_o: StatT): void { 117 _o.id = this.id(); 118 _o.val = this.val(); 119 _o.count = this.count(); 120} 121} 122 123export class StatT implements flatbuffers.IGeneratedObject { 124constructor( 125 public id: string|Uint8Array|null = null, 126 public val: bigint = BigInt('0'), 127 public count: number = 0 128){} 129 130 131pack(builder:flatbuffers.Builder): flatbuffers.Offset { 132 const id = (this.id !== null ? builder.createString(this.id!) : 0); 133 134 return Stat.createStat(builder, 135 id, 136 this.val, 137 this.count 138 ); 139} 140} 141