當前位置: 首頁>>代碼示例>>Python>>正文


Python Objects.get_controller方法代碼示例

本文整理匯總了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 {}
開發者ID:david-abel,項目名稱:noteworks,代碼行數:11,代碼來源:server.py

示例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 {}
開發者ID:david-abel,項目名稱:noteworks,代碼行數:13,代碼來源:server.py

示例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
開發者ID:david-abel,項目名稱:noteworks,代碼行數:15,代碼來源:game.py

示例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"
開發者ID:david-abel,項目名稱:noteworks,代碼行數:17,代碼來源:game.py

示例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":""}
開發者ID:david-abel,項目名稱:noteworks,代碼行數:19,代碼來源:server.py

示例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 {}
開發者ID:david-abel,項目名稱:noteworks,代碼行數:8,代碼來源:server.py

示例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 {}
開發者ID:david-abel,項目名稱:noteworks,代碼行數:7,代碼來源:server.py


注:本文中的objects.Objects.get_controller方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。