rabidus-test/Assets/ResultSceneManager.cs

64 lines
1.7 KiB
C#

using BNG;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class ResultSceneManager : MonoBehaviour
{
public UnityEvent<int> OnDailyTop;
public UnityEvent<int> OnGlobalTop;
public UnityEvent OnNoAllTop;
public UnityEvent OnNoDailyTop;
public UnityEvent OnNoGlobalTop;
public InputField PlayerNameInputField;
private void Start()
{
LeaderboardController.Instance.RefreshEntries();
LeaderboardController.Instance.SaveData();
if (!LeaderboardController.Instance.CheckCurrentPlayerDailyTop() && !LeaderboardController.Instance.CheckCurrentPlayerGlobalTop())
{
//OnNoAllTop?.Invoke();
}
}
public void CheckDailyTop()
{
if (true)//LeaderboardController.Instance.CheckCurrentPlayerDailyTop())
{
OnDailyTop?.Invoke(LeaderboardController.Instance.GetCurrentPlayerDailyPos());
Debug.Log("Âû ïîïàëè â Òîï 30 èãðîêîâ äíÿ!");
}
else
OnNoDailyTop?.Invoke();
}
public void CheckGlobalTop()
{
if (LeaderboardController.Instance.CheckCurrentPlayerGlobalTop())
{
OnGlobalTop?.Invoke(LeaderboardController.Instance.GetCurrentPlayerGlobalPos());
Debug.Log("Âû ïîïàëè â Òîï 30 èãðîêîâ çà âñ¸ âðåìÿ!");
}
else
OnNoGlobalTop?.Invoke();
}
public void SavePlayerName()
{
PlayerSetup.Instance.CurrentPlayer.Name = PlayerNameInputField.text;
LeaderboardController.Instance.SaveData();
}
public void LoadStartScene()
{
SceneLoader.Instance.LoadStartScene();
}
}