Create hotkey to reset daily or global leader board.

This commit is contained in:
a.gorbunov 2023-11-29 13:10:35 +03:00
parent f58e178b50
commit 535112b529
1 changed files with 18 additions and 2 deletions

View File

@ -19,6 +19,10 @@ public class LeaderboardController : MonoBehaviour
public UnityEvent<List<Player>> OnDailyInit; public UnityEvent<List<Player>> OnDailyInit;
public UnityEvent<List<Player>> OnGlobalInit; public UnityEvent<List<Player>> OnGlobalInit;
private bool _resetDaily = false;
private bool _resetGlobal = false;
private void Awake() private void Awake()
{ {
//transform.parent = null; //transform.parent = null;
@ -34,12 +38,24 @@ public class LeaderboardController : MonoBehaviour
} }
} }
private void Start() private IEnumerator Start()
{ {
//yield return new WaitForSeconds(1); yield return new WaitForSeconds(10);
if(_resetDaily)
PlayerPrefs.SetString(DAILY_ID, string.Empty);
if(_resetGlobal)
PlayerPrefs.SetString(GLOBAL_ID, string.Empty);
InitLeaderboards(); InitLeaderboards();
} }
private void Update()
{
if(Input.GetKeydown(KeyCode.J))
_resetDaily = true;
if(Input.GetKeydown(KeyCode.K))
_resetGlobal = true;
}
public void InitLeaderboards() public void InitLeaderboards()
{ {
InitDailyLeaderboard(); InitDailyLeaderboard();