예제 #1
0
        public Match AddNewMatch(MatchInfo matchInfo, Models.Server server)
        {
            var match = new Match
            {
                Server      = server,
                Timestamp   = matchInfo.Timestamp,
                Map         = Maps.FindOrAddMap(matchInfo.Map),
                GameMode    = GameModes.FindOrAddGameMode(matchInfo.GameMode),
                FragLimit   = matchInfo.FragLimit,
                TimeLimit   = matchInfo.TimeLimit,
                TimeElapsed = matchInfo.TimeElapsed
            };

            foreach (var scoreInfo in matchInfo.Scoreboard)
            {
                var score = new Score
                {
                    Match    = match,
                    Position = scoreInfo.Position,
                    Player   = Players.FindOrAddPlayer(scoreInfo.Name),
                    Frags    = scoreInfo.Frags,
                    Kills    = scoreInfo.Kills,
                    Deaths   = scoreInfo.Deaths
                };

                match.Scoreboard.Add(score);
            }

            match.IsProcessedForStatistics = false;

            Matches.Add(match);

            return(match);
        }