Ejemplo n.º 1
0
        public void RequestFriendsData()
        {
            //ShowHideDialog(4, true);
            ClearUserFriendsData();
            FB.API(getFriendsInfoString, HttpMethod.GET, delegate(IGraphResult result)
            {
                if (string.IsNullOrEmpty(result.Error) && !result.Cancelled)
                {
                    List <object> data = result.ResultDictionary["data"] as List <object>;

                    for (int i = 0; i < data.Count; i++)
                    {
                        string fName = Convert.ToString(((Dictionary <string, object>)data[i])["name"]);
                        string fId   = Convert.ToString(((Dictionary <string, object>)data[i])["id"]);

                        ItemGameScore tempItem = Instantiate(userFriendsPrefab, userFriendsParent, false) as ItemGameScore;
                        tempItem.AssignValues(fName, fId);
                        listUserFriends.Add(tempItem);
                    }
                    countInstalledFriends.text = data.Count.ToString();
                    IDictionary summary        = result.ResultDictionary["summary"] as IDictionary;
                    countFriends.text          = summary["total_count"].ToString();

                    print(string.Format("Friends Who Installed {0}, Total Friends", data.Count, countFriends.text));
                }
                else
                {
                    print("Failed to Get Current App Score! You can try again!");
                }

                ShowHideLoader(3, false);
            });
        }
Ejemplo n.º 2
0
        public void GetAllScores()
        {
            ShowHideDialog(3, true);
            ClearGameScores();
            FB.API(getAllScoresString, HttpMethod.GET, delegate(IGraphResult result)
            {
                if (string.IsNullOrEmpty(result.Error) && !result.Cancelled)
                {
                    List <object> data = result.ResultDictionary["data"] as List <object>;

                    for (int i = 0; i < data.Count; i++)
                    {
                        string score = Convert.ToString(((Dictionary <string, object>)data[i])["score"]);
                        Dictionary <string, object> appData = ((Dictionary <string, object>)data[i])["application"] as Dictionary <string, object>;

                        string gameName = Convert.ToString(appData["name"]);

                        ItemGameScore tempItem = Instantiate(gameScorePref, allGamesScoresParent, false) as ItemGameScore;
                        tempItem.AssignValues(gameName, score);
                        listGameScore.Add(tempItem);
                    }
                }
                ShowHideLoader(2, false);
            });
        }