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


Python PyDatagram.getMessage方法代码示例

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


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

示例1: writeServerEvent

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import getMessage [as 别名]
    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,代码行数:27,代码来源:AstronInternalRepository.py

示例2: __getBarrierData

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import getMessage [as 别名]
 def __getBarrierData(self):
     # Returns the barrier data formatted as a blob for sending to
     # the clients.  This lists all of the current outstanding
     # barriers and the avIds waiting for them.
     dg = PyDatagram()
     for context, barrier in self.__barriers.items():
         toons = barrier.pendingToons
         if toons:
             dg.addUint16(context)
             dg.addUint16(len(toons))
             for avId in toons:
                 dg.addUint32(avId)
     return dg.getMessage()
开发者ID:Toonerz,项目名称:Panda3d-1.0.5,代码行数:15,代码来源:DistributedObjectAI.py

示例3: writeServerEvent

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import getMessage [as 别名]
    def writeServerEvent(self, logtype, *args):
        """
        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!

        dg = PyDatagram()
        dg.addString(self.eventLogId)
        dg.addString(logtype)
        for arg in args:
            dg.addString(str(arg))
        self.eventSocket.Send(dg.getMessage())
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:20,代码来源:AstronInternalRepository.py


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