Esempio n. 1
0
        public async Task <GameLogicViewModel> StartNewGame([FromQuery] string playerName, [FromQuery] int numberOfBots)
        {
            GameLogicViewModel result = null;

            //var userId = HttpContext.Session.GetString(SessionKeyPlayerId);
            //if (string.IsNullOrEmpty(userId))
            //{
            //    result = await _gameLogicService.StartNewGame(playerName, numberOfBots);
            //    userId = "";
            //    foreach(var player in result.Players)
            //    {
            //        if (!player.IsBot)
            //            userId = player.Id;
            //    }
            //    HttpContext.Session.SetString(SessionKeyPlayerId, userId);
            //}
            //else
            //{
            //    result = await _gameLogicService.StartNewGame(playerName, numberOfBots, userId);
            //}
            result = await _gameLogicService.StartNewGame(playerName, numberOfBots);

            return(result);
        }
Esempio n. 2
0
        public async Task <GameLogicViewModel> StartNewGame(string playerName, int numberOfBots)
        {
            var result = await _gameLogicService.StartNewGame(playerName, numberOfBots);

            return(result);
        }