반응형
플레이팹 로그인이 되었다는 가정하에 진행
데이터 가져오기
using PlayFab;
using PlayFab.ClientModels;
using PlayFab.Json;
using PlayFab.ProfilesModels;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayfabManager : MonoBehaviour
{
private void DisplayPlayfabError(PlayFabError error) => Debug.LogError("error : " + error.GenerateErrorReport());
public void GetProfile(string playFabId)
{
string countryCode = "";
string displayName = "";
int score = 0;
PlayFabClientAPI.GetPlayerProfile(new GetPlayerProfileRequest()
{
PlayFabId = playFabId,
ProfileConstraints = new PlayerProfileViewConstraints()
{
ShowLocations = true,
ShowDisplayName = true,
ShowStatistics = true
}
}, result =>
{
countryCode = result.PlayerProfile.Locations[0].CountryCode.Value.ToString();
displayName = result.PlayerProfile.DisplayName;
score = result.PlayerProfile.Statistics.Find(match => match.Name == "Score").Value;
}, DisplayPlayfabError);
}
}
참고할만한 글
반응형