Exemplo n.º 1
0
        private static PlayerScore CreatePlayerScoreFromReader(IDataReader reader)
        {
            var playerStats = new PlayerScore();

            playerStats.id          = (int)reader["playerId"];
            playerStats.wins        = (int)reader["wins"];
            playerStats.lose        = (int)reader["lose"];
            playerStats.draw        = (int)reader["draw"];
            playerStats.win_frames  = (int)reader["win_frames"];
            playerStats.lose_frames = (int)reader["lose_frames"];
            playerStats.groupId     = (int)reader["GroupId"];
            return(playerStats);
        }
Exemplo n.º 2
0
 private static bool ScoreIsHigherThanCurrentBest(PlayerScore playerScore, Dictionary <int, PlayerScore> highestGroupScores)
 {
     return(playerScore.score > highestGroupScores[playerScore.groupId].score);
 }
Exemplo n.º 3
0
 private static void SetNewHighestScore(Dictionary <int, PlayerScore> highestGroupScores, PlayerScore playerScore)
 {
     if (ScoreIsHigherThanCurrentBest(playerScore, highestGroupScores))
     {
         highestGroupScores[playerScore.groupId] = playerScore;
     }
 }
Exemplo n.º 4
0
 private static void UpdateHighestScore(Dictionary <int, PlayerScore> highestGroupScores, PlayerScore playerScore)
 {
     if (highestGroupScores.ContainsKey(playerScore.groupId))
     {
         SetNewHighestScore(highestGroupScores, playerScore);
     }
     else
     {
         highestGroupScores.Add(playerScore.groupId, playerScore);
     }
 }
Exemplo n.º 5
0
 private static bool PlayersAreInTheSameGroup(PlayerScore player1, PlayerScore player2)
 {
     return(player1.groupId == player2.groupId);
 }