本文整理汇总了Python中objects.Objects.get_controller方法的典型用法代码示例。如果您正苦于以下问题:Python Objects.get_controller方法的具体用法?Python Objects.get_controller怎么用?Python Objects.get_controller使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类objects.Objects
的用法示例。
在下文中一共展示了Objects.get_controller方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: client_build_unit
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
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 {}
示例2: client_attack_unit
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def client_attack_unit(self,pid,uid,tpid,tuid,path):
# print "client_attack_unit",pid,uid,tpid,tuid
#if tuid=-1, it's a vertex,tpid is actually tvid
server = Objects.get_controller()
attacker = server.players[pid].units[uid]
if tuid == -1:
target = server.map.vertices[str(tpid)]
else:
target = server.players[tpid].units[tuid]
server.attack_unit(target,attacker)
return {}
示例3: on_single_player
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def on_single_player(self):
Objects.get_server(self.levelName)
server = Objects.get_controller()
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
示例4: start_game
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def start_game(self):
constants.MULTIPLAYER = True
server = Objects.get_controller()
server.client_start_game()
if server.serverStarted:
utils.play_sound("Enter.wav")
game = Scene(server.map, server)
menu_player.stop()
game.add(ImageLayer(
os.path.join("images", "backgrounds", "notebook-paper.png")), z=BACKGROUND_Z)
director.push(game)
self.game_started = True
else:
print "start server first"
示例5: client_connect
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def client_connect(self, ip):
server = Objects.get_controller()
cur = server.playerList + [server.pid]
print "connected client of ip: " + ip
if ip in server.connectedClientsIP.keys():
# print "client already exist"
return {"id": server.connectedClientsIP[ip], "cur": cur,"map":server.mapName}
if len(server.map.players) != 0 and (not server.gameStarted):
pid = server.map.players.pop()
server.client_add_player(pid)
server.connectedClients[pid] = ip
server.connectedClientsIP[ip] = pid
server.playerList.append(pid)
# print "added player",pid
return {"id": pid, "cur": cur, "map":server.mapName}
# print "can't add player"
return {"id": -1, "cur": [],"map":""}
示例6: client_remove_unit
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def client_remove_unit(self,pid,uid):
# print "client",pid, "remove unit", uid
server = Objects.get_controller()
unit = server.players[pid].units[uid]
server.remove_unit(unit)
return {}
示例7: client_move_troop
# 需要导入模块: from objects import Objects [as 别名]
# 或者: from objects.Objects import get_controller [as 别名]
def client_move_troop(self,pid,uid,vid,path):
# print "client",pid, "move unit", uid, "on", vid
server = Objects.get_controller()
server.move_unit(server.map.vertices[str(vid)],server.players[pid].units[uid],pid)
return {}