当前位置: 首页>>代码示例>>Python>>正文


Python distributed.PyDatagram类代码示例

本文整理汇总了Python中direct.distributed.PyDatagram的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram类的具体用法?Python PyDatagram怎么用?Python PyDatagram使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PyDatagram类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onCrossClicked

    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()
开发者ID:Ultimoore,项目名称:tethical,代码行数:28,代码来源:main.py

示例2: handleConnected

    def handleConnected(self):
        self.notify.info('Yarn. Waking up (This may take a while!).')
        ToontownInternalRepository.handleConnected(self)
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            self.districtId, self.getGameDoId(), 2)

        # Claim ownership of that district...
        dg = PyDatagram()
        dg.addServerHeader(
            self.districtId,
            self.ourChannel,
            STATESERVER_OBJECT_SET_AI)
        dg.addChannel(self.ourChannel)
        self.send(dg)

        self.notify.info('Creating Global Managers')
        self.createGlobals()
        self.notify.info('Creating Toontown')
        self.createZones()

        self.statusSender.start()

        self.distributedDistrict.b_setAvailable(1)
        self.notify.info('District is now ready.')
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:27,代码来源:ToontownAIRepository.py

示例3: enterControlled

 def enterControlled(self, avId, accId):
     self.driverId = avId
     fieldList = ['setComponentL',
      'setComponentX',
      'setComponentY',
      'setComponentZ',
      'setComponentH',
      'setComponentP',
      'setComponentR',
      'setComponentT',
      'setSmStop',
      'setSmH',
      'setSmZ',
      'setSmXY',
      'setSmXZ',
      'setSmPos',
      'setSmHpr',
      'setSmXYH',
      'setSmXYZH',
      'setSmPosHpr',
      'setSmPosHprL',
      'clearSmoothing',
      'suggestResync',
      'returnResync']
     #self.air.setAllowClientSend(avId, self, fieldList, accId)
     #hack until CLIENTAGENT_SET_FIELDS_SENDABLE works
     #probably should not be kept for any longer than it needs to
     dg = PyDatagram()
     dg.addServerHeader(self.doId, self.air.ourChannel, STATESERVER_OBJECT_SET_OWNER)
     dg.addUint64(accId << 32 | avId)
     self.air.send(dg)
     self.d_setState('C', self.driverId)
开发者ID:ToontownBattlefront,项目名称:Toontown-Battlefront,代码行数:32,代码来源:DistributedVehicleAI.py

示例4: updateAllPartyLists

    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)
开发者ID:Ultimoore,项目名称:tethical,代码行数:10,代码来源:main.py

示例5: __ready

 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")
开发者ID:Teku16,项目名称:MikeyTheRepository,代码行数:11,代码来源:ToontownAIRepository.py

示例6: login

    def login(self, cookie):
        target = self.air.getMsgSender()

        datagram = PyDatagram()
        datagram.addServerHeader(
            target,
            self.air.ourChannel,
            CLIENTAGENT_SET_STATE)
        datagram.addUint16(2)
        self.air.send(datagram)

        self.sendUpdateToChannel(target, 'acceptLogin', [])
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:12,代码来源:ClientServicesManagerUD.py

示例7: enterSetAvatarTask

    def enterSetAvatarTask(self, channel, task):
        # 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)

        self.csm.air.writeServerEvent('avatarChosen', self.avId, self.target)
        self.demand('Off')
        return task.done
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:13,代码来源:ClientServicesManagerUD.py

示例8: handleConnected

    def handleConnected(self):
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(simbase.air.districtId, self.getGameDoId(), 2)

        dg = PyDatagram()
        dg.addServerHeader(simbase.air.districtId, simbase.air.ourChannel, STATESERVER_OBJECT_SET_AI)
        dg.addChannel(simbase.air.ourChannel)
        simbase.air.send(dg)

        self.createGlobals()
        self.createZones()
开发者ID:Spiderlover,项目名称:Toontown-Crystal-TTH-Edition,代码行数:13,代码来源:ToontownAIRepository.py

示例9: moveCharacterTo

    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)
开发者ID:Ultimoore,项目名称:tethical,代码行数:11,代码来源:main.py

示例10: toonOnline

    def toonOnline(self, doId, friendsList):
        self.onlineToons.append(doId)

        channel = self.GetPuppetConnectionChannel(doId)
        dgcleanup = self.dclass.aiFormatUpdate('goingOffline', self.doId, self.doId, self.air.ourChannel, [doId])
        dg = PyDatagram()
        dg.addServerHeader(channel, self.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
        dg.addString(dgcleanup.getMessage())
        self.air.send(dg)

        for friend in friendsList:
            friendId = friend[0]
            if friend[0] in self.onlineToons:
                self.sendUpdateToAvatarId(doId, 'friendOnline', [friendId, 0, 0])
            self.sendUpdateToAvatarId(friendId, 'friendOnline', [doId, 0, 0])
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:15,代码来源:TTSFriendsManagerUD.py

示例11: path

 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)
开发者ID:Ultimoore,项目名称:tethical,代码行数:12,代码来源:main.py

示例12: enterSetAvatarTask

    def enterSetAvatarTask(self, channel, task):
        # 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 the GlobalPartyManager as well:
        self.csm.air.globalPartyMgr.avatarJoined(self.avId)

        self.csm.air.writeServerEventMessage('avatarChosen', self.avId, self.target)
        self.demand('Off')
        return task.done
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:16,代码来源:ClientServicesManagerUD.py

示例13: __offlineToonOnline

    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])
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:17,代码来源:TTRFriendsManagerUD.py

示例14: authenticate

    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
开发者ID:Ultimoore,项目名称:tethical,代码行数:25,代码来源:main.py

示例15: login

    def login(self, cookie, sig):
        self.notify.debug("Received login cookie %r from %d" % (cookie, self.air.getMsgSender()))

        sender = self.air.getMsgSender()

        if not self.loginsEnabled:
            # Logins are currently disabled... RIP!
            dg = PyDatagram()
            dg.addServerHeader(sender, self.air.ourChannel, CLIENTAGENT_EJECT)
            dg.addUint16(200)
            dg.addString("Logins are currently disabled. Please try again later.")
            self.air.send(dg)

        if sender >> 32:
            # Oops, they have an account ID on their connection already!
            self.killConnection(sender, "Client is already logged in.")
            return

        # Test the signature
        key = (
            config.GetString("csmud-secret", "streetlamps")
            + config.GetString("server-version", "no_version_set")
            + FIXED_KEY
        )
        computedSig = hmac.new(key, cookie, hashlib.sha256).digest()
        if sig != computedSig:
            self.killConnection(sender, "The accounts database rejected your cookie")
            return

        if sender in self.connection2fsm:
            self.killConnectionFSM(sender)
            return

        self.connection2fsm[sender] = LoginAccountFSM(self, sender)
        self.connection2fsm[sender].request("Start", cookie)
开发者ID:TLOTT-PS,项目名称:ttr-src,代码行数:35,代码来源:ClientServicesManagerUD.py


注:本文中的direct.distributed.PyDatagram类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。