using System.Collections;
using UnityEngine;
using GooglePlayGames;
using UnityEngine.Events;
public class PlayGamesServices : Singleton<PlayGamesServices> {
private void Start()
{
PlayGamesPlatform.Activate();
SignIn();
}
private void SignIn()
{
Social.localUser.Authenticate(success =>
{
if (success)
{
Debug.LogError("Connected to Google pLay services!");
}
else
{
Debug.LogError("Connection failed");
}
});
}
public void ShowAchievementsUI()
{
PlayGamesPlatform.Instance.ShowAchievementsUI();
}
public void ShowLeaderboards()
{
PlayGamesPlatform.Instance.ShowLeaderboardUI();
}
public void AddScoreToLeaderBoard(int score, string leaderboardId)
{
Social.ReportScore(score, leaderboardId, (bool success) => {
if (success)
{
Debug.LogError("Score has been added to leaderboard");
}
else
{
Debug.LogError("Score was not saved");
}
});
}
}






