示例#1
0
    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);
    }
示例#2
0
    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);
    }
示例#3
0
 public static void GetHighScores(HighScoreCallback callback)
 {
     sender.StartCoroutine(SendHigh(callback));
 }
示例#4
0
 public static void GetHighScores(HighScoreCallback callback)
 {
     sender.StartCoroutine(SendHigh(callback));
 }