예제 #1
0
        public async Task JoinGame(string userName)
        {
            try
            {
                // Add the player to gamecontroller
                Player p = new Player();
                p.ConnectionId = Context.ConnectionId;
                p.Name         = userName;
                _gameController.AddPlayer(p);
                // Check if everyone has joined
                // if not -> return
                if (!_gameController.HasEveryoneJoined())
                {
                    return;
                }

                // If so -> draw 10 cards for everyone
                await _gameController.DrawStartingHands();

                //_gameController.GetAllPlayerInfo();
                await _gameController.SetUpRound();


                // Tell all clients their hands
            }
            catch
            {
                Console.WriteLine("Something went wrong joining a user to the game");
            }
        }