本文整理匯總了Python中objects.Objects.get_client方法的典型用法代碼示例。如果您正苦於以下問題:Python Objects.get_client方法的具體用法?Python Objects.get_client怎麽用?Python Objects.get_client使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類objects.Objects
的用法示例。
在下文中一共展示了Objects.get_client方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: server_build_unit
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
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 {}
示例2: server_on_attack
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
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 {}
示例3: server_start_game
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
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 {}
示例4: join_game
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
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
示例5: server_update_health
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def server_update_health(self, pid, uid, h, tid,vid):
# print "update_health", pid, uid, h
client = Objects.get_client()
player = client.players[pid]
if uid not in player.underConstruction.keys():
unit = client.build_unit(tid,player,vid=vid,uid=uid)
else:
unit = player.underConstruction[uid]
unit.health = h
client._complete_build(unit, player, uid)
return {}
示例6: server_animate_attack
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def server_animate_attack(self,pid,uid,tpid,tuid,path):
#if no path, stop attacking
# print "server_animate_attack",pid,uid, tpid,tuid,path
client = Objects.get_client()
if (uid in client.players[pid].units.keys()):
attacker = client.players[pid].units[uid]
if tpid == -1 or tuid == -1:
attacker.end_attack(True)
elif path:
target = client.players[tpid].units[tuid]
attacker.attackingPath = path
if not attacker.is_attacking:
attacker.client_attack(target,client.map)
return {}
示例7: client_remove_unit
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def client_remove_unit(self,pid,uid):
# print "remove unit", pid, uid
client = Objects.get_client()
unit = client.players[pid].units[uid]
unit.destroy_action()
return {}
示例8: server_move_troop
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def server_move_troop(self, pid, uid, vid, path):
# print "server move unit", pid, vid, uid, path
client = Objects.get_client()
path = client.move_unit(client.players[pid].units[uid], path)
return {}
示例9: server_update_location
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def server_update_location(self, pid, uid, vid):
client = Objects.get_client()
p = client.players[pid]
curVertex = client.map.vertices[str(vid)]
client.update_location(p.units[uid], curVertex.position, curVertex)
return {}
示例10: server_add_player
# 需要導入模塊: from objects import Objects [as 別名]
# 或者: from objects.Objects import get_client [as 別名]
def server_add_player(self, pid):
# print "server add player"
client = Objects.get_client()
client.playerList.append(pid)
return {}