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-11 17:33:14 +03:00
|
|
|
|
using UnityEngine.UI;
|
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;
|
2023-10-11 17:33:14 +03:00
|
|
|
|
|
|
|
|
|
public UnityEvent OnNoAllTop;
|
|
|
|
|
public UnityEvent OnNoDailyTop;
|
|
|
|
|
public UnityEvent OnNoGlobalTop;
|
2023-10-11 15:44:05 +03:00
|
|
|
|
|
2023-10-11 17:33:14 +03:00
|
|
|
|
public InputField PlayerNameInputField;
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
2023-10-10 17:25:59 +03:00
|
|
|
|
{
|
2023-10-11 15:44:05 +03:00
|
|
|
|
leaderboardController = FindObjectOfType<LeaderboardController>();
|
|
|
|
|
|
|
|
|
|
leaderboardController.RefreshEntries();
|
|
|
|
|
leaderboardController.SaveData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!leaderboardController.CheckCurrentPlayerDailyTop() && !leaderboardController.CheckCurrentPlayerGlobalTop())
|
|
|
|
|
{
|
2023-10-11 17:33:14 +03:00
|
|
|
|
OnNoAllTop?.Invoke();
|
2023-10-11 15:44:05 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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>!");
|
|
|
|
|
}
|
2023-10-11 17:33:14 +03:00
|
|
|
|
else
|
|
|
|
|
OnNoDailyTop?.Invoke();
|
2023-10-11 15:44:05 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-11 17:33:14 +03:00
|
|
|
|
else
|
|
|
|
|
OnNoGlobalTop?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SavePlayerName()
|
|
|
|
|
{
|
|
|
|
|
PlayerSetup.Instance.CurrentPlayer.Name = PlayerNameInputField.text;
|
|
|
|
|
leaderboardController.SaveData();
|
2023-10-10 17:25:59 +03:00
|
|
|
|
}
|
|
|
|
|
}
|