public void LoadFriendAPI(string id, FriendDataDelegate callback = null) { string query = "/" + id + "?fields=id,first_name,picture.width(120).height(120)"; FB.API(query, HttpMethod.GET, delegate(IGraphResult result) { if (result.Error == null) { object value = string.Empty; result.ResultDictionary.TryGetValue("first_name", out value); FBPlayer f = new FBPlayer(id, (string)value, playing: false, invited: false, 0, 0L); string url = GraphUtil.DeserializePictureURL(result.ResultDictionary); LoadFriendPicture(url, f, callback); } }); }
private void LoadFriendPicture(string url, FBPlayer f, FriendDataDelegate callback = null) { GraphUtil.LoadImgFromURL(url, delegate(Texture pictureTexture) { if (pictureTexture == null) { LoadFriendPicture(url, f, callback); } else { f.ProfilePicture = (pictureTexture as Texture2D); if (callback != null) { callback(f); } } }); }