leaderboard feature added

This commit is contained in:
Mausham
2025-12-17 22:16:41 +05:45
parent df4017f6be
commit f19bbb9d8c
25 changed files with 106 additions and 170 deletions

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 35a6de0bf5636ce4cbfb0040efc4ea14