c# - unity3d webplayer how to display all facebook user photos -


i new in facebook integration in app log in through facebook,

but, want to,
facebook user photos
display them scene in unity
have search web, find nothing,
please can give me example guide me in right path?

it's been week , did not find solution.
these scripts
first script

using system.collections; using system.collections.generic; using unityengine; using facebook.minijson;  public class util : scriptableobject { public static string getpictureurl(string facebookid, int? width = null, int? height = null, string type = null) {     string url = string.format("/{0}/picture", facebookid);     string query = width != null ? "&width=" + width.tostring() : "";     query += height != null ? "&height=" + height.tostring() : "";     query += type != null ? "&type=" + type : "";     if (query != "") url += ("?g" + query);     return url; }  public static void friendpicturecallback(fbresult result) {     if (result.error != null)     {         debug.logerror(result.error);         return;     }   }  public static dictionary<string, string> randomfriend(list<object> friends) {     var fd = ((dictionary<string, object>)(friends[random.range(0, friends.count - 1)]));     var friend = new dictionary<string, string>();     friend["id"] = (string)fd["id"];     friend["first_name"] = (string)fd["first_name"];     return friend; }  public static dictionary<string, string> deserializejsonprofile(string response) {     var responseobject = json.deserialize(response) dictionary<string, object>;     object nameh;     var profile = new dictionary<string, string>();     if (responseobject.trygetvalue("first_name", out nameh))     {         profile["first_name"] = (string)nameh;     }     return profile; }  public static list<object> deserializescores(string response)  {      var responseobject = json.deserialize(response) dictionary<string, object>;     object scoresh;     var scores = new list<object>();     if (responseobject.trygetvalue ("data", out scoresh))      {         scores = (list<object>) scoresh;     }      return scores; }  public static list<object> deserializejsonfriends(string response) {     var responseobject = json.deserialize(response) dictionary<string, object>;     object friendsh;     var friends = new list<object>();     if (responseobject.trygetvalue("friends", out friendsh))     {         friends = (list<object>)(((dictionary<string, object>)friendsh)["data"]);     }     return friends; }   public static list<object> deserializejsonallpictures(string response) {     var responseobject = json.deserialize(response) dictionary<string, object>;     object picturesh;     var pictures = new list<object>();     if (responseobject.trygetvalue ("pictures", out picturesh))      {         pictures = (list<object>)(((dictionary<string,object>)picturesh)["data"]);     }     return pictures; }  public static void drawactualsizetexture (vector2 pos, texture texture, float scale = 1.0f) {     rect rect = new rect (pos.x, pos.y, texture.width * scale , texture.height * scale);     gui.drawtexture(rect, texture); } public static void drawsimpletext (vector2 pos, guistyle style, string text) {     rect rect = new rect (pos.x, pos.y, screen.width, screen.height);     gui.label (rect, text, style); } } 

second script

using unityengine; using system.collections; using unityengine.ui; using facebook; public class facbookholder : monobehaviour { public gameobject picture; public string get_data; public string fbname; void awake() {     fb.init (setinit, onhideunity); }  private void setinit() {     debug.log("fb init done");     if (fb.isloggedin) {         debug.log ("fb logged in");     }else {         //fblogin();     } }   private void onhideunity(bool isgameshown) {     if (!isgameshown) {         time.timescale = 0;     } else      {         time.timescale = 1;     } } public void fblogin() {     fb.login ("email", authcallback); } void authcallback(fbresult result) {     if (fb.isloggedin) {         debug.log ("user logged in");     } else {         debug.log("login failed");     } } void getpicture() {     if (fb.isloggedin) {         fb.api(util.getpictureurl("me",100,100) , facebook.httpmethod.get, profilepicture);      } } void profilepicture(fbresult result) {     if (result.error != null) {         debug.log ("problem profile picture");         fb.api (util.getpictureurl ("me", 100, 100), facebook.httpmethod.get, profilepicture);          debug.log ("picture");         return;     } else {         debug.log("errrooooooooooorrrrr");     }     image userpicture = picture.getcomponent<image> ();     userpicture.sprite = sprite.create (result.texture, new rect (0, 0, 100, 100), new vector2 (50, 50)); }  void getuserpictures() {     if (fb.isloggedin) {         fb.api(util.getpictureurl("/me/photos/uploaded",100,100) , facebook.httpmethod.get, profilepicture);         return;     }  } } 


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -