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


Python Object.client_serialize方法代码示例

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


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

示例1: client_serialize

# 需要导入模块: from object import Object [as 别名]
# 或者: from object.Object import client_serialize [as 别名]
    def client_serialize(self):
        """
        Convert Item to a string, suitable for transmission to the client.
        Only include attributes which the client cares about.
        """
        # Need to trim off the trailing bracket from the Object serialization.
        obj = Object.client_serialize(self)[:-1]
        item = "}}".format()

        return obj + item
开发者ID:aruse,项目名称:Bludgeon,代码行数:12,代码来源:item.py

示例2: client_serialize

# 需要导入模块: from object import Object [as 别名]
# 或者: from object.Object import client_serialize [as 别名]
    def client_serialize(self):
        """
        Convert Monster to a string, suitable for transmission to the client.
        Only include attributes which the client cares about.
        """
        # Need to trim off the trailing bracket from the Object serialization.
        obj = Object.client_serialize(self)[:-1]

        inventory = repr([item.oid for item in self.inventory])
        mon = ("'hp':{0},'max_hp':{1},'mp':{2},'max_mp':{3},"
               "'inventory':{4}}}".format(
                repr(self.hp), repr(self.max_hp), repr(self.mp),
                repr(self.max_mp), inventory))

        return obj + mon
开发者ID:aruse,项目名称:Bludgeon,代码行数:17,代码来源:monster.py


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