1// automatically generated by the FlatBuffers compiler, do not modify 2 3import * as flatbuffers from 'flatbuffers'; 4 5export enum MyGame_OtherNameSpace_FromInclude { 6 IncludeVal = '0' 7} 8 9/** 10 * Composite components of Monster color. 11 */ 12export enum MyGame_Example_Color { 13 Red = 1, 14 15 /** 16 * \brief color Green 17 * Green is bit_flag with value (1u << 1) 18 */ 19 Green = 2, 20 21 /** 22 * \brief color Blue (1u << 3) 23 */ 24 Blue = 8 25} 26 27export enum MyGame_Example_Race { 28 None = -1, 29 Human = 0, 30 Dwarf = 1, 31 Elf = 2 32} 33 34export enum MyGame_Example_LongEnum { 35 LongOne = '2', 36 LongTwo = '4', 37 LongBig = '1099511627776' 38} 39 40export enum MyGame_Example_Any { 41 NONE = 0, 42 Monster = 1, 43 TestSimpleTableWithEnum = 2, 44 MyGame_Example2_Monster = 3 45} 46 47export function unionToAny( 48 type: MyGame_Example_Any, 49 accessor: (obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null 50): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null { 51 switch(MyGame_Example_Any[type]) { 52 case 'NONE': return null; 53 case 'Monster': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster; 54 case 'TestSimpleTableWithEnum': return accessor(new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum; 55 case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster; 56 default: return null; 57 } 58} 59 60export function unionListToAny( 61 type: MyGame_Example_Any, 62 accessor: (index: number, obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null, 63 index: number 64): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null { 65 switch(MyGame_Example_Any[type]) { 66 case 'NONE': return null; 67 case 'Monster': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster; 68 case 'TestSimpleTableWithEnum': return accessor(index, new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum; 69 case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster; 70 default: return null; 71 } 72} 73 74export enum MyGame_Example_AnyUniqueAliases { 75 NONE = 0, 76 M = 1, 77 TS = 2, 78 M2 = 3 79} 80 81export function unionToAnyUniqueAliases( 82 type: MyGame_Example_AnyUniqueAliases, 83 accessor: (obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null 84): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null { 85 switch(MyGame_Example_AnyUniqueAliases[type]) { 86 case 'NONE': return null; 87 case 'M': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster; 88 case 'TS': return accessor(new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum; 89 case 'M2': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster; 90 default: return null; 91 } 92} 93 94export function unionListToAnyUniqueAliases( 95 type: MyGame_Example_AnyUniqueAliases, 96 accessor: (index: number, obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null, 97 index: number 98): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null { 99 switch(MyGame_Example_AnyUniqueAliases[type]) { 100 case 'NONE': return null; 101 case 'M': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster; 102 case 'TS': return accessor(index, new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum; 103 case 'M2': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster; 104 default: return null; 105 } 106} 107 108export enum MyGame_Example_AnyAmbiguousAliases { 109 NONE = 0, 110 M1 = 1, 111 M2 = 2, 112 M3 = 3 113} 114 115export function unionToAnyAmbiguousAliases( 116 type: MyGame_Example_AnyAmbiguousAliases, 117 accessor: (obj:MyGame_Example_Monster) => MyGame_Example_Monster|null 118): MyGame_Example_Monster|null { 119 switch(MyGame_Example_AnyAmbiguousAliases[type]) { 120 case 'NONE': return null; 121 case 'M1': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster; 122 case 'M2': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster; 123 case 'M3': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster; 124 default: return null; 125 } 126} 127 128export function unionListToAnyAmbiguousAliases( 129 type: MyGame_Example_AnyAmbiguousAliases, 130 accessor: (index: number, obj:MyGame_Example_Monster) => MyGame_Example_Monster|null, 131 index: number 132): MyGame_Example_Monster|null { 133 switch(MyGame_Example_AnyAmbiguousAliases[type]) { 134 case 'NONE': return null; 135 case 'M1': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster; 136 case 'M2': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster; 137 case 'M3': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster; 138 default: return null; 139 } 140} 141 142export class MyGame_OtherNameSpace_Unused { 143 bb: flatbuffers.ByteBuffer|null = null; 144 bb_pos = 0; 145 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_OtherNameSpace_Unused { 146 this.bb_pos = i; 147 this.bb = bb; 148 return this; 149} 150 151a():number { 152 return this.bb!.readInt32(this.bb_pos); 153} 154 155static sizeOf():number { 156 return 4; 157} 158 159static createUnused(builder:flatbuffers.Builder, a: number):flatbuffers.Offset { 160 builder.prep(4, 4); 161 builder.writeInt32(a); 162 return builder.offset(); 163} 164 165} 166 167export class MyGame_OtherNameSpace_TableB { 168 bb: flatbuffers.ByteBuffer|null = null; 169 bb_pos = 0; 170 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_OtherNameSpace_TableB { 171 this.bb_pos = i; 172 this.bb = bb; 173 return this; 174} 175 176static getRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB { 177 return (obj || new MyGame_OtherNameSpace_TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 178} 179 180static getSizePrefixedRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB { 181 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 182 return (obj || new MyGame_OtherNameSpace_TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 183} 184 185a(obj?:TableA):TableA|null { 186 const offset = this.bb!.__offset(this.bb_pos, 4); 187 return offset ? (obj || new TableA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 188} 189 190static startTableB(builder:flatbuffers.Builder) { 191 builder.startObject(1); 192} 193 194static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) { 195 builder.addFieldOffset(0, aOffset, 0); 196} 197 198static endTableB(builder:flatbuffers.Builder):flatbuffers.Offset { 199 const offset = builder.endObject(); 200 return offset; 201} 202 203static createTableB(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):flatbuffers.Offset { 204 MyGame_OtherNameSpace_TableB.startTableB(builder); 205 MyGame_OtherNameSpace_TableB.addA(builder, aOffset); 206 return MyGame_OtherNameSpace_TableB.endTableB(builder); 207} 208 209serialize():Uint8Array { 210 return this.bb!.bytes(); 211} 212 213static deserialize(buffer: Uint8Array):TableB { 214 return MyGame_OtherNameSpace_TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer)) 215} 216} 217 218export class TableA { 219 bb: flatbuffers.ByteBuffer|null = null; 220 bb_pos = 0; 221 __init(i:number, bb:flatbuffers.ByteBuffer):TableA { 222 this.bb_pos = i; 223 this.bb = bb; 224 return this; 225} 226 227static getRootAsTableA(bb:flatbuffers.ByteBuffer, obj?:TableA):TableA { 228 return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 229} 230 231static getSizePrefixedRootAsTableA(bb:flatbuffers.ByteBuffer, obj?:TableA):TableA { 232 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 233 return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 234} 235 236b(obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB|null { 237 const offset = this.bb!.__offset(this.bb_pos, 4); 238 return offset ? (obj || new MyGame_OtherNameSpace_TableB()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 239} 240 241static startTableA(builder:flatbuffers.Builder) { 242 builder.startObject(1); 243} 244 245static addB(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset) { 246 builder.addFieldOffset(0, bOffset, 0); 247} 248 249static endTableA(builder:flatbuffers.Builder):flatbuffers.Offset { 250 const offset = builder.endObject(); 251 return offset; 252} 253 254static createTableA(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset):flatbuffers.Offset { 255 TableA.startTableA(builder); 256 TableA.addB(builder, bOffset); 257 return TableA.endTableA(builder); 258} 259 260serialize():Uint8Array { 261 return this.bb!.bytes(); 262} 263 264static deserialize(buffer: Uint8Array):TableA { 265 return TableA.getRootAsTableA(new flatbuffers.ByteBuffer(buffer)) 266} 267} 268 269export class MyGame_InParentNamespace { 270 bb: flatbuffers.ByteBuffer|null = null; 271 bb_pos = 0; 272 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_InParentNamespace { 273 this.bb_pos = i; 274 this.bb = bb; 275 return this; 276} 277 278static getRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:MyGame_InParentNamespace):MyGame_InParentNamespace { 279 return (obj || new MyGame_InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 280} 281 282static getSizePrefixedRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:MyGame_InParentNamespace):MyGame_InParentNamespace { 283 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 284 return (obj || new MyGame_InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 285} 286 287static startInParentNamespace(builder:flatbuffers.Builder) { 288 builder.startObject(0); 289} 290 291static endInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset { 292 const offset = builder.endObject(); 293 return offset; 294} 295 296static createInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset { 297 MyGame_InParentNamespace.startInParentNamespace(builder); 298 return MyGame_InParentNamespace.endInParentNamespace(builder); 299} 300 301serialize():Uint8Array { 302 return this.bb!.bytes(); 303} 304 305static deserialize(buffer: Uint8Array):InParentNamespace { 306 return MyGame_InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer)) 307} 308} 309 310export class MyGame_Example2_Monster { 311 bb: flatbuffers.ByteBuffer|null = null; 312 bb_pos = 0; 313 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example2_Monster { 314 this.bb_pos = i; 315 this.bb = bb; 316 return this; 317} 318 319static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example2_Monster):MyGame_Example2_Monster { 320 return (obj || new MyGame_Example2_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 321} 322 323static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example2_Monster):MyGame_Example2_Monster { 324 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 325 return (obj || new MyGame_Example2_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 326} 327 328static startMonster(builder:flatbuffers.Builder) { 329 builder.startObject(0); 330} 331 332static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset { 333 const offset = builder.endObject(); 334 return offset; 335} 336 337static createMonster(builder:flatbuffers.Builder):flatbuffers.Offset { 338 MyGame_Example2_Monster.startMonster(builder); 339 return MyGame_Example2_Monster.endMonster(builder); 340} 341 342serialize():Uint8Array { 343 return this.bb!.bytes(); 344} 345 346static deserialize(buffer: Uint8Array):Monster { 347 return MyGame_Example2_Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer)) 348} 349} 350 351export class MyGame_Example_Test { 352 bb: flatbuffers.ByteBuffer|null = null; 353 bb_pos = 0; 354 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Test { 355 this.bb_pos = i; 356 this.bb = bb; 357 return this; 358} 359 360a():number { 361 return this.bb!.readInt16(this.bb_pos); 362} 363 364b():number { 365 return this.bb!.readInt8(this.bb_pos + 2); 366} 367 368static sizeOf():number { 369 return 4; 370} 371 372static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset { 373 builder.prep(2, 4); 374 builder.pad(1); 375 builder.writeInt8(b); 376 builder.writeInt16(a); 377 return builder.offset(); 378} 379 380} 381 382export class MyGame_Example_TestSimpleTableWithEnum { 383 bb: flatbuffers.ByteBuffer|null = null; 384 bb_pos = 0; 385 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_TestSimpleTableWithEnum { 386 this.bb_pos = i; 387 this.bb = bb; 388 return this; 389} 390 391static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TestSimpleTableWithEnum):MyGame_Example_TestSimpleTableWithEnum { 392 return (obj || new MyGame_Example_TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 393} 394 395static getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TestSimpleTableWithEnum):MyGame_Example_TestSimpleTableWithEnum { 396 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 397 return (obj || new MyGame_Example_TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 398} 399 400color():MyGame_Example_Color { 401 const offset = this.bb!.__offset(this.bb_pos, 4); 402 return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Color.Green; 403} 404 405static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) { 406 builder.startObject(1); 407} 408 409static addColor(builder:flatbuffers.Builder, color:MyGame_Example_Color) { 410 builder.addFieldInt8(0, color, MyGame_Example_Color.Green); 411} 412 413static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset { 414 const offset = builder.endObject(); 415 return offset; 416} 417 418static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:MyGame_Example_Color):flatbuffers.Offset { 419 MyGame_Example_TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder); 420 MyGame_Example_TestSimpleTableWithEnum.addColor(builder, color); 421 return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); 422} 423 424serialize():Uint8Array { 425 return this.bb!.bytes(); 426} 427 428static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum { 429 return MyGame_Example_TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer)) 430} 431} 432 433export class MyGame_Example_Vec3 { 434 bb: flatbuffers.ByteBuffer|null = null; 435 bb_pos = 0; 436 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Vec3 { 437 this.bb_pos = i; 438 this.bb = bb; 439 return this; 440} 441 442x():number { 443 return this.bb!.readFloat32(this.bb_pos); 444} 445 446y():number { 447 return this.bb!.readFloat32(this.bb_pos + 4); 448} 449 450z():number { 451 return this.bb!.readFloat32(this.bb_pos + 8); 452} 453 454test1():number { 455 return this.bb!.readFloat64(this.bb_pos + 16); 456} 457 458test2():MyGame_Example_Color { 459 return this.bb!.readUint8(this.bb_pos + 24); 460} 461 462test3(obj?:MyGame_Example_Test):MyGame_Example_Test|null { 463 return (obj || new MyGame_Example_Test()).__init(this.bb_pos + 26, this.bb!); 464} 465 466static sizeOf():number { 467 return 32; 468} 469 470static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: MyGame_Example_Color, test3_a: number, test3_b: number):flatbuffers.Offset { 471 builder.prep(8, 32); 472 builder.pad(2); 473 builder.prep(2, 4); 474 builder.pad(1); 475 builder.writeInt8(test3_b); 476 builder.writeInt16(test3_a); 477 builder.pad(1); 478 builder.writeInt8(test2); 479 builder.writeFloat64(test1); 480 builder.pad(4); 481 builder.writeFloat32(z); 482 builder.writeFloat32(y); 483 builder.writeFloat32(x); 484 return builder.offset(); 485} 486 487} 488 489export class MyGame_Example_Ability { 490 bb: flatbuffers.ByteBuffer|null = null; 491 bb_pos = 0; 492 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Ability { 493 this.bb_pos = i; 494 this.bb = bb; 495 return this; 496} 497 498id():number { 499 return this.bb!.readUint32(this.bb_pos); 500} 501 502distance():number { 503 return this.bb!.readUint32(this.bb_pos + 4); 504} 505 506static sizeOf():number { 507 return 8; 508} 509 510static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset { 511 builder.prep(4, 8); 512 builder.writeInt32(distance); 513 builder.writeInt32(id); 514 return builder.offset(); 515} 516 517} 518 519export class MyGame_Example_StructOfStructs { 520 bb: flatbuffers.ByteBuffer|null = null; 521 bb_pos = 0; 522 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_StructOfStructs { 523 this.bb_pos = i; 524 this.bb = bb; 525 return this; 526} 527 528a(obj?:MyGame_Example_Ability):MyGame_Example_Ability|null { 529 return (obj || new MyGame_Example_Ability()).__init(this.bb_pos, this.bb!); 530} 531 532b(obj?:MyGame_Example_Test):MyGame_Example_Test|null { 533 return (obj || new MyGame_Example_Test()).__init(this.bb_pos + 8, this.bb!); 534} 535 536c(obj?:MyGame_Example_Ability):MyGame_Example_Ability|null { 537 return (obj || new MyGame_Example_Ability()).__init(this.bb_pos + 12, this.bb!); 538} 539 540static sizeOf():number { 541 return 20; 542} 543 544static createStructOfStructs(builder:flatbuffers.Builder, a_id: number, a_distance: number, b_a: number, b_b: number, c_id: number, c_distance: number):flatbuffers.Offset { 545 builder.prep(4, 20); 546 builder.prep(4, 8); 547 builder.writeInt32(c_distance); 548 builder.writeInt32(c_id); 549 builder.prep(2, 4); 550 builder.pad(1); 551 builder.writeInt8(b_b); 552 builder.writeInt16(b_a); 553 builder.prep(4, 8); 554 builder.writeInt32(a_distance); 555 builder.writeInt32(a_id); 556 return builder.offset(); 557} 558 559} 560 561export class MyGame_Example_StructOfStructsOfStructs { 562 bb: flatbuffers.ByteBuffer|null = null; 563 bb_pos = 0; 564 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_StructOfStructsOfStructs { 565 this.bb_pos = i; 566 this.bb = bb; 567 return this; 568} 569 570a(obj?:MyGame_Example_StructOfStructs):MyGame_Example_StructOfStructs|null { 571 return (obj || new MyGame_Example_StructOfStructs()).__init(this.bb_pos, this.bb!); 572} 573 574static sizeOf():number { 575 return 20; 576} 577 578static createStructOfStructsOfStructs(builder:flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number):flatbuffers.Offset { 579 builder.prep(4, 20); 580 builder.prep(4, 20); 581 builder.prep(4, 8); 582 builder.writeInt32(a_c_distance); 583 builder.writeInt32(a_c_id); 584 builder.prep(2, 4); 585 builder.pad(1); 586 builder.writeInt8(a_b_b); 587 builder.writeInt16(a_b_a); 588 builder.prep(4, 8); 589 builder.writeInt32(a_a_distance); 590 builder.writeInt32(a_a_id); 591 return builder.offset(); 592} 593 594} 595 596export class MyGame_Example_Stat { 597 bb: flatbuffers.ByteBuffer|null = null; 598 bb_pos = 0; 599 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Stat { 600 this.bb_pos = i; 601 this.bb = bb; 602 return this; 603} 604 605static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Stat):MyGame_Example_Stat { 606 return (obj || new MyGame_Example_Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 607} 608 609static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Stat):MyGame_Example_Stat { 610 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 611 return (obj || new MyGame_Example_Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 612} 613 614id():string|null 615id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 616id(optionalEncoding?:any):string|Uint8Array|null { 617 const offset = this.bb!.__offset(this.bb_pos, 4); 618 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 619} 620 621val():bigint { 622 const offset = this.bb!.__offset(this.bb_pos, 6); 623 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 624} 625 626count():number { 627 const offset = this.bb!.__offset(this.bb_pos, 8); 628 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 629} 630 631static startStat(builder:flatbuffers.Builder) { 632 builder.startObject(3); 633} 634 635static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { 636 builder.addFieldOffset(0, idOffset, 0); 637} 638 639static addVal(builder:flatbuffers.Builder, val:bigint) { 640 builder.addFieldInt64(1, val, BigInt('0')); 641} 642 643static addCount(builder:flatbuffers.Builder, count:number) { 644 builder.addFieldInt16(2, count, 0); 645} 646 647static endStat(builder:flatbuffers.Builder):flatbuffers.Offset { 648 const offset = builder.endObject(); 649 return offset; 650} 651 652static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset { 653 MyGame_Example_Stat.startStat(builder); 654 MyGame_Example_Stat.addId(builder, idOffset); 655 MyGame_Example_Stat.addVal(builder, val); 656 MyGame_Example_Stat.addCount(builder, count); 657 return MyGame_Example_Stat.endStat(builder); 658} 659 660serialize():Uint8Array { 661 return this.bb!.bytes(); 662} 663 664static deserialize(buffer: Uint8Array):Stat { 665 return MyGame_Example_Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer)) 666} 667} 668 669export class MyGame_Example_Referrable { 670 bb: flatbuffers.ByteBuffer|null = null; 671 bb_pos = 0; 672 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Referrable { 673 this.bb_pos = i; 674 this.bb = bb; 675 return this; 676} 677 678static getRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable { 679 return (obj || new MyGame_Example_Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 680} 681 682static getSizePrefixedRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable { 683 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 684 return (obj || new MyGame_Example_Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 685} 686 687id():bigint { 688 const offset = this.bb!.__offset(this.bb_pos, 4); 689 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 690} 691 692static startReferrable(builder:flatbuffers.Builder) { 693 builder.startObject(1); 694} 695 696static addId(builder:flatbuffers.Builder, id:bigint) { 697 builder.addFieldInt64(0, id, BigInt('0')); 698} 699 700static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset { 701 const offset = builder.endObject(); 702 return offset; 703} 704 705static createReferrable(builder:flatbuffers.Builder, id:bigint):flatbuffers.Offset { 706 MyGame_Example_Referrable.startReferrable(builder); 707 MyGame_Example_Referrable.addId(builder, id); 708 return MyGame_Example_Referrable.endReferrable(builder); 709} 710 711serialize():Uint8Array { 712 return this.bb!.bytes(); 713} 714 715static deserialize(buffer: Uint8Array):Referrable { 716 return MyGame_Example_Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer)) 717} 718} 719 720/** 721 * an example documentation comment: "monster object" 722 */ 723export class MyGame_Example_Monster { 724 bb: flatbuffers.ByteBuffer|null = null; 725 bb_pos = 0; 726 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Monster { 727 this.bb_pos = i; 728 this.bb = bb; 729 return this; 730} 731 732static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Monster):MyGame_Example_Monster { 733 return (obj || new MyGame_Example_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 734} 735 736static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Monster):MyGame_Example_Monster { 737 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 738 return (obj || new MyGame_Example_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 739} 740 741static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { 742 return bb.__has_identifier('MONS'); 743} 744 745pos(obj?:MyGame_Example_Vec3):MyGame_Example_Vec3|null { 746 const offset = this.bb!.__offset(this.bb_pos, 4); 747 return offset ? (obj || new MyGame_Example_Vec3()).__init(this.bb_pos + offset, this.bb!) : null; 748} 749 750mana():number { 751 const offset = this.bb!.__offset(this.bb_pos, 6); 752 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 150; 753} 754 755hp():number { 756 const offset = this.bb!.__offset(this.bb_pos, 8); 757 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 100; 758} 759 760name():string|null 761name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 762name(optionalEncoding?:any):string|Uint8Array|null { 763 const offset = this.bb!.__offset(this.bb_pos, 10); 764 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 765} 766 767inventory(index: number):number|null { 768 const offset = this.bb!.__offset(this.bb_pos, 14); 769 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 770} 771 772inventoryLength():number { 773 const offset = this.bb!.__offset(this.bb_pos, 14); 774 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 775} 776 777inventoryArray():Uint8Array|null { 778 const offset = this.bb!.__offset(this.bb_pos, 14); 779 return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 780} 781 782color():MyGame_Example_Color { 783 const offset = this.bb!.__offset(this.bb_pos, 16); 784 return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Color.Blue; 785} 786 787testType():MyGame_Example_Any { 788 const offset = this.bb!.__offset(this.bb_pos, 18); 789 return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Any.NONE; 790} 791 792test<T extends flatbuffers.Table>(obj:any):any|null { 793 const offset = this.bb!.__offset(this.bb_pos, 20); 794 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 795} 796 797test4(index: number, obj?:MyGame_Example_Test):MyGame_Example_Test|null { 798 const offset = this.bb!.__offset(this.bb_pos, 22); 799 return offset ? (obj || new MyGame_Example_Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null; 800} 801 802test4Length():number { 803 const offset = this.bb!.__offset(this.bb_pos, 22); 804 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 805} 806 807testarrayofstring(index: number):string 808testarrayofstring(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 809testarrayofstring(index: number,optionalEncoding?:any):string|Uint8Array|null { 810 const offset = this.bb!.__offset(this.bb_pos, 24); 811 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 812} 813 814testarrayofstringLength():number { 815 const offset = this.bb!.__offset(this.bb_pos, 24); 816 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 817} 818 819/** 820 * an example documentation comment: this will end up in the generated code 821 * multiline too 822 */ 823testarrayoftables(index: number, obj?:MyGame_Example_Monster):MyGame_Example_Monster|null { 824 const offset = this.bb!.__offset(this.bb_pos, 26); 825 return offset ? (obj || new MyGame_Example_Monster()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 826} 827 828testarrayoftablesLength():number { 829 const offset = this.bb!.__offset(this.bb_pos, 26); 830 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 831} 832 833enemy(obj?:MyGame_Example_Monster):MyGame_Example_Monster|null { 834 const offset = this.bb!.__offset(this.bb_pos, 28); 835 return offset ? (obj || new MyGame_Example_Monster()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 836} 837 838testnestedflatbuffer(index: number):number|null { 839 const offset = this.bb!.__offset(this.bb_pos, 30); 840 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 841} 842 843testnestedflatbufferLength():number { 844 const offset = this.bb!.__offset(this.bb_pos, 30); 845 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 846} 847 848testnestedflatbufferArray():Uint8Array|null { 849 const offset = this.bb!.__offset(this.bb_pos, 30); 850 return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 851} 852 853testempty(obj?:MyGame_Example_Stat):MyGame_Example_Stat|null { 854 const offset = this.bb!.__offset(this.bb_pos, 32); 855 return offset ? (obj || new MyGame_Example_Stat()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 856} 857 858testbool():boolean { 859 const offset = this.bb!.__offset(this.bb_pos, 34); 860 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 861} 862 863testhashs32Fnv1():number { 864 const offset = this.bb!.__offset(this.bb_pos, 36); 865 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; 866} 867 868testhashu32Fnv1():number { 869 const offset = this.bb!.__offset(this.bb_pos, 38); 870 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; 871} 872 873testhashs64Fnv1():bigint { 874 const offset = this.bb!.__offset(this.bb_pos, 40); 875 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 876} 877 878testhashu64Fnv1():bigint { 879 const offset = this.bb!.__offset(this.bb_pos, 42); 880 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 881} 882 883testhashs32Fnv1a():number { 884 const offset = this.bb!.__offset(this.bb_pos, 44); 885 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; 886} 887 888testhashu32Fnv1a():number { 889 const offset = this.bb!.__offset(this.bb_pos, 46); 890 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; 891} 892 893testhashs64Fnv1a():bigint { 894 const offset = this.bb!.__offset(this.bb_pos, 48); 895 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 896} 897 898testhashu64Fnv1a():bigint { 899 const offset = this.bb!.__offset(this.bb_pos, 50); 900 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 901} 902 903testarrayofbools(index: number):boolean|null { 904 const offset = this.bb!.__offset(this.bb_pos, 52); 905 return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false; 906} 907 908testarrayofboolsLength():number { 909 const offset = this.bb!.__offset(this.bb_pos, 52); 910 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 911} 912 913testarrayofboolsArray():Int8Array|null { 914 const offset = this.bb!.__offset(this.bb_pos, 52); 915 return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 916} 917 918testf():number { 919 const offset = this.bb!.__offset(this.bb_pos, 54); 920 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.14159; 921} 922 923testf2():number { 924 const offset = this.bb!.__offset(this.bb_pos, 56); 925 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.0; 926} 927 928testf3():number { 929 const offset = this.bb!.__offset(this.bb_pos, 58); 930 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; 931} 932 933testarrayofstring2(index: number):string 934testarrayofstring2(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 935testarrayofstring2(index: number,optionalEncoding?:any):string|Uint8Array|null { 936 const offset = this.bb!.__offset(this.bb_pos, 60); 937 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 938} 939 940testarrayofstring2Length():number { 941 const offset = this.bb!.__offset(this.bb_pos, 60); 942 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 943} 944 945testarrayofsortedstruct(index: number, obj?:MyGame_Example_Ability):MyGame_Example_Ability|null { 946 const offset = this.bb!.__offset(this.bb_pos, 62); 947 return offset ? (obj || new MyGame_Example_Ability()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 8, this.bb!) : null; 948} 949 950testarrayofsortedstructLength():number { 951 const offset = this.bb!.__offset(this.bb_pos, 62); 952 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 953} 954 955flex(index: number):number|null { 956 const offset = this.bb!.__offset(this.bb_pos, 64); 957 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 958} 959 960flexLength():number { 961 const offset = this.bb!.__offset(this.bb_pos, 64); 962 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 963} 964 965flexArray():Uint8Array|null { 966 const offset = this.bb!.__offset(this.bb_pos, 64); 967 return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 968} 969 970test5(index: number, obj?:MyGame_Example_Test):MyGame_Example_Test|null { 971 const offset = this.bb!.__offset(this.bb_pos, 66); 972 return offset ? (obj || new MyGame_Example_Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null; 973} 974 975test5Length():number { 976 const offset = this.bb!.__offset(this.bb_pos, 66); 977 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 978} 979 980vectorOfLongs(index: number):bigint|null { 981 const offset = this.bb!.__offset(this.bb_pos, 68); 982 return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 983} 984 985vectorOfLongsLength():number { 986 const offset = this.bb!.__offset(this.bb_pos, 68); 987 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 988} 989 990vectorOfDoubles(index: number):number|null { 991 const offset = this.bb!.__offset(this.bb_pos, 70); 992 return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; 993} 994 995vectorOfDoublesLength():number { 996 const offset = this.bb!.__offset(this.bb_pos, 70); 997 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 998} 999 1000vectorOfDoublesArray():Float64Array|null { 1001 const offset = this.bb!.__offset(this.bb_pos, 70); 1002 return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 1003} 1004 1005parentNamespaceTest(obj?:MyGame_InParentNamespace):MyGame_InParentNamespace|null { 1006 const offset = this.bb!.__offset(this.bb_pos, 72); 1007 return offset ? (obj || new MyGame_InParentNamespace()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 1008} 1009 1010vectorOfReferrables(index: number, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable|null { 1011 const offset = this.bb!.__offset(this.bb_pos, 74); 1012 return offset ? (obj || new MyGame_Example_Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 1013} 1014 1015vectorOfReferrablesLength():number { 1016 const offset = this.bb!.__offset(this.bb_pos, 74); 1017 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1018} 1019 1020singleWeakReference():bigint { 1021 const offset = this.bb!.__offset(this.bb_pos, 76); 1022 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 1023} 1024 1025vectorOfWeakReferences(index: number):bigint|null { 1026 const offset = this.bb!.__offset(this.bb_pos, 78); 1027 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 1028} 1029 1030vectorOfWeakReferencesLength():number { 1031 const offset = this.bb!.__offset(this.bb_pos, 78); 1032 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1033} 1034 1035vectorOfStrongReferrables(index: number, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable|null { 1036 const offset = this.bb!.__offset(this.bb_pos, 80); 1037 return offset ? (obj || new MyGame_Example_Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 1038} 1039 1040vectorOfStrongReferrablesLength():number { 1041 const offset = this.bb!.__offset(this.bb_pos, 80); 1042 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1043} 1044 1045coOwningReference():bigint { 1046 const offset = this.bb!.__offset(this.bb_pos, 82); 1047 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 1048} 1049 1050vectorOfCoOwningReferences(index: number):bigint|null { 1051 const offset = this.bb!.__offset(this.bb_pos, 84); 1052 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 1053} 1054 1055vectorOfCoOwningReferencesLength():number { 1056 const offset = this.bb!.__offset(this.bb_pos, 84); 1057 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1058} 1059 1060nonOwningReference():bigint { 1061 const offset = this.bb!.__offset(this.bb_pos, 86); 1062 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 1063} 1064 1065vectorOfNonOwningReferences(index: number):bigint|null { 1066 const offset = this.bb!.__offset(this.bb_pos, 88); 1067 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 1068} 1069 1070vectorOfNonOwningReferencesLength():number { 1071 const offset = this.bb!.__offset(this.bb_pos, 88); 1072 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1073} 1074 1075anyUniqueType():MyGame_Example_AnyUniqueAliases { 1076 const offset = this.bb!.__offset(this.bb_pos, 90); 1077 return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_AnyUniqueAliases.NONE; 1078} 1079 1080anyUnique<T extends flatbuffers.Table>(obj:any):any|null { 1081 const offset = this.bb!.__offset(this.bb_pos, 92); 1082 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 1083} 1084 1085anyAmbiguousType():MyGame_Example_AnyAmbiguousAliases { 1086 const offset = this.bb!.__offset(this.bb_pos, 94); 1087 return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_AnyAmbiguousAliases.NONE; 1088} 1089 1090anyAmbiguous<T extends flatbuffers.Table>(obj:any):any|null { 1091 const offset = this.bb!.__offset(this.bb_pos, 96); 1092 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 1093} 1094 1095vectorOfEnums(index: number):MyGame_Example_Color|null { 1096 const offset = this.bb!.__offset(this.bb_pos, 98); 1097 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 1098} 1099 1100vectorOfEnumsLength():number { 1101 const offset = this.bb!.__offset(this.bb_pos, 98); 1102 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1103} 1104 1105vectorOfEnumsArray():Uint8Array|null { 1106 const offset = this.bb!.__offset(this.bb_pos, 98); 1107 return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 1108} 1109 1110signedEnum():MyGame_Example_Race { 1111 const offset = this.bb!.__offset(this.bb_pos, 100); 1112 return offset ? this.bb!.readInt8(this.bb_pos + offset) : MyGame_Example_Race.None; 1113} 1114 1115testrequirednestedflatbuffer(index: number):number|null { 1116 const offset = this.bb!.__offset(this.bb_pos, 102); 1117 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 1118} 1119 1120testrequirednestedflatbufferLength():number { 1121 const offset = this.bb!.__offset(this.bb_pos, 102); 1122 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1123} 1124 1125testrequirednestedflatbufferArray():Uint8Array|null { 1126 const offset = this.bb!.__offset(this.bb_pos, 102); 1127 return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 1128} 1129 1130scalarKeySortedTables(index: number, obj?:MyGame_Example_Stat):MyGame_Example_Stat|null { 1131 const offset = this.bb!.__offset(this.bb_pos, 104); 1132 return offset ? (obj || new MyGame_Example_Stat()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 1133} 1134 1135scalarKeySortedTablesLength():number { 1136 const offset = this.bb!.__offset(this.bb_pos, 104); 1137 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1138} 1139 1140nativeInline(obj?:MyGame_Example_Test):MyGame_Example_Test|null { 1141 const offset = this.bb!.__offset(this.bb_pos, 106); 1142 return offset ? (obj || new MyGame_Example_Test()).__init(this.bb_pos + offset, this.bb!) : null; 1143} 1144 1145longEnumNonEnumDefault():bigint { 1146 const offset = this.bb!.__offset(this.bb_pos, 108); 1147 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 1148} 1149 1150longEnumNormalDefault():bigint { 1151 const offset = this.bb!.__offset(this.bb_pos, 110); 1152 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('2'); 1153} 1154 1155static startMonster(builder:flatbuffers.Builder) { 1156 builder.startObject(54); 1157} 1158 1159static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) { 1160 builder.addFieldStruct(0, posOffset, 0); 1161} 1162 1163static addMana(builder:flatbuffers.Builder, mana:number) { 1164 builder.addFieldInt16(1, mana, 150); 1165} 1166 1167static addHp(builder:flatbuffers.Builder, hp:number) { 1168 builder.addFieldInt16(2, hp, 100); 1169} 1170 1171static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { 1172 builder.addFieldOffset(3, nameOffset, 0); 1173} 1174 1175static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) { 1176 builder.addFieldOffset(5, inventoryOffset, 0); 1177} 1178 1179static createInventoryVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 1180 builder.startVector(1, data.length, 1); 1181 for (let i = data.length - 1; i >= 0; i--) { 1182 builder.addInt8(data[i]!); 1183 } 1184 return builder.endVector(); 1185} 1186 1187static startInventoryVector(builder:flatbuffers.Builder, numElems:number) { 1188 builder.startVector(1, numElems, 1); 1189} 1190 1191static addColor(builder:flatbuffers.Builder, color:MyGame_Example_Color) { 1192 builder.addFieldInt8(6, color, MyGame_Example_Color.Blue); 1193} 1194 1195static addTestType(builder:flatbuffers.Builder, testType:MyGame_Example_Any) { 1196 builder.addFieldInt8(7, testType, MyGame_Example_Any.NONE); 1197} 1198 1199static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) { 1200 builder.addFieldOffset(8, testOffset, 0); 1201} 1202 1203static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) { 1204 builder.addFieldOffset(9, test4Offset, 0); 1205} 1206 1207static startTest4Vector(builder:flatbuffers.Builder, numElems:number) { 1208 builder.startVector(4, numElems, 2); 1209} 1210 1211static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) { 1212 builder.addFieldOffset(10, testarrayofstringOffset, 0); 1213} 1214 1215static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1216 builder.startVector(4, data.length, 4); 1217 for (let i = data.length - 1; i >= 0; i--) { 1218 builder.addOffset(data[i]!); 1219 } 1220 return builder.endVector(); 1221} 1222 1223static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) { 1224 builder.startVector(4, numElems, 4); 1225} 1226 1227static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) { 1228 builder.addFieldOffset(11, testarrayoftablesOffset, 0); 1229} 1230 1231static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1232 builder.startVector(4, data.length, 4); 1233 for (let i = data.length - 1; i >= 0; i--) { 1234 builder.addOffset(data[i]!); 1235 } 1236 return builder.endVector(); 1237} 1238 1239static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) { 1240 builder.startVector(4, numElems, 4); 1241} 1242 1243static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) { 1244 builder.addFieldOffset(12, enemyOffset, 0); 1245} 1246 1247static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) { 1248 builder.addFieldOffset(13, testnestedflatbufferOffset, 0); 1249} 1250 1251static createTestnestedflatbufferVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 1252 builder.startVector(1, data.length, 1); 1253 for (let i = data.length - 1; i >= 0; i--) { 1254 builder.addInt8(data[i]!); 1255 } 1256 return builder.endVector(); 1257} 1258 1259static startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) { 1260 builder.startVector(1, numElems, 1); 1261} 1262 1263static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) { 1264 builder.addFieldOffset(14, testemptyOffset, 0); 1265} 1266 1267static addTestbool(builder:flatbuffers.Builder, testbool:boolean) { 1268 builder.addFieldInt8(15, +testbool, +false); 1269} 1270 1271static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) { 1272 builder.addFieldInt32(16, testhashs32Fnv1, 0); 1273} 1274 1275static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) { 1276 builder.addFieldInt32(17, testhashu32Fnv1, 0); 1277} 1278 1279static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) { 1280 builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0')); 1281} 1282 1283static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) { 1284 builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0')); 1285} 1286 1287static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) { 1288 builder.addFieldInt32(20, testhashs32Fnv1a, 0); 1289} 1290 1291static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) { 1292 builder.addFieldInt32(21, testhashu32Fnv1a, 0); 1293} 1294 1295static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) { 1296 builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0')); 1297} 1298 1299static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) { 1300 builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0')); 1301} 1302 1303static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) { 1304 builder.addFieldOffset(24, testarrayofboolsOffset, 0); 1305} 1306 1307static createTestarrayofboolsVector(builder:flatbuffers.Builder, data:boolean[]):flatbuffers.Offset { 1308 builder.startVector(1, data.length, 1); 1309 for (let i = data.length - 1; i >= 0; i--) { 1310 builder.addInt8(+data[i]!); 1311 } 1312 return builder.endVector(); 1313} 1314 1315static startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) { 1316 builder.startVector(1, numElems, 1); 1317} 1318 1319static addTestf(builder:flatbuffers.Builder, testf:number) { 1320 builder.addFieldFloat32(25, testf, 3.14159); 1321} 1322 1323static addTestf2(builder:flatbuffers.Builder, testf2:number) { 1324 builder.addFieldFloat32(26, testf2, 3.0); 1325} 1326 1327static addTestf3(builder:flatbuffers.Builder, testf3:number) { 1328 builder.addFieldFloat32(27, testf3, 0.0); 1329} 1330 1331static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) { 1332 builder.addFieldOffset(28, testarrayofstring2Offset, 0); 1333} 1334 1335static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1336 builder.startVector(4, data.length, 4); 1337 for (let i = data.length - 1; i >= 0; i--) { 1338 builder.addOffset(data[i]!); 1339 } 1340 return builder.endVector(); 1341} 1342 1343static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) { 1344 builder.startVector(4, numElems, 4); 1345} 1346 1347static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) { 1348 builder.addFieldOffset(29, testarrayofsortedstructOffset, 0); 1349} 1350 1351static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) { 1352 builder.startVector(8, numElems, 4); 1353} 1354 1355static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset) { 1356 builder.addFieldOffset(30, flexOffset, 0); 1357} 1358 1359static createFlexVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 1360 builder.startVector(1, data.length, 1); 1361 for (let i = data.length - 1; i >= 0; i--) { 1362 builder.addInt8(data[i]!); 1363 } 1364 return builder.endVector(); 1365} 1366 1367static startFlexVector(builder:flatbuffers.Builder, numElems:number) { 1368 builder.startVector(1, numElems, 1); 1369} 1370 1371static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset) { 1372 builder.addFieldOffset(31, test5Offset, 0); 1373} 1374 1375static startTest5Vector(builder:flatbuffers.Builder, numElems:number) { 1376 builder.startVector(4, numElems, 2); 1377} 1378 1379static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) { 1380 builder.addFieldOffset(32, vectorOfLongsOffset, 0); 1381} 1382 1383static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1384 builder.startVector(8, data.length, 8); 1385 for (let i = data.length - 1; i >= 0; i--) { 1386 builder.addInt64(data[i]!); 1387 } 1388 return builder.endVector(); 1389} 1390 1391static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) { 1392 builder.startVector(8, numElems, 8); 1393} 1394 1395static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) { 1396 builder.addFieldOffset(33, vectorOfDoublesOffset, 0); 1397} 1398 1399static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; 1400/** 1401 * @deprecated This Uint8Array overload will be removed in the future. 1402 */ 1403static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; 1404static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { 1405 builder.startVector(8, data.length, 8); 1406 for (let i = data.length - 1; i >= 0; i--) { 1407 builder.addFloat64(data[i]!); 1408 } 1409 return builder.endVector(); 1410} 1411 1412static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) { 1413 builder.startVector(8, numElems, 8); 1414} 1415 1416static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) { 1417 builder.addFieldOffset(34, parentNamespaceTestOffset, 0); 1418} 1419 1420static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset) { 1421 builder.addFieldOffset(35, vectorOfReferrablesOffset, 0); 1422} 1423 1424static createVectorOfReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1425 builder.startVector(4, data.length, 4); 1426 for (let i = data.length - 1; i >= 0; i--) { 1427 builder.addOffset(data[i]!); 1428 } 1429 return builder.endVector(); 1430} 1431 1432static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number) { 1433 builder.startVector(4, numElems, 4); 1434} 1435 1436static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) { 1437 builder.addFieldInt64(36, singleWeakReference, BigInt('0')); 1438} 1439 1440static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) { 1441 builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0); 1442} 1443 1444static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1445 builder.startVector(8, data.length, 8); 1446 for (let i = data.length - 1; i >= 0; i--) { 1447 builder.addInt64(data[i]!); 1448 } 1449 return builder.endVector(); 1450} 1451 1452static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number) { 1453 builder.startVector(8, numElems, 8); 1454} 1455 1456static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset) { 1457 builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0); 1458} 1459 1460static createVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1461 builder.startVector(4, data.length, 4); 1462 for (let i = data.length - 1; i >= 0; i--) { 1463 builder.addOffset(data[i]!); 1464 } 1465 return builder.endVector(); 1466} 1467 1468static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number) { 1469 builder.startVector(4, numElems, 4); 1470} 1471 1472static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) { 1473 builder.addFieldInt64(39, coOwningReference, BigInt('0')); 1474} 1475 1476static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) { 1477 builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0); 1478} 1479 1480static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1481 builder.startVector(8, data.length, 8); 1482 for (let i = data.length - 1; i >= 0; i--) { 1483 builder.addInt64(data[i]!); 1484 } 1485 return builder.endVector(); 1486} 1487 1488static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) { 1489 builder.startVector(8, numElems, 8); 1490} 1491 1492static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) { 1493 builder.addFieldInt64(41, nonOwningReference, BigInt('0')); 1494} 1495 1496static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) { 1497 builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0); 1498} 1499 1500static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1501 builder.startVector(8, data.length, 8); 1502 for (let i = data.length - 1; i >= 0; i--) { 1503 builder.addInt64(data[i]!); 1504 } 1505 return builder.endVector(); 1506} 1507 1508static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) { 1509 builder.startVector(8, numElems, 8); 1510} 1511 1512static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:MyGame_Example_AnyUniqueAliases) { 1513 builder.addFieldInt8(43, anyUniqueType, MyGame_Example_AnyUniqueAliases.NONE); 1514} 1515 1516static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) { 1517 builder.addFieldOffset(44, anyUniqueOffset, 0); 1518} 1519 1520static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:MyGame_Example_AnyAmbiguousAliases) { 1521 builder.addFieldInt8(45, anyAmbiguousType, MyGame_Example_AnyAmbiguousAliases.NONE); 1522} 1523 1524static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) { 1525 builder.addFieldOffset(46, anyAmbiguousOffset, 0); 1526} 1527 1528static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset) { 1529 builder.addFieldOffset(47, vectorOfEnumsOffset, 0); 1530} 1531 1532static createVectorOfEnumsVector(builder:flatbuffers.Builder, data:MyGame_Example_Color[]):flatbuffers.Offset { 1533 builder.startVector(1, data.length, 1); 1534 for (let i = data.length - 1; i >= 0; i--) { 1535 builder.addInt8(data[i]!); 1536 } 1537 return builder.endVector(); 1538} 1539 1540static startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number) { 1541 builder.startVector(1, numElems, 1); 1542} 1543 1544static addSignedEnum(builder:flatbuffers.Builder, signedEnum:MyGame_Example_Race) { 1545 builder.addFieldInt8(48, signedEnum, MyGame_Example_Race.None); 1546} 1547 1548static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset) { 1549 builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0); 1550} 1551 1552static createTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 1553 builder.startVector(1, data.length, 1); 1554 for (let i = data.length - 1; i >= 0; i--) { 1555 builder.addInt8(data[i]!); 1556 } 1557 return builder.endVector(); 1558} 1559 1560static startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) { 1561 builder.startVector(1, numElems, 1); 1562} 1563 1564static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset) { 1565 builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0); 1566} 1567 1568static createScalarKeySortedTablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1569 builder.startVector(4, data.length, 4); 1570 for (let i = data.length - 1; i >= 0; i--) { 1571 builder.addOffset(data[i]!); 1572 } 1573 return builder.endVector(); 1574} 1575 1576static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number) { 1577 builder.startVector(4, numElems, 4); 1578} 1579 1580static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset) { 1581 builder.addFieldStruct(51, nativeInlineOffset, 0); 1582} 1583 1584static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint) { 1585 builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0')); 1586} 1587 1588static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint) { 1589 builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2')); 1590} 1591 1592static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset { 1593 const offset = builder.endObject(); 1594 builder.requiredField(offset, 10) // name 1595 return offset; 1596} 1597 1598static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { 1599 builder.finish(offset, 'MONS'); 1600} 1601 1602static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { 1603 builder.finish(offset, 'MONS', true); 1604} 1605 1606 1607serialize():Uint8Array { 1608 return this.bb!.bytes(); 1609} 1610 1611static deserialize(buffer: Uint8Array):Monster { 1612 return MyGame_Example_Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer)) 1613} 1614} 1615 1616export class MyGame_Example_TypeAliases { 1617 bb: flatbuffers.ByteBuffer|null = null; 1618 bb_pos = 0; 1619 __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_TypeAliases { 1620 this.bb_pos = i; 1621 this.bb = bb; 1622 return this; 1623} 1624 1625static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TypeAliases):MyGame_Example_TypeAliases { 1626 return (obj || new MyGame_Example_TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 1627} 1628 1629static getSizePrefixedRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TypeAliases):MyGame_Example_TypeAliases { 1630 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 1631 return (obj || new MyGame_Example_TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 1632} 1633 1634i8():number { 1635 const offset = this.bb!.__offset(this.bb_pos, 4); 1636 return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0; 1637} 1638 1639u8():number { 1640 const offset = this.bb!.__offset(this.bb_pos, 6); 1641 return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0; 1642} 1643 1644i16():number { 1645 const offset = this.bb!.__offset(this.bb_pos, 8); 1646 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0; 1647} 1648 1649u16():number { 1650 const offset = this.bb!.__offset(this.bb_pos, 10); 1651 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 1652} 1653 1654i32():number { 1655 const offset = this.bb!.__offset(this.bb_pos, 12); 1656 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; 1657} 1658 1659u32():number { 1660 const offset = this.bb!.__offset(this.bb_pos, 14); 1661 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; 1662} 1663 1664i64():bigint { 1665 const offset = this.bb!.__offset(this.bb_pos, 16); 1666 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 1667} 1668 1669u64():bigint { 1670 const offset = this.bb!.__offset(this.bb_pos, 18); 1671 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 1672} 1673 1674f32():number { 1675 const offset = this.bb!.__offset(this.bb_pos, 20); 1676 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; 1677} 1678 1679f64():number { 1680 const offset = this.bb!.__offset(this.bb_pos, 22); 1681 return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; 1682} 1683 1684v8(index: number):number|null { 1685 const offset = this.bb!.__offset(this.bb_pos, 24); 1686 return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 1687} 1688 1689v8Length():number { 1690 const offset = this.bb!.__offset(this.bb_pos, 24); 1691 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1692} 1693 1694v8Array():Int8Array|null { 1695 const offset = this.bb!.__offset(this.bb_pos, 24); 1696 return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 1697} 1698 1699vf64(index: number):number|null { 1700 const offset = this.bb!.__offset(this.bb_pos, 26); 1701 return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; 1702} 1703 1704vf64Length():number { 1705 const offset = this.bb!.__offset(this.bb_pos, 26); 1706 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 1707} 1708 1709vf64Array():Float64Array|null { 1710 const offset = this.bb!.__offset(this.bb_pos, 26); 1711 return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; 1712} 1713 1714static startTypeAliases(builder:flatbuffers.Builder) { 1715 builder.startObject(12); 1716} 1717 1718static addI8(builder:flatbuffers.Builder, i8:number) { 1719 builder.addFieldInt8(0, i8, 0); 1720} 1721 1722static addU8(builder:flatbuffers.Builder, u8:number) { 1723 builder.addFieldInt8(1, u8, 0); 1724} 1725 1726static addI16(builder:flatbuffers.Builder, i16:number) { 1727 builder.addFieldInt16(2, i16, 0); 1728} 1729 1730static addU16(builder:flatbuffers.Builder, u16:number) { 1731 builder.addFieldInt16(3, u16, 0); 1732} 1733 1734static addI32(builder:flatbuffers.Builder, i32:number) { 1735 builder.addFieldInt32(4, i32, 0); 1736} 1737 1738static addU32(builder:flatbuffers.Builder, u32:number) { 1739 builder.addFieldInt32(5, u32, 0); 1740} 1741 1742static addI64(builder:flatbuffers.Builder, i64:bigint) { 1743 builder.addFieldInt64(6, i64, BigInt('0')); 1744} 1745 1746static addU64(builder:flatbuffers.Builder, u64:bigint) { 1747 builder.addFieldInt64(7, u64, BigInt('0')); 1748} 1749 1750static addF32(builder:flatbuffers.Builder, f32:number) { 1751 builder.addFieldFloat32(8, f32, 0.0); 1752} 1753 1754static addF64(builder:flatbuffers.Builder, f64:number) { 1755 builder.addFieldFloat64(9, f64, 0.0); 1756} 1757 1758static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) { 1759 builder.addFieldOffset(10, v8Offset, 0); 1760} 1761 1762static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array):flatbuffers.Offset; 1763/** 1764 * @deprecated This Uint8Array overload will be removed in the future. 1765 */ 1766static createV8Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; 1767static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array|Uint8Array):flatbuffers.Offset { 1768 builder.startVector(1, data.length, 1); 1769 for (let i = data.length - 1; i >= 0; i--) { 1770 builder.addInt8(data[i]!); 1771 } 1772 return builder.endVector(); 1773} 1774 1775static startV8Vector(builder:flatbuffers.Builder, numElems:number) { 1776 builder.startVector(1, numElems, 1); 1777} 1778 1779static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) { 1780 builder.addFieldOffset(11, vf64Offset, 0); 1781} 1782 1783static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; 1784/** 1785 * @deprecated This Uint8Array overload will be removed in the future. 1786 */ 1787static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; 1788static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { 1789 builder.startVector(8, data.length, 8); 1790 for (let i = data.length - 1; i >= 0; i--) { 1791 builder.addFloat64(data[i]!); 1792 } 1793 return builder.endVector(); 1794} 1795 1796static startVf64Vector(builder:flatbuffers.Builder, numElems:number) { 1797 builder.startVector(8, numElems, 8); 1798} 1799 1800static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset { 1801 const offset = builder.endObject(); 1802 return offset; 1803} 1804 1805static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset { 1806 MyGame_Example_TypeAliases.startTypeAliases(builder); 1807 MyGame_Example_TypeAliases.addI8(builder, i8); 1808 MyGame_Example_TypeAliases.addU8(builder, u8); 1809 MyGame_Example_TypeAliases.addI16(builder, i16); 1810 MyGame_Example_TypeAliases.addU16(builder, u16); 1811 MyGame_Example_TypeAliases.addI32(builder, i32); 1812 MyGame_Example_TypeAliases.addU32(builder, u32); 1813 MyGame_Example_TypeAliases.addI64(builder, i64); 1814 MyGame_Example_TypeAliases.addU64(builder, u64); 1815 MyGame_Example_TypeAliases.addF32(builder, f32); 1816 MyGame_Example_TypeAliases.addF64(builder, f64); 1817 MyGame_Example_TypeAliases.addV8(builder, v8Offset); 1818 MyGame_Example_TypeAliases.addVf64(builder, vf64Offset); 1819 return MyGame_Example_TypeAliases.endTypeAliases(builder); 1820} 1821 1822serialize():Uint8Array { 1823 return this.bb!.bytes(); 1824} 1825 1826static deserialize(buffer: Uint8Array):TypeAliases { 1827 return MyGame_Example_TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer)) 1828} 1829} 1830 1831