반응형
로그인 후 콜백받은 핸들러에서 부터 시작
Social.LoadScores 는 userID까지만 가져올수 있고, userName은 가져올수 없음.
그래서 Social.LoadUsers 에 찾고자 하는 userID넣고 IUserProfiles 로 받아올 수 있음. 매우짜증남.
참조 : https://docs.unity3d.com/ScriptReference/SocialPlatforms.IUserProfile.html
void AuthenticateHandler(bool isSuccess)
{
List<string> userIDs = new List<string>();
string leaderboardId = "Cg--------------Ag";
if(isSuccess)
{
Social.LoadScores(leaderboardId, scores => {
if(scores.Length > 0)
{
userIDs.Add(scores[0].userID);
Social.LoadUsers(userIDs.ToArray(), profiles => {
if(profiles.Length > 0)
{
GameObject.FindWithTag("leaderboard").GetComponent<Text>().text =
"World Champion!" +
"\r\n" + profiles[0].userName +
"\r\n" + scores[0].date.ToShortDateString() +
"\r\n" + scores[0].value.ToString() + "point";
}});
}});
}
}
반응형