• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: Example
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class Ability(object):
10    __slots__ = ['_tab']
11
12    @classmethod
13    def SizeOf(cls):
14        return 8
15
16    # Ability
17    def Init(self, buf, pos):
18        self._tab = flatbuffers.table.Table(buf, pos)
19
20    # Ability
21    def Id(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
22    # Ability
23    def Distance(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
24
25def CreateAbility(builder, id, distance):
26    builder.Prep(4, 8)
27    builder.PrependUint32(distance)
28    builder.PrependUint32(id)
29    return builder.Offset()
30
31
32class AbilityT(object):
33
34    # AbilityT
35    def __init__(self):
36        self.id = 0  # type: int
37        self.distance = 0  # type: int
38
39    @classmethod
40    def InitFromBuf(cls, buf, pos):
41        ability = Ability()
42        ability.Init(buf, pos)
43        return cls.InitFromObj(ability)
44
45    @classmethod
46    def InitFromObj(cls, ability):
47        x = AbilityT()
48        x._UnPack(ability)
49        return x
50
51    # AbilityT
52    def _UnPack(self, ability):
53        if ability is None:
54            return
55        self.id = ability.Id()
56        self.distance = ability.Distance()
57
58    # AbilityT
59    def Pack(self, builder):
60        return CreateAbility(builder, self.id, self.distance)
61