예제 #1
0
    private void HandleMyFBData(MyFacebookData fbData)
    {
        FBPlayer      player  = fbData.Player;
        List <object> friends = fbData.Friends;

        if (!PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.ContainsKey(player.Id))
        {
            PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[fbData.Player.Id] = player;
        }
        SaveProfilePictureToFile(player.ProfilePicture, player.Id);
        UpdateLeaderboards.SetValueAndForceNotify(value: true);
        PlayerID.Value   = player.Id;
        PlayerName.Value = player.Name;
        List <string> list = new List <string>();

        for (int i = 0; i < friends.Count; i++)
        {
            Dictionary <string, object> dictionary = (Dictionary <string, object>)friends[i];
            if (dictionary.ContainsKey("id"))
            {
                string text = (string)dictionary["id"];
                if (PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.ContainsKey(text))
                {
                    FBPlayer fBPlayer = PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[(string)dictionary["id"]];
                    fBPlayer.Playing = true;
                }
                else
                {
                    list.Add(text);
                }
            }
        }
        if (list.Count > 0)
        {
            FBPlayersFromIDs(list);
        }
    }
예제 #2
0
        private void OnFBDataRecieved(IGraphResult result)
        {
            MyFacebookData myFacebookData = JsonUtility.FromJson <MyFacebookData>(result.RawResult);

            Status.text = "Welcome " + myFacebookData.name;
        }