Пример #1
0
 def __submit_score_thread(self):
     # submit score to remote server
     (error, elo) = ServerCom.submit_score(self.players, GameData.get_score())
     if error is None:
         self.submit_success = True
         self.__set_elo(elo)
         # fetch ranking
         ranking_attacker = ServerCom.fetch_ranking('attacker')
         if ranking_attacker:
             PlayerData.set_ranking('attacker', ranking_attacker)
         ranking_defender = ServerCom.fetch_ranking('defender')
         if ranking_defender:
             PlayerData.set_ranking('defender', ranking_defender)
     else:
         self.submit_success = False
Пример #2
0
 def __fetch_players_list_thread(self):
     # fetch players list from remote server
     players = ServerCom.fetch_players()
     if players:
         PlayerData.set_players(players)
     self.__updatenum_players()
     # generate missing player names
     for player in players:
         SoundManager.create_player_sound(player)
     # fetch ranking
     ranking_attacker = ServerCom.fetch_ranking('attacker')
     if ranking_attacker:
         PlayerData.set_ranking('attacker', ranking_attacker)
     ranking_defender = ServerCom.fetch_ranking('defender')
     if ranking_defender:
         PlayerData.set_ranking('defender', ranking_defender)