本文整理汇总了Python中direct.distributed.PyDatagram.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.getMessage方法的具体用法?Python PyDatagram.getMessage怎么用?Python PyDatagram.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.distributed.PyDatagram
的用法示例。
在下文中一共展示了PyDatagram.getMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [as 别名]
def enterSetAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# First, give them a POSTREMOVE to unload the avatar, just in case they
# disconnect while we're working.
dgcleanup = PyDatagram()
dgcleanup.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
dgcleanup.addUint32(self.avId)
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
dg.addString(dgcleanup.getMessage())
self.csm.air.send(dg)
# Get the avatar's "true" access. (without "server" bit)
adminAccess = self.account.get('ADMIN_ACCESS', 0)
adminAccess = adminAccess - adminAccess % 100
# Activate the avatar on the DBSS:
self.csm.air.sendActivate(self.avId, 0, 0,
self.csm.air.dclassesByName['DistributedToonUD'],
{'setAdminAccess': [self.account.get('ADMIN_ACCESS', 0)]})
# Next, add them to the avatar channel:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_OPEN_CHANNEL)
dg.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(dg)
# Now set their sender channel to represent their account affiliation:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
dg.addChannel(self.target<<32 | self.avId) # accountId in high 32 bits, avatar in low
self.csm.air.send(dg)
# Finally, grant ownership and shut down.
dg = PyDatagram()
dg.addServerHeader(self.avId, self.csm.air.ourChannel, STATESERVER_OBJECT_SET_OWNER)
dg.addChannel(self.csm.GetAccountConnectionChannel(self.target)) # Set ownership channel to the connection's account channel.
self.csm.air.send(dg)
# Tell the GlobalPartyManager as well:
self.csm.air.globalPartyMgr.avatarJoined(self.avId)
# Tell everything that an avatar is coming online!
friendsList = [x for x, y in self.avatar['setFriendsList'][0]]
self.csm.air.netMessenger.send('avatarOnline', [self.avId, friendsList])
# Post-remove for an avatar that disconnects unexpectedly.
dgcleanup = self.csm.air.netMessenger.prepare('avatarOffline', [self.avId])
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
dg.addString(dgcleanup.getMessage())
self.csm.air.send(dg)
self.csm.air.writeServerEvent('avatar-chosen', avId=self.avId, accId=self.target)
self.demand('Off')
示例2: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [as 别名]
def enterSetAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# First, give them a POSTREMOVE to unload the avatar, just in case they
# disconnect while we're working.
datagramCleanup = PyDatagram()
datagramCleanup.addServerHeader(
self.avId,
channel,
STATESERVER_OBJECT_DELETE_RAM)
datagramCleanup.addUint32(self.avId)
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_ADD_POST_REMOVE)
datagram.addString(datagramCleanup.getMessage())
self.csm.air.send(datagram)
# Activate the avatar on the DBSS:
self.csm.air.sendActivate(
self.avId, 0, 0, self.csm.air.dclassesByName['DistributedToonUD'],
{'setAdminAccess': [self.account.get('ACCESS_LEVEL', 100)]})
# Next, add them to the avatar channel:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_OPEN_CHANNEL)
datagram.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(datagram)
# Now set their sender channel to represent their account affiliation:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_SET_CLIENT_ID)
datagram.addChannel(self.target<<32 | self.avId)
self.csm.air.send(datagram)
# Finally, grant ownership and shut down.
datagram = PyDatagram()
datagram.addServerHeader(
self.avId,
self.csm.air.ourChannel,
STATESERVER_OBJECT_SET_OWNER)
datagram.addChannel(self.target<<32 | self.avId)
self.csm.air.send(datagram)
# Tell TTRFriendsManager somebody is logging in:
self.csm.air.friendsManager.toonOnline(self.avId, self.avatar)
# Tell the GlobalPartyManager as well:
self.csm.air.globalPartyMgr.avatarJoined(self.avId)
self.csm.air.writeServerEvent('avatarChosen', self.avId, self.target)
self.demand('Off')
示例3: doUpdate
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [as 别名]
def doUpdate(self, updateType, data):
self.heartbeat()
if updateType == "inv":
return # rip crash
dg = PyDatagram()
dg.addUint8(0)
dg.addString(updateType)
dg.appendData(data)
self.setShardData(dg.getMessage())
示例4: packGardenData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [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()
示例5: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [as 别名]
def enterSetAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# First, give them a POSTREMOVE to unload the avatar, just in case they
# disconnect while we're working.
datagramCleanup = PyDatagram()
datagramCleanup.addServerHeader(
self.avId,
channel,
STATESERVER_OBJECT_DELETE_RAM)
datagramCleanup.addUint32(self.avId)
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_ADD_POST_REMOVE)
datagram.addString(datagramCleanup.getMessage())
self.csm.air.send(datagram)
# Activate the avatar on the DBSS:
self.csm.air.sendActivate(
self.avId, 0, 0, self.csm.air.dclassesByName['DistributedToonUD'],
{'setAdminAccess': [self.account.get('ACCESS_LEVEL', 100)],
'setBankMoney': [self.account.get('MONEY', 0)]})
# Next, add them to the avatar channel:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_OPEN_CHANNEL)
datagram.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(datagram)
# Now set their sender channel to represent their account affiliation:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_SET_CLIENT_ID)
datagram.addChannel(self.target<<32 | self.avId)
self.csm.air.send(datagram)
# Eliminate race conditions.
taskMgr.doMethodLater(0.2, self.enterSetAvatarTask,
'avatarTask-%s' % self.avId, extraArgs=[channel],
appendTask=True)
示例6: d_updateBlock
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [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
示例7: d_setShardData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [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
示例8: d_updateInvasion
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import getMessage [as 别名]
def d_updateInvasion(self):
dg = PyDatagram()
self.writeInvasion(dg)
self.sendUpdate("doUpdate", ["inv", dg.getMessage()])
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:6,代码来源:ShardAPIManagerAI.py