本文整理汇总了Python中direct.distributed.PyDatagram.addUint8方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.addUint8方法的具体用法?Python PyDatagram.addUint8怎么用?Python PyDatagram.addUint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.distributed.PyDatagram
的用法示例。
在下文中一共展示了PyDatagram.addUint8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: attack
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def attack(self, charid, targetid):
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(ATTACK)
myPyDatagram.addString(charid)
myPyDatagram.addString(targetid)
self.cWriter.send(myPyDatagram, self.myConnection)
示例2: authenticate
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def authenticate(self):
login = self.loginwindow.loginEntry.get()
password = self.loginwindow.passwordEntry.get()
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cWriter = ConnectionWriter(self.cManager, 0)
self.cReader.setTcpHeaderSize(4)
self.cWriter.setTcpHeaderSize(4)
self.myConnection = self.cManager.openTCPClientConnection(IP, PORT, 5000)
if self.myConnection:
self.cReader.addConnection(self.myConnection)
print 'Client listening on', IP, ':', PORT
taskMgr.add(self.tskReaderPolling, "Poll the connection reader")
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(LOGIN_MESSAGE)
myPyDatagram.addString(login)
myPyDatagram.addString(password)
self.cWriter.send(myPyDatagram, self.myConnection)
else:
print 'Can\'t connect to server on', IP, ':', PORT
示例3: onCrossClicked
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def onCrossClicked(self):
if self.phase == 'tile' and self.cux is not False and self.party['yourturn']:
if self.subphase == 'free':
# if we clicked on a character
if self.party['map']['tiles'][self.cux][self.cuy][self.cuz].has_key('char'):
charid = self.party['map']['tiles'][self.cux][self.cuy][self.cuz]['char']
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(GET_PASSIVE_WALKABLES)
myPyDatagram.addString(charid)
self.cWriter.send(myPyDatagram, self.myConnection)
elif self.subphase == 'passivewalkables':
self.clearZone()
self.cancel_snd.play()
self.subphase = 'free'
elif self.subphase == 'move':
self.clearZone()
self.cancel_snd.play()
self.subphase = None
self.turn()
elif self.subphase == 'attack':
self.clearZone()
self.cancel_snd.play()
self.subphase = None
self.turn()
示例4: createParty
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def createParty(self, mapname):
import time
partyname = str(int(time.time()))
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(CREATE_PARTY)
myPyDatagram.addString(partyname)
myPyDatagram.addString(mapname)
self.cWriter.send(myPyDatagram, self.myConnection)
示例5: updateAllPartyLists
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def updateAllPartyLists(self):
parties = deepcopy(self.parties)
for party in parties.values():
del party['map']['tiles']
for player in self.playersinlobby:
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(UPDATE_PARTY_LIST)
myPyDatagram.addString32(json.dumps(parties))
self.cWriter.send(myPyDatagram, player)
示例6: doUpdate
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [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())
示例7: packGardenData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [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()
示例8: moveCharacterTo
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def moveCharacterTo(self, charid, dest):
(x2, y2, z2) = dest
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(MOVE_TO)
myPyDatagram.addString(charid)
myPyDatagram.addUint8(x2)
myPyDatagram.addUint8(y2)
myPyDatagram.addUint8(z2)
self.cWriter.send(myPyDatagram, self.myConnection)
示例9: path
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def path(self, charid, dest):
orig = self.getCharacterCoords(charid)
origdir = self.sprites[charid].realdir
(x, y, z) = dest
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(GET_PATH)
myPyDatagram.addString(charid)
myPyDatagram.addUint8(x)
myPyDatagram.addUint8(y)
myPyDatagram.addUint8(z)
self.cWriter.send(myPyDatagram, self.myConnection)
示例10: d_setShardData
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [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
示例11: d_updateBlock
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [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
示例12: setupAttackables
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def setupAttackables(self, charid):
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(GET_ATTACKABLES)
myPyDatagram.addString(charid)
self.cWriter.send(myPyDatagram, self.myConnection)
示例13: onMoveClicked
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def onMoveClicked(self, charid):
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(GET_WALKABLES)
myPyDatagram.addString(charid)
self.cWriter.send(myPyDatagram, self.myConnection)
示例14: directionChosen
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def directionChosen(self, charid, direction):
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(WAIT)
myPyDatagram.addString(charid)
myPyDatagram.addUint8(direction)
self.cWriter.send(myPyDatagram, self.myConnection)
示例15: partyListScreen
# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addUint8 [as 别名]
def partyListScreen(self):
myPyDatagram = PyDatagram()
myPyDatagram.addUint8(GET_PARTIES)
self.cWriter.send(myPyDatagram, self.myConnection)