示例#1
0
    void FriendsCallback(FBResult result)
    {
        Debug.Log("FriendsCallback");

        var friendData = JSON.Parse(result.Text);
        //Debug.Log(friendData);

        string friendAllCount = friendData["summary"]["total_count"];

        //Debug.Log("friend ALL Count  : " + friendAllCount);

        dbo.DelFbFriendInfo(); gameFriendCnt = 0;
        for (int i = 0; i < int.Parse(friendAllCount); i++)
        {
            friendId       = friendData["data"][i]["id"];
            friendName     = friendData["data"][i]["name"];
            friendImageUrl = friendData["data"][i]["picture"]["data"]["url"];
            //Debug.Log("friend Id="+friendId+" Name="+friendName+" URL="+friendImageUrl);

            if (friendName != null && friendName.Length > 2)
            {
                gameFriendCnt++;
                //Debug.Log("friend1111 Id="+friendId+" Name="+friendName+" URL="+friendImageUrl);
                dbo.InsFbFriendInfo(friendId, friendName, friendImageUrl);
                StartCoroutine(SaveFbPicture(friendImageUrl, friendId + ".jpg"));
            }
        }
        if (gameFriendCnt > 0)
        {
            //Debug.Log("friend2222 Id="+g.fbId+" Name="+fbUserName+" URL="+fbUserLink);
            dbo.InsFbFriendInfo(g.fbId, fbUserName, fbUserLink);
        }

        //--------------------
        // Score
        //--------------------
        StartCoroutine(dbow.SelFbFriendScore());

        //FacebookPostMyScore("100");
        //FacebookGetScores();

        //var query = new Dictionary<string, string>();
        //query["score"] = "89";
        //FB.API("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult r) { Debug.Log("Result: " + r.Text); }, query);

        //FB.API("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult r) { Debug.Log("Result: " + r.Text); }, query);

        //FB.API("/1483906351878206/scores", Facebook.HttpMethod.POST, OnPost, scoreData);
        //FB.API("/app/scores", Facebook.HttpMethod.GET, ProcessRanking);
        //FB.API("/app/scores/fields=score,user.limit(20)", Facebook.HttpMethod.GET, ProcessRanking);
    }