Esempio n. 1
0
    public void getMyProfilePicture(string userID)
    {
        //FB.API("/" + userID + "/picture?type=square&height=92&width=92", Facebook.Unity.HttpMethod.GET, delegate(IGraphResult result) {
        FB.API("/me?fields=picture.width(200).height(200)", Facebook.Unity.HttpMethod.GET, delegate(IGraphResult result)
        {
            if (result.Error == null)
            {
                // use texture

                Dictionary <string, object> reqResult = Json.Deserialize(result.RawResult) as Dictionary <string, object>;

                if (reqResult == null)
                {
                    Debug.Log("JEST NULL");
                }
                else
                {
                    Debug.Log("nie null");
                }


                GameManager.Instance.avatarMyUrl = ((reqResult["picture"] as Dictionary <string, object>)["data"] as Dictionary <string, object>)["url"] as string;
                Debug.Log("My avatar " + GameManager.Instance.avatarMyUrl);

                StartCoroutine(loadImageMy(GameManager.Instance.avatarMyUrl));

                //GameManager.Instance.avatarMy = Sprite.Create(result.Texture, new Rect(0, 0, result.Texture.width, result.Texture.height), new Vector2(0.5f, 0.5f), 32);

                if (GameManager.Instance.LinkFbAccount)
                {
                    playFabManager.LinkFacebookAccount();
                }
                else
                {
                    playFabManager.LoginWithFacebook();
                }
            }
            else
            {
                Debug.Log("Error retreiving image: " + result.Error);
            }
        });
    }
Esempio n. 2
0
    /// <summary>
    /// Called when facebook login completes.
    /// </summary>
    /// <param name="accessToken">Facebook's access token</param>
    /// <param name="facebookName">Facebook's user name</param>
    void OnFacebookLoginCompleted(string accessToken, string facebookName, string facebookPictureURL)
    {
        this.facebookPictureURL = facebookPictureURL;

        playFabManager.LoginWithFacebook(accessToken, facebookName, facebookPictureURL, OnPlayFabLoginCompleted);
    }