public CreateGameController(
     IGameStore gameStore = null,
     IGameProfileFactory gameProfileFactory = null)
 {
     _gameStore          = gameStore ?? new GameStore();
     _gameProfileFactory = gameProfileFactory ?? new GameProfileFactory();
 }
Beispiel #2
0
        public static Quest CreateStartedWithMaleHero(out IGameStore gameStore, out Guid gameId, out Guid playerId, out Sequence sequence)
        {
            var quest = CreateStarted(out gameStore, out gameId, out sequence);

            addMaleHeroToQuest(quest, sequence, gameId, out playerId);
            return(quest);
        }
 private void ValidateAttack(IGameStore store, Guid playerId, Models.Battleship battleship)
 {
     if (battleship.PlayerId == playerId)
     {
         throw new OwnBattleshipAttackedException(playerId, battleship.Id);
     }
 }
 public GameRetrieverService(IGameStore gameStore, IReporter reporter, IConfigurationService configService)
 {
     _gameStore     = gameStore;
     _reporter      = reporter;
     _configService = configService;
     _parser        = new DrawParser();
 }
Beispiel #5
0
        public static Quest CreateStarted(out IGameStore gameStore, out Guid gameId, out Sequence sequence)
        {
            var quest = CreateStored(out gameStore, out gameId);

            sequence = new Sequence();
            startQuest(quest, sequence, gameId);
            return(quest);
        }
Beispiel #6
0
        public static Quest CreateStored(out IGameStore gameStore, out Guid gameId)
        {
            gameStore = new VolatileGameStore();
            var quest = Create(gameStore);

            gameId = quest.StartJourney();
            return(quest);
        }
Beispiel #7
0
 public UserActivityPerDayController(
     IMemoryCache memoryCache,
     AllUserActivityCache allUserActivityCache = null,
     IGameStore gameStore = null)
 {
     _allUserActivityCache = allUserActivityCache ?? new AllUserActivityCache(memoryCache);
     _gameStore            = gameStore ?? new GameStore();
 }
 public GameIconController(
     IMemoryCache memoryCache,
     IHttpClientFactory httpClientFactory,
     IGameStore gameStore = null)
 {
     _memoryCache       = memoryCache;
     _httpClientFactory = httpClientFactory;
     _gameStore         = gameStore ?? new GameStore();
 }
Beispiel #9
0
 public DashboardViewModel(IGameStore gamestore, INavigationService navigation)
 {
     if (gamestore == null)
         throw new ArgumentNullException(nameof(gamestore));
     if (navigation == null)
         throw new ArgumentNullException(nameof(navigation));
     this.gamestore = gamestore;
     this.navigation = navigation;
 }
 public UserActivityForMonthController(
     IMemoryCache memoryCache,
     AllUserActivityCache allUserActivityCache = null,
     IGameStore gameStore = null,
     ITimeSpentByHourCalculator timeSpentByHourCalculator = null)
 {
     _allUserActivityCache      = allUserActivityCache ?? new AllUserActivityCache(memoryCache);
     _gameStore                 = gameStore ?? new GameStore();
     _timeSpentByHourCalculator = timeSpentByHourCalculator ?? new TimeSpentByHourCalculator();
 }
        public Guid Execute(IGameStore store, Guid playerId, IReadOnlyList <Coordinate> coordinates)
        {
            var battleshipId = Guid.NewGuid();

            ValidateCoordinates(playerId, coordinates);

            AddBattleship(store, playerId, coordinates, battleshipId);

            return(battleshipId);
        }
Beispiel #12
0
 public GameService(
     ILogger <GameService> logger,
     IMapper mapper,
     CoreOptions options,
     Defaults defaults,
     IGameStore store
     ) : base(logger, mapper, options)
 {
     Store    = store;
     Defaults = defaults;
 }
Beispiel #13
0
        public override RealizeLotteryResult RealizeLottery(IGameStore <Game> store)
        {
            var quadraGames = new List <Game>();
            var quinaGames  = new List <Game>();
            var megaGames   = new List <Game>();

            var result = new RealizeLotteryResult();

            if (store.Store.Count == 0)
            {
                result.Success = false;
                result.Error   = "Não existem jogos pra realizar um sorteio.";
                return(result);
            }

            var currentLotteryNumbers = this.GetLotteryNumbers();

            foreach (var storeItem in store.Store)
            {
                var currGame = storeItem.Value;
                var matches  = 0;
                foreach (var number in currGame.Numbers)
                {
                    if (currentLotteryNumbers.Contains(number))
                    {
                        matches++;
                    }
                }

                if (matches == 4)
                {
                    quadraGames.Add(currGame);
                }
                else if (matches == 5)
                {
                    quinaGames.Add(currGame);
                }
                else if (matches == 6)
                {
                    megaGames.Add(currGame);
                }
            }

            result.LotteryNumbers = currentLotteryNumbers;

            result.QuadraGames = quadraGames.ToArray();
            result.QuinaGames  = quinaGames.ToArray();
            result.MegaGames   = megaGames.ToArray();

            result.Success = true;

            return(result);
        }
