本文整理汇总了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
示例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