leaderboard feature added
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
using Darkmatter.Core;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
{
|
||||
public class LeaderBoardData : MonoBehaviour,ILeaderBoardData
|
||||
{
|
||||
public Image BackgroundPanel;
|
||||
public TextMeshProUGUI playerPos;
|
||||
public TextMeshProUGUI playerName;
|
||||
public TextMeshProUGUI playerScore;
|
||||
|
||||
public void ResetData()
|
||||
{
|
||||
BackgroundPanel.color = Color.white;
|
||||
playerPos.text = string.Empty;
|
||||
playerName.text = string.Empty;
|
||||
playerScore.text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using Unity.Services.Core;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Services.Authentication;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
{
|
||||
public class LeaderBoardInitializer : MonoBehaviour
|
||||
{
|
||||
private async void Awake()
|
||||
{
|
||||
await Init();
|
||||
}
|
||||
|
||||
private async Task Init()
|
||||
{
|
||||
await UnityServices.InitializeAsync();
|
||||
if (!AuthenticationService.Instance.IsSignedIn)
|
||||
{
|
||||
await AuthenticationService.Instance.SignInAnonymouslyAsync();
|
||||
}
|
||||
PlayerPrefs.SetString("PlayerID", AuthenticationService.Instance.PlayerId);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35a6de0bf5636ce4cbfb0040efc4ea14
|
||||
Reference in New Issue
Block a user