private static IEnumerator<WWW> SendHigh(HighScoreCallback callback) { WWW req = new WWW("http://" + domain + "/high"); yield return req; string[] res = req.text.Split('\n'); Score[] scores = new Score[res.Length]; for (int i = 0; i < res.Length; ++i) { string[] each = res[i].Split(':'); WWW fb = new WWW("http://graph.facebook.com/" + each[0]); yield return fb; string uname = new JSONObject(fb.text).GetField("username").str; WWW pr = new WWW("http://graph.facebook.com/" + each[0] + "/picture"); yield return pr; scores[i] = new Score(uname, pr.texture, int.Parse(each[1])); } callback(scores); }
private static IEnumerator <WWW> SendHigh(HighScoreCallback callback) { WWW req = new WWW("http://" + domain + "/high"); yield return(req); string[] res = req.text.Split('\n'); Score[] scores = new Score[res.Length]; for (int i = 0; i < res.Length; ++i) { string[] each = res[i].Split(':'); WWW fb = new WWW("http://graph.facebook.com/" + each[0]); yield return(fb); string uname = new JSONObject(fb.text).GetField("username").str; WWW pr = new WWW("http://graph.facebook.com/" + each[0] + "/picture"); yield return(pr); scores[i] = new Score(uname, pr.texture, int.Parse(each[1])); } callback(scores); }
public static void GetHighScores(HighScoreCallback callback) { sender.StartCoroutine(SendHigh(callback)); }