コード例 #1
0
ファイル: _gameswidget.py プロジェクト: AThorley/lobby
    def startSearchRanked(self, race):
        self.stopSearchingTeamMatchmaker()
        if (fa.exe.running()):
            QtGui.QMessageBox.information(None, "ForgedAlliance.exe", "FA is already running.")
            self.stopSearchRanked()
            return

        if (not fa.exe.check("ladder1v1")):
            self.stopSearchRanked()
            logger.error("Can't play ranked without successfully updating Forged Alliance.")
            return

        if (self.searching):
            logger.info("Switching Ranked Search to Race " + str(race))
            self.race = race
            self.client.send(dict(command="game_matchmaking", mod="ladder1v1", state="settings", faction = self.race))
        else:
            #Experimental UPnP Mapper - mappings are removed on app exit
            if self.client.useUPnP:
                fa.upnp.createPortMapping(self.client.localIP, self.client.gamePort, "UDP")

            logger.info("Starting Ranked Search as " + str(race) + ", port: " + str(self.client.gamePort))
            self.searching = True
            self.race = race
            self.radius = 0
            self.searchProgress.setVisible(True)
            self.labelAutomatch.setText("Searching...")
            self.rankedTimer.start(RANKED_SEARCH_EXPANSION_TIME)
            self.client.send(dict(command="game_matchmaking", mod="ladder1v1", state="start", gameport = self.client.gamePort, faction = self.race))
コード例 #2
0
ファイル: _gameswidget.py プロジェクト: AThorley/lobby
    def handleMatchmakerInfo(self, message):
        action = message["action"]
        if action == "startSearching":
            if (not fa.exe.check("matchmaker")):
                logger.error("Can't play ranked without successfully updating Forged Alliance.")
                return            

            self.client.send(dict(command="game_matchmaking", mod="matchmaker", state="port", port=self.client.gamePort))

            if self.client.useUPnP:
                fa.upnp.createPortMapping(self.client.localIP, self.client.gamePort, "UDP")

            numplayers = message["players"]

            self.disconnectTeamSearchToggles()
            for numplayer in self.teamSearchButton:
                if numplayer != numplayers:
                    self.teamSearchButton[numplayer].setChecked(False)
                else:
                    self.teamSearchButton[numplayer].setChecked(True)
            self.connectTeamSearchToggles()

            self.teamSearching = True
            self.teamSearchProgress.show()
        
        elif action == "stopSearching":
            self.teamSearching = False
            self.teamSearchProgress.hide()