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


Python PyDatagram.PyDatagram类代码示例

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


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

示例1: writeServerEvent

    def writeServerEvent(self, logtype, *args, **kwargs):
        """
        Write an event to the central Event Logger, if one is configured.

        The purpose of the Event Logger is to keep a game-wide record of all
        interesting in-game events that take place. Therefore, this function
        should be used whenever such an interesting in-game event occurs.
        """

        if self.eventSocket is None:
            return # No event logger configured!

        log = collections.OrderedDict()
        log['type'] = logtype
        log['sender'] = self.eventLogId

        for i,v in enumerate(args):
            # +1 because the logtype was _0, so we start at _1
            log['_%d' % (i+1)] = v

        log.update(kwargs)

        dg = PyDatagram()
        msgpack_encode(dg, log)
        self.eventSocket.Send(dg.getMessage())
开发者ID:jwcotejr,项目名称:panda3d,代码行数:25,代码来源:AstronInternalRepository.py

示例2: sendDeleteMsg

    def sendDeleteMsg(self, doId):
        # This method is only used in conjunction with the CMU LAN
        # server.

        datagram = PyDatagram()
        datagram.addUint16(CLIENT_OBJECT_DELETE)
        datagram.addUint32(doId)
        self.send(datagram)
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:8,代码来源:ClientRepository.py

示例3: sendSetShardMsg

 def sendSetShardMsg(self, shardId):
     datagram = PyDatagram()
     # Add message type
     datagram.addUint16(CLIENT_SET_SHARD)
     # Add shard id
     datagram.addUint32(shardId)
     # send the message
     self.send(datagram)
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:8,代码来源:ClientRepository.py

示例4: setClientState

    def setClientState(self, clientChannel, state):
        """
        Sets the state of the client on the CA.
        Useful for logging in and logging out, and for little else.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_SET_STATE)
        dg.add_uint16(state)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:10,代码来源:AstronInternalRepository.py

示例5: setOwner

    def setOwner(self, doId, newOwner):
        """
        Sets the owner of a DistributedObject. This will enable the new owner to send "ownsend" fields,
        and will generate an OwnerView.
        """

        dg = PyDatagram()
        dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_OWNER)
        dg.add_uint64(newOwner)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:10,代码来源:AstronInternalRepository.py

示例6: sendHeartbeat

 def sendHeartbeat(self):
     datagram = PyDatagram()
     # Add message type
     datagram.addUint16(CLIENT_HEARTBEAT)
     # Send it!
     self.send(datagram)
     self.lastHeartbeat = globalClock.getRealTime()
     # This is important enough to consider flushing immediately
     # (particularly if we haven't run readerPollTask recently).
     self.considerFlush()
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:10,代码来源:ClientRepository.py

示例7: setAI

    def setAI(self, doId, aiChannel):
        """
        Sets the AI of the specified DistributedObjectAI to be the specified channel.
        Generally, you should not call this method, and instead call DistributedObjectAI.setAI.
        """

        dg = PyDatagram()
        dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI)
        dg.add_uint64(aiChannel)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:10,代码来源:AstronInternalRepository.py

示例8: _sendRemoveAIInterest

 def _sendRemoveAIInterest(self, handle):
     """
     handle is a bare int, NOT an InterestHandle.  Use this to
     close an AI opened interest.
     """
     datagram = PyDatagram()
     # Add message type
     datagram.addUint16(CLIENT_REMOVE_INTEREST)
     datagram.addUint16((1<<15) + handle)
     self.send(datagram)
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:10,代码来源:DoInterestManager.py

示例9: sendSetLocation

 def sendSetLocation(self, doId, parentId, zoneId):
     datagram = PyDatagram()
     datagram.addUint16(CLIENT_OBJECT_LOCATION)
     datagram.addUint32(doId)
     datagram.addUint32(parentId)
     datagram.addUint32(zoneId)
     self.send(datagram)
开发者ID:Toonerz,项目名称:TTRInjector,代码行数:7,代码来源:ClientRepositoryBase.py

示例10: sendDisconnect

 def sendDisconnect(self):
     if self.isConnected():
         # Tell the game server that we're going:
         datagram = PyDatagram()
         # Add message type
         datagram.addUint16(CLIENT_DISCONNECT)
         # Send the message
         self.send(datagram)
         self.notify.info("Sent disconnect message to server")
         self.disconnect()
     self.stopHeartbeat()
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:11,代码来源:ClientRepository.py

示例11: clientAddSessionObject

    def clientAddSessionObject(self, clientChannel, doId):
        """
        Declares the specified DistributedObject to be a "session object",
        meaning that it is destroyed when the client disconnects.
        Generally used for avatars owned by the client.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_SESSION_OBJECT)
        dg.add_uint32(doId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:11,代码来源:AstronInternalRepository.py

示例12: requestDelete

    def requestDelete(self, do):
        """
        Request the deletion of an object that already exists on the State Server.

        You should probably use do.requestDelete() instead.
        """

        dg = PyDatagram()
        dg.addServerHeader(do.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(do.doId)
        self.send(dg)
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:11,代码来源:AstronInternalRepository.py

示例13: requestDelete

    def requestDelete(self, do):
        """
        Request the deletion of an object that already exists on the State Server.

        You should use do.requestDelete() instead. This is not meant to be
        called directly unless you really know what you are doing.
        """

        dg = PyDatagram()
        dg.addServerHeader(do.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(do.doId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:12,代码来源:AstronInternalRepository.py

示例14: clearPostRemove

    def clearPostRemove(self):
        """
        Clear all datagrams registered with addPostRemove.

        This is useful if the Panda3D process is performing a clean exit. It may
        clear the "emergency clean-up" post-remove messages and perform a normal
        exit-time clean-up instead, depending on the specific design of the game.
        """

        dg = PyDatagram()
        dg.addServerControlHeader(CONTROL_CLEAR_POST_REMOVE)
        self.send(dg)
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:12,代码来源:AstronInternalRepository.py

示例15: _sendRemoveInterest

 def _sendRemoveInterest(self, contextId):
     """
     contextId is a client-side created number that refers to
             a set of interests.  The same contextId number doesn't
             necessarily have any relationship to the same contextId
             on another client.
     """
     assert self.notify.debugCall()
     datagram = PyDatagram()
     # Add message type
     datagram.addUint16(CLIENT_REMOVE_INTEREST)
     datagram.addUint16(contextId)
     self.send(datagram)
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:13,代码来源:DoInterestManager.py


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