コード例 #1
0
    private static void ReceiveFriendsScores(IResult result, ScoreArrayDelegate tmpScoreArrayDelegate)
    {
        if (result.Error == null)
        {
            ArrayList list = new ArrayList();
            Dictionary <string, object> resultDict = (Dictionary <string, object>)Facebook.MiniJSON.Json.Deserialize(result.RawResult);

            foreach (object entryObj in (List <object>)resultDict["data"])
            {
                Dictionary <string, object> entry = (Dictionary <string, object>)entryObj;
                Dictionary <string, object> user  = (Dictionary <string, object>)entry ["user"];

                ScoreData data = new ScoreData();
                data.score     = int.Parse(entry ["score"].ToString());
                data.user_id   = user ["id"].ToString();
                data.user_name = user ["name"].ToString();
                list.Add(data);
            }
            if (tmpScoreArrayDelegate != null)
            {
                tmpScoreArrayDelegate(list.ToArray(typeof(ScoreData)) as ScoreData[]);
            }
        }
        else
        {
            Debug.Log(result.Error);
            if (tmpScoreArrayDelegate != null)
            {
                tmpScoreArrayDelegate(null);
            }
        }
    }
コード例 #2
0
 public static void RequestFriendsScores(ScoreArrayDelegate s)
 {
     FB.API("app/scores?fields=score,user.limit(30)", HttpMethod.GET, ((IGraphResult result) => ReceiveFriendsScores(result, s)));
 }