Пример #1
0
    // Use this for initialization
    void Start()
    {
        GameManager.Instance.smallMenu        = mainObject;
        GameManager.Instance.friendButtonMenu = AddFriendButton;

        if (!GameManager.Instance.offlineMode)
        {
            GetFriendsListRequest request = new GetFriendsListRequest();
            request.IncludeFacebookFriends = true;
            PlayFabClientAPI.GetFriendsList(request, (result) => {
                var friends = result.Friends;
                foreach (var friend in friends)
                {
                    if (PhotonNetwork.otherPlayers[0].name.Equals(friend.FriendPlayFabId))
                    {
                        Debug.Log("Already friends");
                        AddFriendButton.SetActive(false);
                        mainObject.GetComponent <RectTransform>().sizeDelta = new Vector2(mainObject.GetComponent <RectTransform>().sizeDelta.x, 260.0f);
                        break;
                    }
                }
            }, OnPlayFabError);
        }
        else
        {
            AddFriendButton.SetActive(false);
            mainObject.GetComponent <RectTransform>().sizeDelta = new Vector2(mainObject.GetComponent <RectTransform>().sizeDelta.x, 260.0f);
        }
    }
Пример #2
0
    public void getplayfabfriends()
    {
        var request = new GetFriendsListRequest {
            IncludeFacebookFriends = false, IncludeSteamFriends = false, XboxToken = null
        };

        PlayFabClientAPI.GetFriendsList(request, OnFriendslistSuccess, onfailure);
    }
Пример #3
0
    private void GetPlayfabFriends()
    {
        var request = new GetFriendsListRequest {
            IncludeSteamFriends = false
        };

        PlayFabClientAPI.GetFriendsList(request, OnFriendListSuccess, OnFailure);
    }
Пример #4
0
    public void GetFriendListFromServer()
    {
        GetFriendsListRequest request = new GetFriendsListRequest();

        request.ProfileConstraints = new PlayerProfileViewConstraints()
        {
            ShowLastLogin   = true,
            ShowDisplayName = true,
            ShowAvatarUrl   = true
        };
        PlayFabClientAPI.GetFriendsList(request, onFriendListUpdate, OnPlayFabError);
    }
Пример #5
0
    /// <summary>
    /// Function that will update/reload the friends list
    /// </summary>
    public void UpdateFriendsList()
    {
        GetFriendsListRequest req = new GetFriendsListRequest
        {
            ProfileConstraints = new PlayerProfileViewConstraints()
            {
                ShowLastLogin = true, ShowDisplayName = true
            },
            IncludeFacebookFriends = true
        };

        PlayFabClientAPI.GetFriendsList(req, r =>
        {
            _friends = r.Friends;
        }, OnFailure);
    }
Пример #6
0
        public static async UniTask SyncPlayFabToClientAsync()
        {
            var request = new GetFriendsListRequest
            {
                ProfileConstraints = new PlayerProfileViewConstraints
                {
                    ShowDisplayName = true,
                    ShowLastLogin   = true,
                    ShowStatistics  = true,
                }
            };

            var response = await PlayFabClientAPI.GetFriendsListAsync(request);

            if (response.Error != null)
            {
                throw new PlayFabErrorException(response.Error);
            }

            Friends = response.Result.Friends.Select(x => FriendUser.CreateFromFriendInfo(x)).ToDictionary(y => y.PlayFabId);
        }
Пример #7
0
    public void OnClickButton()
    {
        this.gameObject.SetActive(!this.gameObject.activeSelf);
        if (PlayFabClientAPI.IsClientLoggedIn())
        {
            if (this.gameObject.activeSelf)
            {
                var request = new GetFriendsListRequest();
                request.ProfileConstraints = new PlayerProfileViewConstraints();
                request.ProfileConstraints.ShowDisplayName = true;

                PlayFabClientAPI.GetFriendsList(request, (result) => {
                    _friends = result.Friends;
                    FriendListRefresh();
                }, (error) => { lobbyManager.ErrorPopup(error.GenerateErrorReport(), true); });
            }
        }
        else
        {
            lobbyManager.ErrorPopup("PlayfabIsNotLoggined", true);
        }
    }
Пример #8
0
    public static void GetFriendsList(UnityAction callback = null)
    {
        var request = new GetFriendsListRequest
        {
            IncludeFacebookFriends = true,
            IncludeSteamFriends    = false
        };

        //DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetFriendList);
        PlayFabClientAPI.GetFriendsList(request, result =>
        {
            playerFriends.Clear();
            foreach (var eachFriend in result.Friends)
            {
                playerFriends.Add(eachFriend);
            }
            if (callback != null)
            {
                callback();
            }
            PF_Bridge.RaiseCallbackSuccess(string.Empty, PlayFabAPIMethods.GetFriendList, MessageDisplayStyle.none);
        }, PF_Bridge.PlayFabErrorCallback);
    }
Пример #9
0
 public static IEnumerator <GetFriendsListResult> Do(GetFriendsListRequest request)
 {
     // TODO [bgish] - should really cache this, and update friends list whenever add/remove.  If cached, then return the list instead of call this
     return(Do <GetFriendsListRequest, GetFriendsListResult>(request, PlayFabClientAPI.GetFriendsList));
 }
 public UnityTask <GetFriendsListResult> Do(GetFriendsListRequest request)
 {
     // TODO [bgish] - should really cache this, and update friends list whenever add/remove.  If cached, then return the list instead of call this
     return(this.Do <GetFriendsListRequest, GetFriendsListResult>(request, PlayFabClientAPI.GetFriendsListAsync));
 }