Exemplo n.º 1
0
        protected MatchInfo GenerateMatch(
            ServerInfo hostServer,
            DateTime endTime,
            string map = "map1",
            IEnumerable <PlayerInfo> scoreboard = null,
            string gameMode    = "A",
            double timeElapsed = 1.0,
            int fragLimit      = 1,
            int timeLimit      = 10)
        {
            if (scoreboard == null)
            {
                scoreboard = new List <PlayerInfo> {
                    Player1
                }
            }
            ;
            var match = new MatchInfo
            {
                HostServer  = hostServer,
                TimeElapsed = timeElapsed,
                FragLimit   = fragLimit,
                GameMode    = gameMode,
                Map         = map,
                Scoreboard  = scoreboard.ToList(),
                TimeLimit   = timeLimit,
                EndTime     = endTime
            };

            return(match.InitPlayers(match.EndTime));
        }
Exemplo n.º 2
0
        public async Task UpdateMatch(MatchInfo.MatchInfoId matchId, MatchInfo match)
        {
            logger.ConditionalTrace("Update information about match {0}",
                                    new { MatchId = matchId, MatchInfo = match });

            var server = await statisticStorage.GetServer(new ServerInfo.ServerInfoId {
                Id = matchId.ServerId
            });

            if (server == null)
            {
                return;
            }
            match.HostServer = server;
            match            = match.InitPlayers(match.EndTime);

            var oldMatchInfo = await statisticStorage.GetMatch(match.GetIndex());

            if (oldMatchInfo != null)
            {
                DeleteMatch(oldMatchInfo.InitPlayers(oldMatchInfo.EndTime));
            }
            await statisticStorage.UpdateMatch(matchId, match);

            InsertMatch(match);
        }