|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using PlayFab;
|
|
|
|
using PlayFab.ClientModels;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class PlayFabManager : MonoBehaviour
|
|
|
|
{
|
|
|
|
public static PlayFabManager Instance { get; private set; }
|
|
|
|
public PlayFabInit playFabInit;
|
|
|
|
public List<Sprite> avatarImages;
|
|
|
|
public PlayFabLeaderboards playFabLeaderboards;
|
|
|
|
public PlayFabUserData playFabUserDataManager;
|
|
|
|
private int myAvatarIndex
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (playFabUserDataManager.myCustomData != null && playFabUserDataManager.myCustomData.ContainsKey("AvatarID"))
|
|
|
|
{
|
|
|
|
return int.Parse(playFabUserDataManager.myCustomData["AvatarID"].Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Sprite myDisplayPicture => avatarImages[myAvatarIndex];
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
if (Instance != null && Instance != this)
|
|
|
|
{
|
|
|
|
Destroy(this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Instance = this;
|
|
|
|
DontDestroyOnLoad(gameObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
playFabInit = gameObject.AddComponent<PlayFabInit>();
|
|
|
|
playFabLeaderboards = gameObject.AddComponent<PlayFabLeaderboards>();
|
|
|
|
playFabUserDataManager = gameObject.AddComponent<PlayFabUserData>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|