コード例 #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);
        }
コード例 #2
0
 private static bool ScoreIsHigherThanCurrentBest(PlayerScore playerScore, Dictionary <int, PlayerScore> highestGroupScores)
 {
     return(playerScore.score > highestGroupScores[playerScore.groupId].score);
 }
コード例 #3
0
 private static void SetNewHighestScore(Dictionary <int, PlayerScore> highestGroupScores, PlayerScore playerScore)
 {
     if (ScoreIsHigherThanCurrentBest(playerScore, highestGroupScores))
     {
         highestGroupScores[playerScore.groupId] = playerScore;
     }
 }
コード例 #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);
     }
 }
コード例 #5
0
 private static bool PlayersAreInTheSameGroup(PlayerScore player1, PlayerScore player2)
 {
     return(player1.groupId == player2.groupId);
 }