Beispiel #14
0
 public PlayerService(
     IPlayerStore store,
     IGameStore gameStore,
     IMapper mapper,
     IMemoryCache localCache,
     ITopoMojoApiClient mojo
     )
 {
     Store      = store;
     GameStore  = gameStore;
     Mapper     = mapper;
     LocalCache = localCache;
     Mojo       = mojo;
 }
        public bool Execute(IGameStore store, Guid playerId, Coordinate coordinate)
        {
            var battleship = store.GetBattleship(coordinate);

            if (battleship == null)
            {
                return(false);
            }

            ValidateAttack(store, playerId, battleship);

            SaveAttackResult(coordinate, battleship);

            return(true);
        }
Beispiel #16
0
        public virtual DoLotteryResult DoLottery()
        {
            var result = new DoLotteryResult();
            var realizeLotteryResult = this._lottery.RealizeLottery(this.GameStore);

            if (realizeLotteryResult.Success)
            {
                realizeLotteryResult.Id = _currId;
                _currId++;

                //verificar se esses numeros já foram sorteados, se sim, tentar novamente
                foreach (var lottery in this.HistoryLotteries)
                {
                    if (lottery.Value.LotteryNumbers.SequenceEqual(realizeLotteryResult.LotteryNumbers))
                    {
                        return(DoLottery());
                    }
                }

                //armazenar os numeros sorteados, juntamente com os jogos que fizeram quadra, quina e mega
                this.HistoryLotteries.Add(realizeLotteryResult.Id, realizeLotteryResult);
                result.Content = this.GetLotteryOutput(realizeLotteryResult);

                //limpar o gameStoreAtual
                this.GameStore = new GameStore();

                result.Success = true;
            }
            else
            {
                result.Success = false;
                result.Error   = realizeLotteryResult.Error;
            }

            return(result);
        }
Beispiel #17
0
 public abstract RealizeLotteryResult RealizeLottery(IGameStore <Game> store);
Beispiel #18
0
 public GamesController(IGameStore gamestore)
 {
     this.gamestore = gamestore;
 }
Beispiel #19
0
 public Quest(IGameStore gameStore, IEventInventory eventInventory)
 {
     _gameStore      = gameStore;
     _eventInventory = eventInventory;
 }
 public GameController(IGameStore store, ISymbolStore symbolStore)
 {
     _store       = store;
     _symbolStore = symbolStore;
 }
Beispiel #21
0
 public GameDetailsModel(IGameStore gameStore, IImageStore imageStore)
 {
     _gameStore  = gameStore ?? throw new ArgumentNullException(nameof(gameStore));
     _imageStore = imageStore ?? throw new ArgumentNullException(nameof(imageStore));
 }
Beispiel #22
0
 public PlayerGraphGenerator(Player player, IGameStore drawStore)
 {
     _player    = player;
     _drawStore = drawStore;
 }
 public GamesController(IGameStore gameStore)
 {
     _gameStore = gameStore;
 }
Beispiel #24
0
        public static Quest Create(IGameStore gameStore)
        {
            var eventInventory = new Inventory();

            return(new Quest(gameStore, eventInventory));
        }
Beispiel #25
0
 public UploadCardsModel(ICardStore cardStore, IGameStore gameStore, IImageStore imageStore)
 {
     _cardStore  = cardStore ?? throw new ArgumentNullException(nameof(cardStore));
     _gameStore  = gameStore ?? throw new ArgumentNullException(nameof(gameStore));
     _imageStore = imageStore ?? throw new ArgumentNullException(nameof(imageStore));
 }
Beispiel #26
0
 public HomeModel(IGameStore gameStore)
 {
     _gameStore = gameStore ?? throw new ArgumentNullException(nameof(gameStore));
 }
Beispiel #27
0
 public void CantBeConstructedWithNull(IGameStore store, INavigationService navigation)
 {
     Assert.Throws<ArgumentNullException>(() => new DashboardViewModel(store, navigation));
 }
Beispiel #28
0
 public CardsController(IGameStore gameStore, ICardStore cardStore, IImageStore imageStore)
 {
     _gameStore  = gameStore ?? throw new ArgumentNullException(nameof(gameStore));
     _cardStore  = cardStore ?? throw new ArgumentNullException(nameof(cardStore));
     _imageStore = imageStore ?? throw new ArgumentNullException(nameof(imageStore));
 }
Beispiel #29
0
 public GameController(IGameStore gameStore, IHubContext <GameHub> context)
 {
     _store   = gameStore;
     _clients = context.Clients;
 }
Beispiel #30
0
 public LotteryProgram()
 {
     this.GameStore        = new GameStore();
     this.HistoryLotteries = new Dictionary <int, RealizeLotteryResult>();
     this._lottery         = (TLottery)Activator.CreateInstance(typeof(TLottery));
 }
Beispiel #31
0
 public OrdersController(OrderService orderService, IGameStore gameStore, ILogger <OrdersController> logger)
 {
     _orderService = orderService;
     _gameStore    = gameStore;
     _logger       = logger;
 }
Beispiel #32
0
 public GameManager(IGameStore gameStore)
 {
     _gameStore = gameStore;
 }
Beispiel #33
0
 public GameValidator(
     IGameStore store
     )
 {
     _store = store;
 }