rabidus-test/Assets/ResultSceneManager.cs

64 lines
1.7 KiB
C#
Raw Normal View History

2023-10-13 12:12:58 +03:00
using BNG;
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
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;
2023-10-21 11:36:49 +03:00
private void Start()
2023-10-10 17:25:59 +03:00
{
2023-10-21 11:36:49 +03:00
LeaderboardController.Instance.RefreshEntries();
LeaderboardController.Instance.SaveData();
2023-10-11 15:44:05 +03:00
2023-10-21 11:36:49 +03:00
if (!LeaderboardController.Instance.CheckCurrentPlayerDailyTop() && !LeaderboardController.Instance.CheckCurrentPlayerGlobalTop())
2023-10-11 15:44:05 +03:00
{
2023-10-21 11:36:49 +03:00
//OnNoAllTop?.Invoke();
2023-10-11 15:44:05 +03:00
}
}
public void CheckDailyTop()
{
2023-10-21 11:36:49 +03:00
if (true)//LeaderboardController.Instance.CheckCurrentPlayerDailyTop())
2023-10-11 15:44:05 +03:00
{
2023-10-21 11:36:49 +03:00
OnDailyTop?.Invoke(LeaderboardController.Instance.GetCurrentPlayerDailyPos());
2023-10-11 15:44:05 +03:00
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()
{
2023-10-21 11:36:49 +03:00
if (LeaderboardController.Instance.CheckCurrentPlayerGlobalTop())
2023-10-11 15:44:05 +03:00
{
2023-10-21 11:36:49 +03:00
OnGlobalTop?.Invoke(LeaderboardController.Instance.GetCurrentPlayerGlobalPos());
2023-10-11 15:44:05 +03:00
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;
2023-10-21 11:36:49 +03:00
LeaderboardController.Instance.SaveData();
2023-10-10 17:25:59 +03:00
}
2023-10-13 12:12:58 +03:00
public void LoadStartScene()
{
SceneLoader.Instance.LoadStartScene();
}
2023-10-10 17:25:59 +03:00
}