Ejemplo n.º 1
0
        public async Task CreatePlayer(string name)
        {
            Player human = await _playerRepository.SelectByName(name, (int)PlayerType.Human);

            if (human == null)
            {
                human = CustomMapper.GetPlayer(name, PlayerType.Human);
                await _playerRepository.Create(human);
            }
        }
Ejemplo n.º 2
0
        private async Task <List <Player> > CreatePlayerList(long playerId, int amountOfBots)
        {
            var    players = new List <Player>();
            var    random  = new Random();
            Player dealer  = CustomMapper.GetPlayer(((BotName)random.Next(GameValueHelper.BotNameAmount)).ToString(), PlayerType.Dealer);

            players.Add(dealer);

            for (int i = 0; i < amountOfBots; i++)
            {
                Player bot = CustomMapper.GetPlayer(((BotName)random.Next(GameValueHelper.BotNameAmount)).ToString(), PlayerType.Bot);
                players.Add(bot);
            }

            players = await _playerRepository.CreateMany(players);

            players.Add(await _playerRepository.Get(playerId));
            return(players);
        }