1// automatically generated by the FlatBuffers compiler, do not modify 2 3import * as flatbuffers from 'flatbuffers'; 4 5import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster'; 6import { Ability, AbilityT } from '../../my-game/example/ability'; 7import { Any, unionToAny, unionListToAny } from '../../my-game/example/any'; 8import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases'; 9import { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases'; 10import { Color } from '../../my-game/example/color'; 11import { Race } from '../../my-game/example/race'; 12import { Referrable, ReferrableT } from '../../my-game/example/referrable'; 13import { Stat, StatT } from '../../my-game/example/stat'; 14import { Test, TestT } from '../../my-game/example/test'; 15import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum'; 16import { Vec3, Vec3T } from '../../my-game/example/vec3'; 17import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-namespace'; 18 19 20/** 21 * an example documentation comment: "monster object" 22 */ 23export class Monster { 24 bb: flatbuffers.ByteBuffer|null = null; 25 bb_pos = 0; 26 __init(i:number, bb:flatbuffers.ByteBuffer):Monster { 27 this.bb_pos = i; 28 this.bb = bb; 29 return this; 30} 31 32static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster { 33 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 34} 35 36static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster { 37 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 38 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 39} 40 41static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { 42 return bb.__has_identifier('MONS'); 43} 44 45pos(obj?:Vec3):Vec3|null { 46 const offset = this.bb!.__offset(this.bb_pos, 4); 47 return offset ? (obj || new Vec3()).__init(this.bb_pos + offset, this.bb!) : null; 48} 49 50mana():number { 51 const offset = this.bb!.__offset(this.bb_pos, 6); 52 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 150; 53} 54 55mutate_mana(value:number):boolean { 56 const offset = this.bb!.__offset(this.bb_pos, 6); 57 58 if (offset === 0) { 59 return false; 60 } 61 62 this.bb!.writeInt16(this.bb_pos + offset, value); 63 return true; 64} 65 66hp():number { 67 const offset = this.bb!.__offset(this.bb_pos, 8); 68 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 100; 69} 70 71mutate_hp(value:number):boolean { 72 const offset = this.bb!.__offset(this.bb_pos, 8); 73 74 if (offset === 0) { 75 return false; 76 } 77 78 this.bb!.writeInt16(this.bb_pos + offset, value); 79 return true; 80} 81 82name():string|null 83name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 84name(optionalEncoding?:any):string|Uint8Array|null { 85 const offset = this.bb!.__offset(this.bb_pos, 10); 86 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 87} 88 89inventory(index: number):number|null { 90 const offset = this.bb!.__offset(this.bb_pos, 14); 91 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 92} 93 94inventoryLength():number { 95 const offset = this.bb!.__offset(this.bb_pos, 14); 96 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 97} 98 99inventoryArray():Uint8Array|null { 100 const offset = this.bb!.__offset(this.bb_pos, 14); 101 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; 102} 103 104color():Color { 105 const offset = this.bb!.__offset(this.bb_pos, 16); 106 return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Blue; 107} 108 109mutate_color(value:Color):boolean { 110 const offset = this.bb!.__offset(this.bb_pos, 16); 111 112 if (offset === 0) { 113 return false; 114 } 115 116 this.bb!.writeUint8(this.bb_pos + offset, value); 117 return true; 118} 119 120testType():Any { 121 const offset = this.bb!.__offset(this.bb_pos, 18); 122 return offset ? this.bb!.readUint8(this.bb_pos + offset) : Any.NONE; 123} 124 125test<T extends flatbuffers.Table>(obj:any):any|null { 126 const offset = this.bb!.__offset(this.bb_pos, 20); 127 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 128} 129 130test4(index: number, obj?:Test):Test|null { 131 const offset = this.bb!.__offset(this.bb_pos, 22); 132 return offset ? (obj || new Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null; 133} 134 135test4Length():number { 136 const offset = this.bb!.__offset(this.bb_pos, 22); 137 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 138} 139 140testarrayofstring(index: number):string 141testarrayofstring(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 142testarrayofstring(index: number,optionalEncoding?:any):string|Uint8Array|null { 143 const offset = this.bb!.__offset(this.bb_pos, 24); 144 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 145} 146 147testarrayofstringLength():number { 148 const offset = this.bb!.__offset(this.bb_pos, 24); 149 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 150} 151 152/** 153 * an example documentation comment: this will end up in the generated code 154 * multiline too 155 */ 156testarrayoftables(index: number, obj?:Monster):Monster|null { 157 const offset = this.bb!.__offset(this.bb_pos, 26); 158 return offset ? (obj || new Monster()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 159} 160 161testarrayoftablesLength():number { 162 const offset = this.bb!.__offset(this.bb_pos, 26); 163 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 164} 165 166enemy(obj?:Monster):Monster|null { 167 const offset = this.bb!.__offset(this.bb_pos, 28); 168 return offset ? (obj || new Monster()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 169} 170 171testnestedflatbuffer(index: number):number|null { 172 const offset = this.bb!.__offset(this.bb_pos, 30); 173 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 174} 175 176testnestedflatbufferLength():number { 177 const offset = this.bb!.__offset(this.bb_pos, 30); 178 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 179} 180 181testnestedflatbufferArray():Uint8Array|null { 182 const offset = this.bb!.__offset(this.bb_pos, 30); 183 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; 184} 185 186testempty(obj?:Stat):Stat|null { 187 const offset = this.bb!.__offset(this.bb_pos, 32); 188 return offset ? (obj || new Stat()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 189} 190 191testbool():boolean { 192 const offset = this.bb!.__offset(this.bb_pos, 34); 193 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 194} 195 196mutate_testbool(value:boolean):boolean { 197 const offset = this.bb!.__offset(this.bb_pos, 34); 198 199 if (offset === 0) { 200 return false; 201 } 202 203 this.bb!.writeInt8(this.bb_pos + offset, +value); 204 return true; 205} 206 207testhashs32Fnv1():number { 208 const offset = this.bb!.__offset(this.bb_pos, 36); 209 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; 210} 211 212mutate_testhashs32_fnv1(value:number):boolean { 213 const offset = this.bb!.__offset(this.bb_pos, 36); 214 215 if (offset === 0) { 216 return false; 217 } 218 219 this.bb!.writeInt32(this.bb_pos + offset, value); 220 return true; 221} 222 223testhashu32Fnv1():number { 224 const offset = this.bb!.__offset(this.bb_pos, 38); 225 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; 226} 227 228mutate_testhashu32_fnv1(value:number):boolean { 229 const offset = this.bb!.__offset(this.bb_pos, 38); 230 231 if (offset === 0) { 232 return false; 233 } 234 235 this.bb!.writeUint32(this.bb_pos + offset, value); 236 return true; 237} 238 239testhashs64Fnv1():bigint { 240 const offset = this.bb!.__offset(this.bb_pos, 40); 241 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 242} 243 244mutate_testhashs64_fnv1(value:bigint):boolean { 245 const offset = this.bb!.__offset(this.bb_pos, 40); 246 247 if (offset === 0) { 248 return false; 249 } 250 251 this.bb!.writeInt64(this.bb_pos + offset, value); 252 return true; 253} 254 255testhashu64Fnv1():bigint { 256 const offset = this.bb!.__offset(this.bb_pos, 42); 257 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 258} 259 260mutate_testhashu64_fnv1(value:bigint):boolean { 261 const offset = this.bb!.__offset(this.bb_pos, 42); 262 263 if (offset === 0) { 264 return false; 265 } 266 267 this.bb!.writeUint64(this.bb_pos + offset, value); 268 return true; 269} 270 271testhashs32Fnv1a():number { 272 const offset = this.bb!.__offset(this.bb_pos, 44); 273 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; 274} 275 276mutate_testhashs32_fnv1a(value:number):boolean { 277 const offset = this.bb!.__offset(this.bb_pos, 44); 278 279 if (offset === 0) { 280 return false; 281 } 282 283 this.bb!.writeInt32(this.bb_pos + offset, value); 284 return true; 285} 286 287testhashu32Fnv1a():number { 288 const offset = this.bb!.__offset(this.bb_pos, 46); 289 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; 290} 291 292mutate_testhashu32_fnv1a(value:number):boolean { 293 const offset = this.bb!.__offset(this.bb_pos, 46); 294 295 if (offset === 0) { 296 return false; 297 } 298 299 this.bb!.writeUint32(this.bb_pos + offset, value); 300 return true; 301} 302 303testhashs64Fnv1a():bigint { 304 const offset = this.bb!.__offset(this.bb_pos, 48); 305 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 306} 307 308mutate_testhashs64_fnv1a(value:bigint):boolean { 309 const offset = this.bb!.__offset(this.bb_pos, 48); 310 311 if (offset === 0) { 312 return false; 313 } 314 315 this.bb!.writeInt64(this.bb_pos + offset, value); 316 return true; 317} 318 319testhashu64Fnv1a():bigint { 320 const offset = this.bb!.__offset(this.bb_pos, 50); 321 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 322} 323 324mutate_testhashu64_fnv1a(value:bigint):boolean { 325 const offset = this.bb!.__offset(this.bb_pos, 50); 326 327 if (offset === 0) { 328 return false; 329 } 330 331 this.bb!.writeUint64(this.bb_pos + offset, value); 332 return true; 333} 334 335testarrayofbools(index: number):boolean|null { 336 const offset = this.bb!.__offset(this.bb_pos, 52); 337 return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false; 338} 339 340testarrayofboolsLength():number { 341 const offset = this.bb!.__offset(this.bb_pos, 52); 342 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 343} 344 345testarrayofboolsArray():Int8Array|null { 346 const offset = this.bb!.__offset(this.bb_pos, 52); 347 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; 348} 349 350testf():number { 351 const offset = this.bb!.__offset(this.bb_pos, 54); 352 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.14159; 353} 354 355mutate_testf(value:number):boolean { 356 const offset = this.bb!.__offset(this.bb_pos, 54); 357 358 if (offset === 0) { 359 return false; 360 } 361 362 this.bb!.writeFloat32(this.bb_pos + offset, value); 363 return true; 364} 365 366testf2():number { 367 const offset = this.bb!.__offset(this.bb_pos, 56); 368 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.0; 369} 370 371mutate_testf2(value:number):boolean { 372 const offset = this.bb!.__offset(this.bb_pos, 56); 373 374 if (offset === 0) { 375 return false; 376 } 377 378 this.bb!.writeFloat32(this.bb_pos + offset, value); 379 return true; 380} 381 382testf3():number { 383 const offset = this.bb!.__offset(this.bb_pos, 58); 384 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; 385} 386 387mutate_testf3(value:number):boolean { 388 const offset = this.bb!.__offset(this.bb_pos, 58); 389 390 if (offset === 0) { 391 return false; 392 } 393 394 this.bb!.writeFloat32(this.bb_pos + offset, value); 395 return true; 396} 397 398testarrayofstring2(index: number):string 399testarrayofstring2(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 400testarrayofstring2(index: number,optionalEncoding?:any):string|Uint8Array|null { 401 const offset = this.bb!.__offset(this.bb_pos, 60); 402 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 403} 404 405testarrayofstring2Length():number { 406 const offset = this.bb!.__offset(this.bb_pos, 60); 407 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 408} 409 410testarrayofsortedstruct(index: number, obj?:Ability):Ability|null { 411 const offset = this.bb!.__offset(this.bb_pos, 62); 412 return offset ? (obj || new Ability()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 8, this.bb!) : null; 413} 414 415testarrayofsortedstructLength():number { 416 const offset = this.bb!.__offset(this.bb_pos, 62); 417 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 418} 419 420flex(index: number):number|null { 421 const offset = this.bb!.__offset(this.bb_pos, 64); 422 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 423} 424 425flexLength():number { 426 const offset = this.bb!.__offset(this.bb_pos, 64); 427 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 428} 429 430flexArray():Uint8Array|null { 431 const offset = this.bb!.__offset(this.bb_pos, 64); 432 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; 433} 434 435test5(index: number, obj?:Test):Test|null { 436 const offset = this.bb!.__offset(this.bb_pos, 66); 437 return offset ? (obj || new Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null; 438} 439 440test5Length():number { 441 const offset = this.bb!.__offset(this.bb_pos, 66); 442 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 443} 444 445vectorOfLongs(index: number):bigint|null { 446 const offset = this.bb!.__offset(this.bb_pos, 68); 447 return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 448} 449 450vectorOfLongsLength():number { 451 const offset = this.bb!.__offset(this.bb_pos, 68); 452 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 453} 454 455vectorOfDoubles(index: number):number|null { 456 const offset = this.bb!.__offset(this.bb_pos, 70); 457 return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; 458} 459 460vectorOfDoublesLength():number { 461 const offset = this.bb!.__offset(this.bb_pos, 70); 462 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 463} 464 465vectorOfDoublesArray():Float64Array|null { 466 const offset = this.bb!.__offset(this.bb_pos, 70); 467 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; 468} 469 470parentNamespaceTest(obj?:InParentNamespace):InParentNamespace|null { 471 const offset = this.bb!.__offset(this.bb_pos, 72); 472 return offset ? (obj || new InParentNamespace()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 473} 474 475vectorOfReferrables(index: number, obj?:Referrable):Referrable|null { 476 const offset = this.bb!.__offset(this.bb_pos, 74); 477 return offset ? (obj || new Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 478} 479 480vectorOfReferrablesLength():number { 481 const offset = this.bb!.__offset(this.bb_pos, 74); 482 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 483} 484 485singleWeakReference():bigint { 486 const offset = this.bb!.__offset(this.bb_pos, 76); 487 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 488} 489 490mutate_single_weak_reference(value:bigint):boolean { 491 const offset = this.bb!.__offset(this.bb_pos, 76); 492 493 if (offset === 0) { 494 return false; 495 } 496 497 this.bb!.writeUint64(this.bb_pos + offset, value); 498 return true; 499} 500 501vectorOfWeakReferences(index: number):bigint|null { 502 const offset = this.bb!.__offset(this.bb_pos, 78); 503 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 504} 505 506vectorOfWeakReferencesLength():number { 507 const offset = this.bb!.__offset(this.bb_pos, 78); 508 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 509} 510 511vectorOfStrongReferrables(index: number, obj?:Referrable):Referrable|null { 512 const offset = this.bb!.__offset(this.bb_pos, 80); 513 return offset ? (obj || new Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 514} 515 516vectorOfStrongReferrablesLength():number { 517 const offset = this.bb!.__offset(this.bb_pos, 80); 518 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 519} 520 521coOwningReference():bigint { 522 const offset = this.bb!.__offset(this.bb_pos, 82); 523 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 524} 525 526mutate_co_owning_reference(value:bigint):boolean { 527 const offset = this.bb!.__offset(this.bb_pos, 82); 528 529 if (offset === 0) { 530 return false; 531 } 532 533 this.bb!.writeUint64(this.bb_pos + offset, value); 534 return true; 535} 536 537vectorOfCoOwningReferences(index: number):bigint|null { 538 const offset = this.bb!.__offset(this.bb_pos, 84); 539 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 540} 541 542vectorOfCoOwningReferencesLength():number { 543 const offset = this.bb!.__offset(this.bb_pos, 84); 544 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 545} 546 547nonOwningReference():bigint { 548 const offset = this.bb!.__offset(this.bb_pos, 86); 549 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 550} 551 552mutate_non_owning_reference(value:bigint):boolean { 553 const offset = this.bb!.__offset(this.bb_pos, 86); 554 555 if (offset === 0) { 556 return false; 557 } 558 559 this.bb!.writeUint64(this.bb_pos + offset, value); 560 return true; 561} 562 563vectorOfNonOwningReferences(index: number):bigint|null { 564 const offset = this.bb!.__offset(this.bb_pos, 88); 565 return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0); 566} 567 568vectorOfNonOwningReferencesLength():number { 569 const offset = this.bb!.__offset(this.bb_pos, 88); 570 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 571} 572 573anyUniqueType():AnyUniqueAliases { 574 const offset = this.bb!.__offset(this.bb_pos, 90); 575 return offset ? this.bb!.readUint8(this.bb_pos + offset) : AnyUniqueAliases.NONE; 576} 577 578anyUnique<T extends flatbuffers.Table>(obj:any):any|null { 579 const offset = this.bb!.__offset(this.bb_pos, 92); 580 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 581} 582 583anyAmbiguousType():AnyAmbiguousAliases { 584 const offset = this.bb!.__offset(this.bb_pos, 94); 585 return offset ? this.bb!.readUint8(this.bb_pos + offset) : AnyAmbiguousAliases.NONE; 586} 587 588anyAmbiguous<T extends flatbuffers.Table>(obj:any):any|null { 589 const offset = this.bb!.__offset(this.bb_pos, 96); 590 return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; 591} 592 593vectorOfEnums(index: number):Color|null { 594 const offset = this.bb!.__offset(this.bb_pos, 98); 595 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 596} 597 598vectorOfEnumsLength():number { 599 const offset = this.bb!.__offset(this.bb_pos, 98); 600 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 601} 602 603vectorOfEnumsArray():Uint8Array|null { 604 const offset = this.bb!.__offset(this.bb_pos, 98); 605 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; 606} 607 608signedEnum():Race { 609 const offset = this.bb!.__offset(this.bb_pos, 100); 610 return offset ? this.bb!.readInt8(this.bb_pos + offset) : Race.None; 611} 612 613mutate_signed_enum(value:Race):boolean { 614 const offset = this.bb!.__offset(this.bb_pos, 100); 615 616 if (offset === 0) { 617 return false; 618 } 619 620 this.bb!.writeInt8(this.bb_pos + offset, value); 621 return true; 622} 623 624testrequirednestedflatbuffer(index: number):number|null { 625 const offset = this.bb!.__offset(this.bb_pos, 102); 626 return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; 627} 628 629testrequirednestedflatbufferLength():number { 630 const offset = this.bb!.__offset(this.bb_pos, 102); 631 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 632} 633 634testrequirednestedflatbufferArray():Uint8Array|null { 635 const offset = this.bb!.__offset(this.bb_pos, 102); 636 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; 637} 638 639scalarKeySortedTables(index: number, obj?:Stat):Stat|null { 640 const offset = this.bb!.__offset(this.bb_pos, 104); 641 return offset ? (obj || new Stat()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 642} 643 644scalarKeySortedTablesLength():number { 645 const offset = this.bb!.__offset(this.bb_pos, 104); 646 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 647} 648 649nativeInline(obj?:Test):Test|null { 650 const offset = this.bb!.__offset(this.bb_pos, 106); 651 return offset ? (obj || new Test()).__init(this.bb_pos + offset, this.bb!) : null; 652} 653 654longEnumNonEnumDefault():bigint { 655 const offset = this.bb!.__offset(this.bb_pos, 108); 656 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); 657} 658 659mutate_long_enum_non_enum_default(value:bigint):boolean { 660 const offset = this.bb!.__offset(this.bb_pos, 108); 661 662 if (offset === 0) { 663 return false; 664 } 665 666 this.bb!.writeUint64(this.bb_pos + offset, value); 667 return true; 668} 669 670longEnumNormalDefault():bigint { 671 const offset = this.bb!.__offset(this.bb_pos, 110); 672 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('2'); 673} 674 675mutate_long_enum_normal_default(value:bigint):boolean { 676 const offset = this.bb!.__offset(this.bb_pos, 110); 677 678 if (offset === 0) { 679 return false; 680 } 681 682 this.bb!.writeUint64(this.bb_pos + offset, value); 683 return true; 684} 685 686static getFullyQualifiedName():string { 687 return 'MyGame_Example_Monster'; 688} 689 690static startMonster(builder:flatbuffers.Builder) { 691 builder.startObject(54); 692} 693 694static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) { 695 builder.addFieldStruct(0, posOffset, 0); 696} 697 698static addMana(builder:flatbuffers.Builder, mana:number) { 699 builder.addFieldInt16(1, mana, 150); 700} 701 702static addHp(builder:flatbuffers.Builder, hp:number) { 703 builder.addFieldInt16(2, hp, 100); 704} 705 706static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { 707 builder.addFieldOffset(3, nameOffset, 0); 708} 709 710static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) { 711 builder.addFieldOffset(5, inventoryOffset, 0); 712} 713 714static createInventoryVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 715 builder.startVector(1, data.length, 1); 716 for (let i = data.length - 1; i >= 0; i--) { 717 builder.addInt8(data[i]!); 718 } 719 return builder.endVector(); 720} 721 722static startInventoryVector(builder:flatbuffers.Builder, numElems:number) { 723 builder.startVector(1, numElems, 1); 724} 725 726static addColor(builder:flatbuffers.Builder, color:Color) { 727 builder.addFieldInt8(6, color, Color.Blue); 728} 729 730static addTestType(builder:flatbuffers.Builder, testType:Any) { 731 builder.addFieldInt8(7, testType, Any.NONE); 732} 733 734static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) { 735 builder.addFieldOffset(8, testOffset, 0); 736} 737 738static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) { 739 builder.addFieldOffset(9, test4Offset, 0); 740} 741 742static startTest4Vector(builder:flatbuffers.Builder, numElems:number) { 743 builder.startVector(4, numElems, 2); 744} 745 746static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) { 747 builder.addFieldOffset(10, testarrayofstringOffset, 0); 748} 749 750static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 751 builder.startVector(4, data.length, 4); 752 for (let i = data.length - 1; i >= 0; i--) { 753 builder.addOffset(data[i]!); 754 } 755 return builder.endVector(); 756} 757 758static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) { 759 builder.startVector(4, numElems, 4); 760} 761 762static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) { 763 builder.addFieldOffset(11, testarrayoftablesOffset, 0); 764} 765 766static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 767 builder.startVector(4, data.length, 4); 768 for (let i = data.length - 1; i >= 0; i--) { 769 builder.addOffset(data[i]!); 770 } 771 return builder.endVector(); 772} 773 774static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) { 775 builder.startVector(4, numElems, 4); 776} 777 778static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) { 779 builder.addFieldOffset(12, enemyOffset, 0); 780} 781 782static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) { 783 builder.addFieldOffset(13, testnestedflatbufferOffset, 0); 784} 785 786static createTestnestedflatbufferVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 787 builder.startVector(1, data.length, 1); 788 for (let i = data.length - 1; i >= 0; i--) { 789 builder.addInt8(data[i]!); 790 } 791 return builder.endVector(); 792} 793 794static startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) { 795 builder.startVector(1, numElems, 1); 796} 797 798static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) { 799 builder.addFieldOffset(14, testemptyOffset, 0); 800} 801 802static addTestbool(builder:flatbuffers.Builder, testbool:boolean) { 803 builder.addFieldInt8(15, +testbool, +false); 804} 805 806static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) { 807 builder.addFieldInt32(16, testhashs32Fnv1, 0); 808} 809 810static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) { 811 builder.addFieldInt32(17, testhashu32Fnv1, 0); 812} 813 814static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) { 815 builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0')); 816} 817 818static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) { 819 builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0')); 820} 821 822static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) { 823 builder.addFieldInt32(20, testhashs32Fnv1a, 0); 824} 825 826static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) { 827 builder.addFieldInt32(21, testhashu32Fnv1a, 0); 828} 829 830static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) { 831 builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0')); 832} 833 834static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) { 835 builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0')); 836} 837 838static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) { 839 builder.addFieldOffset(24, testarrayofboolsOffset, 0); 840} 841 842static createTestarrayofboolsVector(builder:flatbuffers.Builder, data:boolean[]):flatbuffers.Offset { 843 builder.startVector(1, data.length, 1); 844 for (let i = data.length - 1; i >= 0; i--) { 845 builder.addInt8(+data[i]!); 846 } 847 return builder.endVector(); 848} 849 850static startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) { 851 builder.startVector(1, numElems, 1); 852} 853 854static addTestf(builder:flatbuffers.Builder, testf:number) { 855 builder.addFieldFloat32(25, testf, 3.14159); 856} 857 858static addTestf2(builder:flatbuffers.Builder, testf2:number) { 859 builder.addFieldFloat32(26, testf2, 3.0); 860} 861 862static addTestf3(builder:flatbuffers.Builder, testf3:number) { 863 builder.addFieldFloat32(27, testf3, 0.0); 864} 865 866static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) { 867 builder.addFieldOffset(28, testarrayofstring2Offset, 0); 868} 869 870static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 871 builder.startVector(4, data.length, 4); 872 for (let i = data.length - 1; i >= 0; i--) { 873 builder.addOffset(data[i]!); 874 } 875 return builder.endVector(); 876} 877 878static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) { 879 builder.startVector(4, numElems, 4); 880} 881 882static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) { 883 builder.addFieldOffset(29, testarrayofsortedstructOffset, 0); 884} 885 886static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) { 887 builder.startVector(8, numElems, 4); 888} 889 890static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset) { 891 builder.addFieldOffset(30, flexOffset, 0); 892} 893 894static createFlexVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 895 builder.startVector(1, data.length, 1); 896 for (let i = data.length - 1; i >= 0; i--) { 897 builder.addInt8(data[i]!); 898 } 899 return builder.endVector(); 900} 901 902static startFlexVector(builder:flatbuffers.Builder, numElems:number) { 903 builder.startVector(1, numElems, 1); 904} 905 906static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset) { 907 builder.addFieldOffset(31, test5Offset, 0); 908} 909 910static startTest5Vector(builder:flatbuffers.Builder, numElems:number) { 911 builder.startVector(4, numElems, 2); 912} 913 914static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) { 915 builder.addFieldOffset(32, vectorOfLongsOffset, 0); 916} 917 918static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 919 builder.startVector(8, data.length, 8); 920 for (let i = data.length - 1; i >= 0; i--) { 921 builder.addInt64(data[i]!); 922 } 923 return builder.endVector(); 924} 925 926static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) { 927 builder.startVector(8, numElems, 8); 928} 929 930static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) { 931 builder.addFieldOffset(33, vectorOfDoublesOffset, 0); 932} 933 934static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; 935/** 936 * @deprecated This Uint8Array overload will be removed in the future. 937 */ 938static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; 939static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { 940 builder.startVector(8, data.length, 8); 941 for (let i = data.length - 1; i >= 0; i--) { 942 builder.addFloat64(data[i]!); 943 } 944 return builder.endVector(); 945} 946 947static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) { 948 builder.startVector(8, numElems, 8); 949} 950 951static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) { 952 builder.addFieldOffset(34, parentNamespaceTestOffset, 0); 953} 954 955static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset) { 956 builder.addFieldOffset(35, vectorOfReferrablesOffset, 0); 957} 958 959static createVectorOfReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 960 builder.startVector(4, data.length, 4); 961 for (let i = data.length - 1; i >= 0; i--) { 962 builder.addOffset(data[i]!); 963 } 964 return builder.endVector(); 965} 966 967static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number) { 968 builder.startVector(4, numElems, 4); 969} 970 971static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) { 972 builder.addFieldInt64(36, singleWeakReference, BigInt('0')); 973} 974 975static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) { 976 builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0); 977} 978 979static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 980 builder.startVector(8, data.length, 8); 981 for (let i = data.length - 1; i >= 0; i--) { 982 builder.addInt64(data[i]!); 983 } 984 return builder.endVector(); 985} 986 987static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number) { 988 builder.startVector(8, numElems, 8); 989} 990 991static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset) { 992 builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0); 993} 994 995static createVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 996 builder.startVector(4, data.length, 4); 997 for (let i = data.length - 1; i >= 0; i--) { 998 builder.addOffset(data[i]!); 999 } 1000 return builder.endVector(); 1001} 1002 1003static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number) { 1004 builder.startVector(4, numElems, 4); 1005} 1006 1007static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) { 1008 builder.addFieldInt64(39, coOwningReference, BigInt('0')); 1009} 1010 1011static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) { 1012 builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0); 1013} 1014 1015static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1016 builder.startVector(8, data.length, 8); 1017 for (let i = data.length - 1; i >= 0; i--) { 1018 builder.addInt64(data[i]!); 1019 } 1020 return builder.endVector(); 1021} 1022 1023static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) { 1024 builder.startVector(8, numElems, 8); 1025} 1026 1027static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) { 1028 builder.addFieldInt64(41, nonOwningReference, BigInt('0')); 1029} 1030 1031static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) { 1032 builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0); 1033} 1034 1035static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset { 1036 builder.startVector(8, data.length, 8); 1037 for (let i = data.length - 1; i >= 0; i--) { 1038 builder.addInt64(data[i]!); 1039 } 1040 return builder.endVector(); 1041} 1042 1043static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) { 1044 builder.startVector(8, numElems, 8); 1045} 1046 1047static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:AnyUniqueAliases) { 1048 builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE); 1049} 1050 1051static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) { 1052 builder.addFieldOffset(44, anyUniqueOffset, 0); 1053} 1054 1055static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:AnyAmbiguousAliases) { 1056 builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE); 1057} 1058 1059static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) { 1060 builder.addFieldOffset(46, anyAmbiguousOffset, 0); 1061} 1062 1063static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset) { 1064 builder.addFieldOffset(47, vectorOfEnumsOffset, 0); 1065} 1066 1067static createVectorOfEnumsVector(builder:flatbuffers.Builder, data:Color[]):flatbuffers.Offset { 1068 builder.startVector(1, data.length, 1); 1069 for (let i = data.length - 1; i >= 0; i--) { 1070 builder.addInt8(data[i]!); 1071 } 1072 return builder.endVector(); 1073} 1074 1075static startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number) { 1076 builder.startVector(1, numElems, 1); 1077} 1078 1079static addSignedEnum(builder:flatbuffers.Builder, signedEnum:Race) { 1080 builder.addFieldInt8(48, signedEnum, Race.None); 1081} 1082 1083static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset) { 1084 builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0); 1085} 1086 1087static createTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { 1088 builder.startVector(1, data.length, 1); 1089 for (let i = data.length - 1; i >= 0; i--) { 1090 builder.addInt8(data[i]!); 1091 } 1092 return builder.endVector(); 1093} 1094 1095static startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) { 1096 builder.startVector(1, numElems, 1); 1097} 1098 1099static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset) { 1100 builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0); 1101} 1102 1103static createScalarKeySortedTablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 1104 builder.startVector(4, data.length, 4); 1105 for (let i = data.length - 1; i >= 0; i--) { 1106 builder.addOffset(data[i]!); 1107 } 1108 return builder.endVector(); 1109} 1110 1111static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number) { 1112 builder.startVector(4, numElems, 4); 1113} 1114 1115static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset) { 1116 builder.addFieldStruct(51, nativeInlineOffset, 0); 1117} 1118 1119static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint) { 1120 builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0')); 1121} 1122 1123static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint) { 1124 builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2')); 1125} 1126 1127static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset { 1128 const offset = builder.endObject(); 1129 builder.requiredField(offset, 10) // name 1130 return offset; 1131} 1132 1133static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { 1134 builder.finish(offset, 'MONS'); 1135} 1136 1137static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { 1138 builder.finish(offset, 'MONS', true); 1139} 1140 1141 1142serialize():Uint8Array { 1143 return this.bb!.bytes(); 1144} 1145 1146static deserialize(buffer: Uint8Array):Monster { 1147 return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer)) 1148} 1149 1150unpack(): MonsterT { 1151 return new MonsterT( 1152 (this.pos() !== null ? this.pos()!.unpack() : null), 1153 this.mana(), 1154 this.hp(), 1155 this.name(), 1156 this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()), 1157 this.color(), 1158 this.testType(), 1159 (() => { 1160 let temp = unionToAny(this.testType(), this.test.bind(this)); 1161 if(temp === null) { return null; } 1162 return temp.unpack() 1163 })(), 1164 this.bb!.createObjList(this.test4.bind(this), this.test4Length()), 1165 this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), 1166 this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), 1167 (this.enemy() !== null ? this.enemy()!.unpack() : null), 1168 this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), 1169 (this.testempty() !== null ? this.testempty()!.unpack() : null), 1170 this.testbool(), 1171 this.testhashs32Fnv1(), 1172 this.testhashu32Fnv1(), 1173 this.testhashs64Fnv1(), 1174 this.testhashu64Fnv1(), 1175 this.testhashs32Fnv1a(), 1176 this.testhashu32Fnv1a(), 1177 this.testhashs64Fnv1a(), 1178 this.testhashu64Fnv1a(), 1179 this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), 1180 this.testf(), 1181 this.testf2(), 1182 this.testf3(), 1183 this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), 1184 this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), 1185 this.bb!.createScalarList(this.flex.bind(this), this.flexLength()), 1186 this.bb!.createObjList(this.test5.bind(this), this.test5Length()), 1187 this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), 1188 this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), 1189 (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null), 1190 this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), 1191 this.singleWeakReference(), 1192 this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), 1193 this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), 1194 this.coOwningReference(), 1195 this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), 1196 this.nonOwningReference(), 1197 this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), 1198 this.anyUniqueType(), 1199 (() => { 1200 let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); 1201 if(temp === null) { return null; } 1202 return temp.unpack() 1203 })(), 1204 this.anyAmbiguousType(), 1205 (() => { 1206 let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); 1207 if(temp === null) { return null; } 1208 return temp.unpack() 1209 })(), 1210 this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), 1211 this.signedEnum(), 1212 this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), 1213 this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), 1214 (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null), 1215 this.longEnumNonEnumDefault(), 1216 this.longEnumNormalDefault() 1217 ); 1218} 1219 1220 1221unpackTo(_o: MonsterT): void { 1222 _o.pos = (this.pos() !== null ? this.pos()!.unpack() : null); 1223 _o.mana = this.mana(); 1224 _o.hp = this.hp(); 1225 _o.name = this.name(); 1226 _o.inventory = this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()); 1227 _o.color = this.color(); 1228 _o.testType = this.testType(); 1229 _o.test = (() => { 1230 let temp = unionToAny(this.testType(), this.test.bind(this)); 1231 if(temp === null) { return null; } 1232 return temp.unpack() 1233 })(); 1234 _o.test4 = this.bb!.createObjList(this.test4.bind(this), this.test4Length()); 1235 _o.testarrayofstring = this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()); 1236 _o.testarrayoftables = this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()); 1237 _o.enemy = (this.enemy() !== null ? this.enemy()!.unpack() : null); 1238 _o.testnestedflatbuffer = this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()); 1239 _o.testempty = (this.testempty() !== null ? this.testempty()!.unpack() : null); 1240 _o.testbool = this.testbool(); 1241 _o.testhashs32Fnv1 = this.testhashs32Fnv1(); 1242 _o.testhashu32Fnv1 = this.testhashu32Fnv1(); 1243 _o.testhashs64Fnv1 = this.testhashs64Fnv1(); 1244 _o.testhashu64Fnv1 = this.testhashu64Fnv1(); 1245 _o.testhashs32Fnv1a = this.testhashs32Fnv1a(); 1246 _o.testhashu32Fnv1a = this.testhashu32Fnv1a(); 1247 _o.testhashs64Fnv1a = this.testhashs64Fnv1a(); 1248 _o.testhashu64Fnv1a = this.testhashu64Fnv1a(); 1249 _o.testarrayofbools = this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()); 1250 _o.testf = this.testf(); 1251 _o.testf2 = this.testf2(); 1252 _o.testf3 = this.testf3(); 1253 _o.testarrayofstring2 = this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()); 1254 _o.testarrayofsortedstruct = this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()); 1255 _o.flex = this.bb!.createScalarList(this.flex.bind(this), this.flexLength()); 1256 _o.test5 = this.bb!.createObjList(this.test5.bind(this), this.test5Length()); 1257 _o.vectorOfLongs = this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()); 1258 _o.vectorOfDoubles = this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()); 1259 _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null); 1260 _o.vectorOfReferrables = this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()); 1261 _o.singleWeakReference = this.singleWeakReference(); 1262 _o.vectorOfWeakReferences = this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()); 1263 _o.vectorOfStrongReferrables = this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()); 1264 _o.coOwningReference = this.coOwningReference(); 1265 _o.vectorOfCoOwningReferences = this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()); 1266 _o.nonOwningReference = this.nonOwningReference(); 1267 _o.vectorOfNonOwningReferences = this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()); 1268 _o.anyUniqueType = this.anyUniqueType(); 1269 _o.anyUnique = (() => { 1270 let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); 1271 if(temp === null) { return null; } 1272 return temp.unpack() 1273 })(); 1274 _o.anyAmbiguousType = this.anyAmbiguousType(); 1275 _o.anyAmbiguous = (() => { 1276 let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); 1277 if(temp === null) { return null; } 1278 return temp.unpack() 1279 })(); 1280 _o.vectorOfEnums = this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()); 1281 _o.signedEnum = this.signedEnum(); 1282 _o.testrequirednestedflatbuffer = this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()); 1283 _o.scalarKeySortedTables = this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()); 1284 _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null); 1285 _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault(); 1286 _o.longEnumNormalDefault = this.longEnumNormalDefault(); 1287} 1288} 1289 1290export class MonsterT { 1291constructor( 1292 public pos: Vec3T|null = null, 1293 public mana: number = 150, 1294 public hp: number = 100, 1295 public name: string|Uint8Array|null = null, 1296 public inventory: (number)[] = [], 1297 public color: Color = Color.Blue, 1298 public testType: Any = Any.NONE, 1299 public test: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null, 1300 public test4: (TestT)[] = [], 1301 public testarrayofstring: (string)[] = [], 1302 public testarrayoftables: (MonsterT)[] = [], 1303 public enemy: MonsterT|null = null, 1304 public testnestedflatbuffer: (number)[] = [], 1305 public testempty: StatT|null = null, 1306 public testbool: boolean = false, 1307 public testhashs32Fnv1: number = 0, 1308 public testhashu32Fnv1: number = 0, 1309 public testhashs64Fnv1: bigint = BigInt('0'), 1310 public testhashu64Fnv1: bigint = BigInt('0'), 1311 public testhashs32Fnv1a: number = 0, 1312 public testhashu32Fnv1a: number = 0, 1313 public testhashs64Fnv1a: bigint = BigInt('0'), 1314 public testhashu64Fnv1a: bigint = BigInt('0'), 1315 public testarrayofbools: (boolean)[] = [], 1316 public testf: number = 3.14159, 1317 public testf2: number = 3.0, 1318 public testf3: number = 0.0, 1319 public testarrayofstring2: (string)[] = [], 1320 public testarrayofsortedstruct: (AbilityT)[] = [], 1321 public flex: (number)[] = [], 1322 public test5: (TestT)[] = [], 1323 public vectorOfLongs: (bigint)[] = [], 1324 public vectorOfDoubles: (number)[] = [], 1325 public parentNamespaceTest: InParentNamespaceT|null = null, 1326 public vectorOfReferrables: (ReferrableT)[] = [], 1327 public singleWeakReference: bigint = BigInt('0'), 1328 public vectorOfWeakReferences: (bigint)[] = [], 1329 public vectorOfStrongReferrables: (ReferrableT)[] = [], 1330 public coOwningReference: bigint = BigInt('0'), 1331 public vectorOfCoOwningReferences: (bigint)[] = [], 1332 public nonOwningReference: bigint = BigInt('0'), 1333 public vectorOfNonOwningReferences: (bigint)[] = [], 1334 public anyUniqueType: AnyUniqueAliases = AnyUniqueAliases.NONE, 1335 public anyUnique: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null, 1336 public anyAmbiguousType: AnyAmbiguousAliases = AnyAmbiguousAliases.NONE, 1337 public anyAmbiguous: MonsterT|null = null, 1338 public vectorOfEnums: (Color)[] = [], 1339 public signedEnum: Race = Race.None, 1340 public testrequirednestedflatbuffer: (number)[] = [], 1341 public scalarKeySortedTables: (StatT)[] = [], 1342 public nativeInline: TestT|null = null, 1343 public longEnumNonEnumDefault: bigint = BigInt('0'), 1344 public longEnumNormalDefault: bigint = BigInt('2') 1345){} 1346 1347 1348pack(builder:flatbuffers.Builder): flatbuffers.Offset { 1349 const name = (this.name !== null ? builder.createString(this.name!) : 0); 1350 const inventory = Monster.createInventoryVector(builder, this.inventory); 1351 const test = builder.createObjectOffset(this.test); 1352 const test4 = builder.createStructOffsetList(this.test4, Monster.startTest4Vector); 1353 const testarrayofstring = Monster.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring)); 1354 const testarrayoftables = Monster.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables)); 1355 const enemy = (this.enemy !== null ? this.enemy!.pack(builder) : 0); 1356 const testnestedflatbuffer = Monster.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer); 1357 const testempty = (this.testempty !== null ? this.testempty!.pack(builder) : 0); 1358 const testarrayofbools = Monster.createTestarrayofboolsVector(builder, this.testarrayofbools); 1359 const testarrayofstring2 = Monster.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2)); 1360 const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster.startTestarrayofsortedstructVector); 1361 const flex = Monster.createFlexVector(builder, this.flex); 1362 const test5 = builder.createStructOffsetList(this.test5, Monster.startTest5Vector); 1363 const vectorOfLongs = Monster.createVectorOfLongsVector(builder, this.vectorOfLongs); 1364 const vectorOfDoubles = Monster.createVectorOfDoublesVector(builder, this.vectorOfDoubles); 1365 const parentNamespaceTest = (this.parentNamespaceTest !== null ? this.parentNamespaceTest!.pack(builder) : 0); 1366 const vectorOfReferrables = Monster.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables)); 1367 const vectorOfWeakReferences = Monster.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences); 1368 const vectorOfStrongReferrables = Monster.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables)); 1369 const vectorOfCoOwningReferences = Monster.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences); 1370 const vectorOfNonOwningReferences = Monster.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences); 1371 const anyUnique = builder.createObjectOffset(this.anyUnique); 1372 const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous); 1373 const vectorOfEnums = Monster.createVectorOfEnumsVector(builder, this.vectorOfEnums); 1374 const testrequirednestedflatbuffer = Monster.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer); 1375 const scalarKeySortedTables = Monster.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables)); 1376 1377 Monster.startMonster(builder); 1378 Monster.addPos(builder, (this.pos !== null ? this.pos!.pack(builder) : 0)); 1379 Monster.addMana(builder, this.mana); 1380 Monster.addHp(builder, this.hp); 1381 Monster.addName(builder, name); 1382 Monster.addInventory(builder, inventory); 1383 Monster.addColor(builder, this.color); 1384 Monster.addTestType(builder, this.testType); 1385 Monster.addTest(builder, test); 1386 Monster.addTest4(builder, test4); 1387 Monster.addTestarrayofstring(builder, testarrayofstring); 1388 Monster.addTestarrayoftables(builder, testarrayoftables); 1389 Monster.addEnemy(builder, enemy); 1390 Monster.addTestnestedflatbuffer(builder, testnestedflatbuffer); 1391 Monster.addTestempty(builder, testempty); 1392 Monster.addTestbool(builder, this.testbool); 1393 Monster.addTesthashs32Fnv1(builder, this.testhashs32Fnv1); 1394 Monster.addTesthashu32Fnv1(builder, this.testhashu32Fnv1); 1395 Monster.addTesthashs64Fnv1(builder, this.testhashs64Fnv1); 1396 Monster.addTesthashu64Fnv1(builder, this.testhashu64Fnv1); 1397 Monster.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a); 1398 Monster.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a); 1399 Monster.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a); 1400 Monster.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a); 1401 Monster.addTestarrayofbools(builder, testarrayofbools); 1402 Monster.addTestf(builder, this.testf); 1403 Monster.addTestf2(builder, this.testf2); 1404 Monster.addTestf3(builder, this.testf3); 1405 Monster.addTestarrayofstring2(builder, testarrayofstring2); 1406 Monster.addTestarrayofsortedstruct(builder, testarrayofsortedstruct); 1407 Monster.addFlex(builder, flex); 1408 Monster.addTest5(builder, test5); 1409 Monster.addVectorOfLongs(builder, vectorOfLongs); 1410 Monster.addVectorOfDoubles(builder, vectorOfDoubles); 1411 Monster.addParentNamespaceTest(builder, parentNamespaceTest); 1412 Monster.addVectorOfReferrables(builder, vectorOfReferrables); 1413 Monster.addSingleWeakReference(builder, this.singleWeakReference); 1414 Monster.addVectorOfWeakReferences(builder, vectorOfWeakReferences); 1415 Monster.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables); 1416 Monster.addCoOwningReference(builder, this.coOwningReference); 1417 Monster.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences); 1418 Monster.addNonOwningReference(builder, this.nonOwningReference); 1419 Monster.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences); 1420 Monster.addAnyUniqueType(builder, this.anyUniqueType); 1421 Monster.addAnyUnique(builder, anyUnique); 1422 Monster.addAnyAmbiguousType(builder, this.anyAmbiguousType); 1423 Monster.addAnyAmbiguous(builder, anyAmbiguous); 1424 Monster.addVectorOfEnums(builder, vectorOfEnums); 1425 Monster.addSignedEnum(builder, this.signedEnum); 1426 Monster.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer); 1427 Monster.addScalarKeySortedTables(builder, scalarKeySortedTables); 1428 Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline!.pack(builder) : 0)); 1429 Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault); 1430 Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault); 1431 1432 return Monster.endMonster(builder); 1433} 1434} 1435