示例#1
0
 private static GameModeStats MergeGameModeStats(GameModeStats a, GameModeStats b)
 {
     return(new GameModeStats
     {
         BestScore = a.BestScore + b.BestScore,
         MatchesLost = a.MatchesLost + b.MatchesLost,
         MatchesWon = a.MatchesWon + b.MatchesWon,
         TimePlayed = a.TimePlayed + b.TimePlayed
     });
 }
示例#2
0
 private static GameModeStats CalculateGameModeStatsDelta(GameModeStats a, GameModeStats b)
 {
     return(new GameModeStats
     {
         MatchesLost = b.MatchesLost - a.MatchesLost,
         MatchesWon = b.MatchesWon - a.MatchesWon,
         TimePlayed = b.TimePlayed - a.TimePlayed,
         BestScore = b.BestScore - a.BestScore
     });
 }
        public PlayerLifetimeStats GetPlayerLifetimeStatsDocumentFromRaw(string raw, string playerId, string name)
        {
            JObject jResponse     = JsonConvert.DeserializeObject <JObject>(raw);
            JToken  gameModeStats = jResponse[DataGameModeStatsJsonPath][AttributesGameModeStatsJsonPath][GameModeStatsJsonPath];

            PlayerLifetimeStats player = new PlayerLifetimeStats();

            foreach (string gameMode in _workerConfiguration.GameModes)
            {
                player.PlayerId   = playerId;
                player.PlayerName = name;

                GameModeStats modeStats = new GameModeStats();
                modeStats.Mode  = gameMode;
                modeStats.Stats = gameModeStats[gameMode].ToObject <GameStats>();

                player.GameModeStats.Add(modeStats);
            }

            return(player);
        }