Exemplo n.º 1
0
 public GameInfo(GameId id, int totalRounds, int currentRound, int currentTeam, DateTime creationDate, User owner, Percentage percentage)
 {
     Id           = id;
     TotalRounds  = totalRounds;
     CurrentRound = currentRound;
     CurrentTeam  = currentTeam;
     CreationDate = creationDate;
     Owner        = owner;
     Percentage   = percentage;
 }
Exemplo n.º 2
0
        public async Task <Game> Load(Guid id, User user, ClientInfo clientInfo)
        {
            var gameId   = new GameId(id);
            var concepts = await conceptsRepository.GetConceptsFromGame(gameId);

            var deck     = DeckFactory.Create(concepts);
            var gameInfo = await gameRepository.GetGameInfo(gameId);

            var avaliableTeams = await gameRepository.GetTeams(gameId, deck);

            var game = new Game(
                gameId,
                GetRoundContext(gameInfo.TotalRounds, gameInfo.CurrentRound),
                deck,
                GetTeams(avaliableTeams, gameInfo.CurrentTeam),
                gameInfo.Owner,
                gameInfo.CreationDate
                );

            gameRepository.AddLoadedLog(game.Id, user, clientInfo);
            await unitOfWork.CompleteAsync();

            return(game);
        }