Create hotkey to reset daily or global leader board.
This commit is contained in:
parent
f58e178b50
commit
535112b529
|
@ -19,6 +19,10 @@ public class LeaderboardController : MonoBehaviour
|
|||
public UnityEvent<List<Player>> OnDailyInit;
|
||||
public UnityEvent<List<Player>> OnGlobalInit;
|
||||
|
||||
private bool _resetDaily = false;
|
||||
private bool _resetGlobal = false;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
//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();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(Input.GetKeydown(KeyCode.J))
|
||||
_resetDaily = true;
|
||||
if(Input.GetKeydown(KeyCode.K))
|
||||
_resetGlobal = true;
|
||||
}
|
||||
|
||||
public void InitLeaderboards()
|
||||
{
|
||||
InitDailyLeaderboard();
|
||||
|
|
Loading…
Reference in New Issue