private IEnumerator fetchProfilePic(string url, GetProfilePicCallback callback = null) { WWW www = new WWW(url); yield return(www); //wait until it has downloaded if (www.error == null) { callback?.Invoke(true, www.texture); // return Texture2D } else { callback?.Invoke(false, null); } }
public void GetProfilePic(GetProfilePicCallback callback = null) { loginAPI.GetProfilePic(delegate(bool result, Texture2D tex) { callback?.Invoke(result, tex); }); }
public override void GetProfilePic(GetProfilePicCallback callback = null) { FB.API("/me/picture?redirect=false", HttpMethod.GET, delegate(IGraphResult picResult) { if (String.IsNullOrEmpty(picResult.Error) && !picResult.Cancelled) { IDictionary data = picResult.ResultDictionary["data"] as IDictionary; string photoURL = data["url"] as String; monoScript.StartCoroutine(fetchProfilePic(photoURL, callback)); } else { callback?.Invoke(false, null); } }); }