コード例 #1
0
        //Client requests to join game
        public void RequestJoinGame(M_Player myPlayer, string gameKey)
        {
            if (gameController.GetGame(gameKey).GameQuestions.Count == 0)
            {
                try
                {
                    gameController.AddPlayerToGame(myPlayer, gameKey);
                }
                catch (Exception e)
                {
                    Clients.Caller.DisplayError("Oops! Something went wrong :( Try that again!", e);
                }

                Groups.Add(Context.ConnectionId, gameKey);
                UpdatePlayerListScreen(gameKey);
            }
            else
            {
                Clients.Caller.DisplayError("Sorry! We can't add you to a game that is already started. :(");
            }
        }