public override void result_handle(IResult result) { LogView.AddLog(result.RawResult); LogView.AddLog("me handler ok"); IDictionary dict = Json.Deserialize(result.RawResult) as IDictionary; LogView.AddLog("me handler name = " + dict["name"]); LogView.AddLog("me handler id = " + dict["id"]); //next setp this.call_back(dict ["name"], dict ["name"]); //this.call_back ("ok"); //this.call_back ("秋哥","的unity"); }
private void OnInitComplete() { string logMessage = string.Format( "OnInitCompleteCalled IsLoggedIn='{0}' IsInitialized='{1}'", FB.IsLoggedIn, FB.IsInitialized); LogView.AddLog(logMessage); //登入流程 //if (!FB.IsLoggedIn) { this.CallFBLogin(); //} }
//private public override void result_handle(IResult result) { LogView.AddLog(result.RawResult); LogView.AddLog("permission ok login"); //next step //_me_handler = new me_handler (); //_me_handler.call_back = this.call_back; //FB.API("/me", HttpMethod.GET, _me_handler.result_handle); //next step _Friends_handler = new Friends_handler(); _Friends_handler.call_back = this.call_back; FB.API("/me/friends", HttpMethod.GET, _Friends_handler.result_handle); //or /me?fields=id,name }
protected override void GetGui() { if (this.Button("Log FB App Event")) { this.Status = "Logged FB.AppEvent"; FB.LogAppEvent( AppEventName.UnlockedAchievement, null, new Dictionary <string, object>() { { AppEventParameterName.Description, "Clicked 'Log AppEvent' button" } }); LogView.AddLog( "You may see results showing up at https://www.facebook.com/analytics/" + FB.AppId); } }
private void HandleResult(IResult result) { if (result == null) { this.LastResponse = "Null Response\n"; LogView.AddLog(this.LastResponse); return; } //this.LastResponseTexture = null; // Some platforms return the empty string instead of null. if (!string.IsNullOrEmpty(result.Error)) { this.Status = "Error - Check log for details"; this.LastResponse = "Error Response:\n" + result.Error; LogView.AddLog(result.Error); } else if (result.Cancelled) { this.Status = "Cancelled - Check log for details"; this.LastResponse = "Cancelled Response:\n" + result.RawResult; LogView.AddLog(result.RawResult); } else if (!string.IsNullOrEmpty(result.RawResult)) { this.Status = "Success - Check log for details"; this.LastResponse = "Success Response:\n" + result.RawResult; this.result_handle(result); LogView.AddLog(result.RawResult); } else { this.LastResponse = "Empty Response\n"; LogView.AddLog(this.LastResponse); } }
public override void result_handle(IResult result) { LogView.AddLog(result.RawResult); LogView.AddLog("Friends handler ok"); // { // "data": [ // { // "name": "Zheng-Wei Lin", // "id": "100000167846430" // }, // { // "name": "陳昌徹", // "id": "100000219986343" // }, // { // "name": "鐘義翔", // "id": "100000227531660" // } // ], // "paging": { // "next": "https://graph.facebook.com/v2.5/10152787845443271/friends?limit=25&offset=25&format=json&access_token=CAACEdEose0cBAEw1ki9j7ZBp6jvyUOnmbjDXvAxpXqtSz7cJIxePZBKMoYcpvy4gAlCqLd1LYqDiIN1nD3IlSl4KQLUVtxAxVaQu7cZCr2cAowmBsHbJydE0iGvwTN3inmtAva4P9yilCoBkSLZC5bMIsuxu5Ttbzg06zrFWwGKhpDBqp4GO5JGUqf2ZAZB0nHP6aXfsNJ8MIfD9JFqMJ2&__after_id=enc_AdA9jySi8YDX8rMZCbSAEB6Rdplo4dxH95OCiDYSfses6XZASWOIzTt8UBenFsWN2HX4lyITnb8O1yY9TWZC8efsxk4" // }, // "summary": { // "total_count": 121 // } // } JObject jo = new JObject(); jo = JsonConvert.DeserializeObject <JObject>(result.RawResult); Dictionary <string, object> pack = new Dictionary <string, object> (); JObject jo2 = new JObject(); jo2 = JsonConvert.DeserializeObject <JObject> (jo.Property("summary").Value.ToString()); string total_count = jo2.Property("total_count").Value.ToString(); LogView.AddLog("Friends handler dict= " + total_count); JArray jo3 = new JArray(); jo3 = JsonConvert.DeserializeObject <JArray> (jo.Property("data").Value.ToString()); List <string> name = new List <string>(); List <string> id = new List <string>(); for (int i = 0; i < jo3.Count; i++) { JObject ch = (JObject)jo3[i]; name.Add(ch.Property("name").Value.ToString()); id.Add(ch.Property("id").Value.ToString()); } LogView.AddLog("Friends handler name= " + String.Join(",", name.ToArray())); LogView.AddLog("Friends handler id= " + String.Join(",", id.ToArray())); //next setp //this.call_back (dict ["name"], dict ["name"]); }