Added Profile Pic Managemnt
parent
ece6ca7637
commit
a5d4fae805
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using PlayFab;
|
||||||
|
using PlayFab.ClientModels;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class PlayFabUserData : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public PlayerProfileModel myProfile;
|
||||||
|
public Dictionary<string, UserDataRecord> myCustomData;
|
||||||
|
|
||||||
|
public void GetPlayerUserData(string playfabID, Action<Dictionary<string,UserDataRecord>> onCallback, Action<string> onFallback)
|
||||||
|
{
|
||||||
|
var request = new GetPlayerCombinedInfoRequest
|
||||||
|
{
|
||||||
|
PlayFabId = playfabID, // Use the logged-in player's PlayFab ID
|
||||||
|
InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
|
||||||
|
{
|
||||||
|
GetUserData = true // This will include User Data like AvatarID in the response
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayFabClientAPI.GetPlayerCombinedInfo(request, result => onCallback(result.InfoResultPayload.UserData), result=>onFallback(result.ErrorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetPlayerAvatarImage(string playfabID, Action<Sprite> onCallback, Action<string> onFallback)
|
||||||
|
{
|
||||||
|
var request = new GetPlayerCombinedInfoRequest
|
||||||
|
{
|
||||||
|
PlayFabId = playfabID, // Use the logged-in player's PlayFab ID
|
||||||
|
InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
|
||||||
|
{
|
||||||
|
GetUserData = true // This will include User Data like AvatarID in the response
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayFabClientAPI.GetPlayerCombinedInfo(request, result =>
|
||||||
|
{
|
||||||
|
if (result.InfoResultPayload.UserData != null && result.InfoResultPayload.UserData.ContainsKey("AvatarID"))
|
||||||
|
{
|
||||||
|
Sprite dp = PlayFabManager.Instance.avatarImages[
|
||||||
|
int.Parse(result.InfoResultPayload.UserData["AvatarID"].Value)];
|
||||||
|
onCallback(dp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
onCallback(PlayFabManager.Instance.avatarImages[0]);
|
||||||
|
}, result=>onFallback(result.ErrorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee4dea21bf118984281a95b0829061bd
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue