本文整理汇总了Python中objects.Objects类的典型用法代码示例。如果您正苦于以下问题:Python Objects类的具体用法?Python Objects怎么用?Python Objects使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Objects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_enter
def on_enter(self):
super(MainMenu, self).on_enter()
constants.MUSIC = True
menu_player.set_volume(2)
if self.game_started:
Objects.reset_game()
self.game_started = False
示例2: get_user_info
def get_user_info(user_extension):
result = dict()
result = Objects.get_object_info(user_extension)
temp = Objects.get_object_info(user_extension.user)
temp["user_id"] = temp["id"]
result["userextension_id"] = result["id"]
result.update(temp)
return result
示例3: update
def update(publish, publish_dict):
try:
for (key, value) in publish_dict.items():
Objects.set_value(publish, key, value)
publish.save()
return publish
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例4: static_update
def static_update(address, address_dict):
try:
for (key, value) in address_dict.items():
Objects.set_value(address, key, value)
address.save()
return address
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return Address.get_none()
示例5: update_shop
def update_shop(shop, shop_dict):
try:
for (key, value) in shop_dict.items():
Objects.set_value(shop, key, value)
shop.save()
return shop
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return Shops.get_none()
示例6: on_win
def on_win(self):
Objects.reset_game()
server = Objects.get_server(self.levelName)
server.curLevel = self.level+1
utils.play_sound("Enter.wav")
game = Scene(server.map, server)
game.add(ImageLayer(os.path.join("images", "backgrounds", "notebook-paper.png")), z=BACKGROUND_Z)
director.push(game)
menu_player.stop()
self.game_started = True
示例7: update_user
def update_user(user, user_extension_dict, user_dict):
if user_extension_dict:
try:
ue = user.userextension
for (key, value) in user_extension_dict.items():
Objects.set_value(ue, key, value)
ue.save()
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return Users.get_none()
if user_dict:
for (key, value) in user_dict.items():
Objects.set_value(user, key, value)
user.save()
return user
示例8: server_on_attack
def server_on_attack(self,tpid,tuid,val):
# print "server_on_attack", tpid,tuid,val
client = Objects.get_client()
p = client.players[tpid]
if tuid in p.units.keys():
p.units[tuid].client_on_attack(val)
return {}
示例9: get_info
def get_info(red_envelope):
try:
result = Objects.get_object_info(red_envelope)
return result
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return dict()
示例10: server_build_unit
def server_build_unit(self, pid, tid, vid, uid,buid):
# print "building unit", pid, tid, vid, uid
client = Objects.get_client()
player = client.players[pid]
if uid not in player.underConstruction.keys():
client.build_unit(tid, player, vid=vid, uid=uid)
return {}
示例11: get_big_categories
def get_big_categories():
category_list = list()
categories = ShopCategory.objects.filter(parent_id=1)
for c in categories:
temp = Objects.get_object_info(c)
category_list.append(temp)
return category_list
示例12: server_start_game
def server_start_game(self):
'''
The client stub that gets called when the server starts the game
'''
client = Objects.get_client()
client._init_players()
client.start_game()
return {}
示例13: main
def main():
while 1:
try:
queue_id, decoded_json = get_data()
except:
time.sleep(0.5)
continue
try:
print "AAAA"
objects = Objects(queue_id, decoded_json)
results = objects.calculate()
except:
errorMessage = sys.exc_info()
print('Error Type: %s' % errorMessage[0])
print('Error Message: %s' % errorMessage[1])
write_error(queue_id, errorMessage)
continue
put_data(queue_id, results)
示例14: client_build_unit
def client_build_unit(self,pid,tid,vid,uid,buid):
# print "client",pid, "built unit", tid, "on", vid
server = Objects.get_controller()
p = server.players[pid]
if buid != -1:
server.build_unit(tid,p,vid=vid,builder=p.units[buid])
else:
server.build_unit(tid,p,vid=vid)
return {}
示例15: join_game
def join_game(self):
constants.MULTIPLAYER = True
utils.play_sound("Enter.wav")
c = Objects.get_client()
c.start_server() # start client server
connection = c.server_connect() # connect to game server
if not connection:
c.stop_server()
menu_player.stop()
self.game_started = True