本文整理汇总了Python中direct.distributed.PyDatagram.addUint32方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.addUint32方法的具体用法?Python PyDatagram.addUint32怎么用?Python PyDatagram.addUint32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.distributed.PyDatagram
的用法示例。
在下文中一共展示了PyDatagram.addUint32方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enterUnloadAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def enterUnloadAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# Tell FriendsManager somebody is logging off:
self.csm.air.friendsManager.toonOffline(self.avId)
# Clear off POSTREMOVE:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLEAR_POST_REMOVES)
self.csm.air.send(dg)
# Remove avatar channel:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLOSE_CHANNEL)
dg.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(dg)
# Reset sender channel:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
dg.addChannel(self.target<<32) # accountId in high 32 bits, no avatar in low
self.csm.air.send(dg)
# Unload avatar object:
dg = PyDatagram()
dg.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
dg.addUint32(self.avId)
self.csm.air.send(dg)
# Done!
self.csm.air.writeServerEvent('avatarUnload', self.avId)
self.demand('Off')
示例2: enterUnloadAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def enterUnloadAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# Fire off the avatarOffline message.
self.csm.air.netMessenger.send("avatarOffline", [self.avId])
# Get lost, POST_REMOVES!:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLEAR_POST_REMOVES)
self.csm.air.send(dg)
# Remove avatar channel:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLOSE_CHANNEL)
dg.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(dg)
# Reset sender channel:
dg = PyDatagram()
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
dg.addChannel(self.target << 32) # accountId in high 32 bits, no avatar in low
self.csm.air.send(dg)
# Unload avatar object:
dg = PyDatagram()
dg.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
dg.addUint32(self.avId)
self.csm.air.send(dg)
# Done!
self.csm.air.writeServerEvent("avatar-unload", avId=self.avId)
self.demand("Off")
示例3: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [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')
示例4: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [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')
示例5: __ready
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def __ready(self):
dg = PyDatagram()
dg.addServerHeader(self.districtStats.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
dg.addUint32(self.districtStats.doId)
self.addPostRemove(dg)
self.apiMgr = self.generateGlobalObject(100001, "ShardAPIManager")
self.apiMgr.start()
self.apiMgr.d_setShardData()
self.banMgr = self.generateGlobalObject(100002, "BanManager")
示例6: packGardenData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [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()
示例7: enterSetAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [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)
示例8: __offlineToonOnline
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def __offlineToonOnline(self, avId, activated, otherId=None, accId=None):
if not (otherId and activated and accId):
return
# Undeclare to the friend!
dg = PyDatagram()
dg.addServerHeader(self.GetPuppetConnectionChannel(avId), self.air.ourChannel, CLIENTAGENT_UNDECLARE_OBJECT)
dg.addUint32(otherId)
self.air.send(dg)
# Undeclare to our now-offline avId (they may still be around, about to log into a new toon!)
dg = PyDatagram()
dg.addServerHeader(self.GetAccountConnectionChannel(accId), self.air.ourChannel, CLIENTAGENT_UNDECLARE_OBJECT)
dg.addUint32(avId)
self.air.send(dg)
# Tell them they're offline!
self.sendUpdateToAvatarId(avId, 'friendOffline', [otherId])
示例9: __comingOnlineFriendOnline
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def __comingOnlineFriendOnline(self, avId, activated, otherId=None):
if not (otherId and activated):
#??!?!?
return
# Declare our avatar to their friend.
dg = PyDatagram()
dg.addServerHeader(self.GetPuppetConnectionChannel(avId), self.air.ourChannel, CLIENTAGENT_DECLARE_OBJECT)
dg.addUint32(otherId)
dg.addUint16(self.air.dclassesByName['DistributedToonUD'].getNumber())
self.air.send(dg)
# Declare the friend to the avatar.
dg = PyDatagram()
dg.addServerHeader(self.GetPuppetConnectionChannel(otherId), self.air.ourChannel, CLIENTAGENT_DECLARE_OBJECT)
dg.addUint32(avId)
dg.addUint16(self.air.dclassesByName['DistributedToonUD'].getNumber())
self.air.send(dg)
# Tell the client their friend is online.
self.sendUpdateToAvatarId(avId, 'friendOnline', [otherId, 0, 0])
示例10: enterUnloadAvatar
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def enterUnloadAvatar(self):
channel = self.csm.GetAccountConnectionChannel(self.target)
# Clear off POSTREMOVE:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_CLEAR_POST_REMOVES)
self.csm.air.send(datagram)
# Remove avatar channel:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_CLOSE_CHANNEL)
datagram.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
self.csm.air.send(datagram)
# Reset sender channel:
datagram = PyDatagram()
datagram.addServerHeader(
channel,
self.csm.air.ourChannel,
CLIENTAGENT_SET_CLIENT_ID)
datagram.addChannel(self.target<<32)
self.csm.air.send(datagram)
# Unload avatar object:
datagram = PyDatagram()
datagram.addServerHeader(
self.avId,
channel,
STATESERVER_OBJECT_DELETE_RAM)
datagram.addUint32(self.avId)
self.csm.air.send(datagram)
# Done!
self.csm.air.writeServerEvent('avatarUnload', self.avId)
self.demand('Off')
示例11: inviteeFriendResponse
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint32 [as 别名]
def inviteeFriendResponse(self, response, context):
avId = self.air.getAvatarIdFromSender()
if not context in self.requests:
self.air.writeServerEvent('suspicious', avId=avId, issue='Player tried to respond to a friend request that doesn\'t exist!')
return
if avId != self.requests[context][0][1]:
self.air.writeServerEvent('suspicious', avId=avId, issue='Player tried to respond to someone else\'s request!')
return
if self.requests[context][1] == 'cancelled':
self.air.writeServerEvent('suspicious', avId=avId, issue='Player tried to respond to non-active friend request!')
return
self.sendUpdateToAvatarId(self.requests[context][0][0], 'friendResponse', [response, context])
if response == 1:
requested = self.air.doId2do.get(self.requests[context][0][1])
requester = self.air.doId2do.get(self.requests[context][0][0])
if not (requested and requester):
# Likely they logged off just before a response was sent. RIP.
return
# Allow both toons to teleport to each other.
dg = PyDatagram()
dg.addServerHeader(self.GetPuppetConnectionChannel(requested.getDoId()), self.air.ourChannel, CLIENTAGENT_DECLARE_OBJECT)
dg.addUint32(requester.getDoId())
dg.addUint16(self.air.dclassesByName['DistributedToonAI'].getNumber())
self.air.send(dg)
dg = PyDatagram()
dg.addServerHeader(self.GetPuppetConnectionChannel(requester.getDoId()), self.air.ourChannel, CLIENTAGENT_DECLARE_OBJECT)
dg.addUint32(requested.getDoId())
dg.addUint16(self.air.dclassesByName['DistributedToonAI'].getNumber())
self.air.send(dg)
requested.extendFriendsList(requester.getDoId(), 0)
requester.extendFriendsList(requested.getDoId(), 0)
requested.d_setFriendsList(requested.getFriendsList())
requester.d_setFriendsList(requester.getFriendsList())
del self.requests[context]