本文整理汇总了Python中direct.distributed.PyDatagram.addInt8方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.addInt8方法的具体用法?Python PyDatagram.addInt8怎么用?Python PyDatagram.addInt8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.distributed.PyDatagram
的用法示例。
在下文中一共展示了PyDatagram.addInt8方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: packGardenData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addInt8 [as 别名]
def packGardenData(plants, statuary, started = True):
dg = PyDatagram()
for plant in plants:
a, b, c, d, e = plant
dg.addUint32(a)
dg.addInt8(b)
dg.addUint32(c)
dg.addInt8(d)
dg.addUint16(e)
dg.addUint8(statuary)
dg.addBool(started)
return dg.getMessage()
示例2: d_updateBlock
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addInt8 [as 别名]
def d_updateBlock(self, bldg):
if not bldg in self.bldgs:
return
data = bldg.getPickleData()
dg = PyDatagram()
dg.addUint16(bldg.zoneId - (bldg.zoneId % 1000))
dg.addUint16(bldg.zoneId)
dg.addUint8(int(data['block']))
state = data['state'].lower()
if state.startswith('clear'):
state = 'cogdo' if state.endswith('cogdo') else 'suit'
dg.addString(state)
dg.addUint8(ord(data['track']))
dg.addUint8(int(data['difficulty']))
dg.addInt8(int(data['numFloors']))
self.sendUpdate("doUpdate", ["block", dg.getMessage()])
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:25,代码来源:ShardAPIManagerAI.py
示例3: d_setShardData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addInt8 [as 别名]
def d_setShardData(self):
dg = PyDatagram()
self.context += 1
self.context %= 200
dg.addUint8(self.context)
buildings = self.air.doFindAllInstances(DistributedBuildingAI.DistributedBuildingAI)
for bldg in buildings:
if bldg.__class__ in (DistributedBuildingAI.DistributedBuildingAI, DistributedAnimBuildingAI.DistributedAnimBuildingAI):
if not bldg.zoneId % 1000:
# sz bldg, ignore
continue
if bldg.zoneId // 1000 == 7:
# ff bldg, ignore now
continue
data = bldg.getPickleData()
dg.addString("block")
dg.addUint16(bldg.zoneId - (bldg.zoneId % 1000))
dg.addUint16(bldg.zoneId)
dg.addUint8(int(data['block']))
dg.addString(data['state'].lower())
dg.addUint8(ord(data['track']))
dg.addUint8(int(data['difficulty']))
dg.addInt8(int(data['numFloors']))
self.bldgs.add(bldg)
self.writeInvasion(dg)
self.sendUpdate("setShardData", [dg.getMessage()])
self.air.notify.info("Sent shard data to UD")
taskMgr.doMethodLater(60, self.__timeout, 'UD-sync-timeout')
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:38,代码来源:ShardAPIManagerAI.py