コード例 #1
0
    private void AuthCallback(ILoginResult result)
    {
        if (FB.IsLoggedIn)
        {
            // AccessToken class will have session details
            var aToken = AccessToken.CurrentAccessToken;

            FBAccessToken fbAccessToken = new FBAccessToken();
            fbAccessToken.TokenString = aToken.TokenString;
            fbAccessToken.UserType    = "Instructor";

            StartCoroutine(
                HTTPClient.Post("/updateUser", JsonUtility.ToJson(fbAccessToken), statusCode => {
                if (statusCode == "200")
                {
                    SceneManager.LoadScene("SetupMeditationRoom");
                }
                else
                {
                    HFTDialog.MessageBox("Authentication error", "Facebook authentication failed.", () => {
                        Debug.Log("statusCode");
                        Debug.Log(statusCode);
                    });
                }
            })
                );
        }
        else
        {
            Debug.Log("Error");
            Debug.Log(result);
            Debug.Log(result.Error);
            Debug.Log("User cancelled login");
        }
    }
コード例 #2
0
    static public void MessageBox(string title, string msg, Action action)
    {
        GameObject go  = new GameObject("HFTDialog");
        HFTDialog  dlg = go.AddComponent <HFTDialog>();

        dlg.Init(title, msg, action);
    }