46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class ResultSceneManager : MonoBehaviour
|
|
{
|
|
private LeaderboardController leaderboardController;
|
|
|
|
public UnityEvent<int> OnDailyTop;
|
|
public UnityEvent<int> OnGlobalTop;
|
|
public UnityEvent OnNoTop;
|
|
|
|
private void Start()
|
|
{
|
|
leaderboardController = FindObjectOfType<LeaderboardController>();
|
|
|
|
leaderboardController.RefreshEntries();
|
|
leaderboardController.SaveData();
|
|
|
|
|
|
if (!leaderboardController.CheckCurrentPlayerDailyTop() && !leaderboardController.CheckCurrentPlayerGlobalTop())
|
|
{
|
|
OnNoTop?.Invoke();
|
|
}
|
|
}
|
|
|
|
public void CheckDailyTop()
|
|
{
|
|
if (leaderboardController.CheckCurrentPlayerDailyTop())
|
|
{
|
|
OnDailyTop?.Invoke(leaderboardController.GetCurrentPlayerDailyPos());
|
|
Debug.Log("Âû ïîïàëè â Òîï 30 èãðîêîâ äíÿ!");
|
|
}
|
|
}
|
|
|
|
public void CheckGlobalTop()
|
|
{
|
|
if (leaderboardController.CheckCurrentPlayerGlobalTop())
|
|
{
|
|
OnGlobalTop?.Invoke(leaderboardController.GetCurrentPlayerGlobalPos());
|
|
Debug.Log("Âû ïîïàëè â Òîï 30 èãðîêîâ çà âñ¸ âðåìÿ!");
|
|
}
|
|
}
|
|
}
|