rabidus-test/Assets/ResultSceneManager.cs

46 lines
1.2 KiB
C#
Raw Normal View History

2023-10-10 17:25:59 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2023-10-11 15:44:05 +03:00
using UnityEngine.Events;
2023-10-10 17:25:59 +03:00
public class ResultSceneManager : MonoBehaviour
{
2023-10-11 15:44:05 +03:00
private LeaderboardController leaderboardController;
public UnityEvent<int> OnDailyTop;
public UnityEvent<int> OnGlobalTop;
public UnityEvent OnNoTop;
2023-10-10 17:25:59 +03:00
private void Start()
{
2023-10-11 15:44:05 +03:00
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("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> 30 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>!");
}
}
public void CheckGlobalTop()
{
if (leaderboardController.CheckCurrentPlayerGlobalTop())
{
OnGlobalTop?.Invoke(leaderboardController.GetCurrentPlayerGlobalPos());
Debug.Log("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> 30 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>!");
}
2023-10-10 17:25:59 +03:00
}
}