...
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 InitFromPackedBuf(cls, buf, pos=0):
47 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
48 return cls.InitFromBuf(buf, pos+n)
49
50 @classmethod
51 def InitFromObj(cls, ability):
52 x = AbilityT()
53 x._UnPack(ability)
54 return x
55
56 # AbilityT
57 def _UnPack(self, ability):
58 if ability is None:
59 return
60 self.id = ability.Id()
61 self.distance = ability.Distance()
62
63 # AbilityT
64 def Pack(self, builder):
65 return CreateAbility(builder, self.id, self.distance)
View as plain text