private void GetPlayerData() { var request = new GetPlayerProfileRequest(); request.PlayFabId = playFabID; var constraints = new PlayerProfileViewConstraints(); constraints.ShowContactEmailAddresses = true; request.ProfileConstraints = constraints; PlayFabClientAPI.GetPlayerProfile(request, OnPlayerDataResult, OnPlayFabError); }
private void Start() { PlayerProfileViewConstraints playerProfileViewConstraints = new PlayerProfileViewConstraints(); playerProfileViewConstraints.ShowContactEmailAddresses = true; playerProfileViewConstraints.ShowDisplayName = true; PlayFabClientAPI.GetPlayerProfile(new GetPlayerProfileRequest { ProfileConstraints = playerProfileViewConstraints }, ProfileResult => { Username.text = ProfileResult.PlayerProfile.DisplayName; Email.text = ProfileResult.PlayerProfile.ContactEmailAddresses[0].EmailAddress; EmailChange.text = ProfileResult.PlayerProfile.ContactEmailAddresses[0].EmailAddress; }, ProfileError => Debug.Log(ProfileError.GenerateErrorReport())); Password.text = PlayerPrefs.GetString("Password"); }
public PlayFabManager GetPlayersLevelLeaderboard() { if (PlayFabClientAPI.IsClientLoggedIn()) { List <PlayerLeaderboardEntry> respone = null; PlayerProfileViewConstraints profileViewConstraints = new PlayerProfileViewConstraints() { ShowDisplayName = true, ShowLinkedAccounts = true }; GetFriendLeaderboardRequest request = new GetFriendLeaderboardRequest() { StatisticName = _levelsCountLeaderboardId, MaxResultsCount = 100, IncludeFacebookFriends = true, ProfileConstraints = profileViewConstraints }; PlayFabClientAPI.GetFriendLeaderboard(request, (result) => { respone = result.Leaderboard; var newLeaderboardList = new List <UserLeaderboardData>(); foreach (var playerLeaderboardEntry in respone) { string fbId = ""; var linkedAccounts = playerLeaderboardEntry.Profile.LinkedAccounts; if (linkedAccounts != null && linkedAccounts.Any()) { foreach (var linkedPlatformAccountModel in linkedAccounts) { if (linkedPlatformAccountModel.Platform.Equals(LoginIdentityProvider.Facebook)) { fbId = linkedPlatformAccountModel.PlatformUserId; } } } var userData = new UserLeaderboardData() { DisplayName = playerLeaderboardEntry.DisplayName, PlayFabId = playerLeaderboardEntry.PlayFabId, Position = playerLeaderboardEntry.Position, LeaderboardValue = playerLeaderboardEntry.StatValue, FacebookId = fbId }; newLeaderboardList.Add(userData); } if (OnLevelsLeaderboardLoaded != null) { OnLevelsLeaderboardLoaded.Invoke(newLeaderboardList); } }, (error) => { Debug.Log("Error getting game leaderboard:"); Debug.Log(error.ErrorMessage); Debug.Log(error.ErrorDetails); }); } return(this); }