xref: /aosp_15_r20/external/flatbuffers/tests/my-game/example/ability.ts (revision 890232f25432b36107d06881e0a25aaa6b473652)
1// automatically generated by the FlatBuffers compiler, do not modify
2
3import * as flatbuffers from 'flatbuffers';
4
5
6
7export class Ability {
8  bb: flatbuffers.ByteBuffer|null = null;
9  bb_pos = 0;
10  __init(i:number, bb:flatbuffers.ByteBuffer):Ability {
11  this.bb_pos = i;
12  this.bb = bb;
13  return this;
14}
15
16id():number {
17  return this.bb!.readUint32(this.bb_pos);
18}
19
20mutate_id(value:number):boolean {
21  this.bb!.writeUint32(this.bb_pos + 0, value);
22  return true;
23}
24
25distance():number {
26  return this.bb!.readUint32(this.bb_pos + 4);
27}
28
29mutate_distance(value:number):boolean {
30  this.bb!.writeUint32(this.bb_pos + 4, value);
31  return true;
32}
33
34static getFullyQualifiedName():string {
35  return 'MyGame_Example_Ability';
36}
37
38static sizeOf():number {
39  return 8;
40}
41
42static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset {
43  builder.prep(4, 8);
44  builder.writeInt32(distance);
45  builder.writeInt32(id);
46  return builder.offset();
47}
48
49
50unpack(): AbilityT {
51  return new AbilityT(
52    this.id(),
53    this.distance()
54  );
55}
56
57
58unpackTo(_o: AbilityT): void {
59  _o.id = this.id();
60  _o.distance = this.distance();
61}
62}
63
64export class AbilityT {
65constructor(
66  public id: number = 0,
67  public distance: number = 0
68){}
69
70
71pack(builder:flatbuffers.Builder): flatbuffers.Offset {
72  return Ability.createAbility(builder,
73    this.id,
74    this.distance
75  );
76}
77}
78