Esempio n. 1
0
        public async Task <IActionResult> GameStart(int roomId)
        {
            if (gameServer.gameHelper.gameTasks.FirstOrDefault(game => game.Game.Room.Id == roomId) != null &&
                gameServer.gameHelper.gameTasks.FirstOrDefault(game => game.Game.Room.Id == roomId).IsStarted)
            {
                return(Ok("Gra dla tego pokoju już działa."));
            }

            var room = await roomService.GetRoom(roomId);

            // if (room.Players.Count < 2)
            // return Ok("Oczekiwanie na graczy.");

            gameServer.CreateGame(roomId);

            return(Ok());
        }