예제 #1
0
    private EventHandler JoinClick(Game game)
    {
        return(async(sender, args) =>
        {
            try
            {
                var response = await ApiWrapper.GameJoin(game.Id);

                Game.Join(response);
            }
            catch (BadResponseException e)
            {
                var errorMessage = (string)e.Response["error"]["message"];

                Debug.Log(errorMessage);
                errorText.transform.GetComponent <TextMeshProUGUI>().text = errorMessage;
            }
            catch (Exception e)
            {
                Debug.Log(e); // TODO: Show error to player
            }
        });
    }