54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class LeaderboardState : IState
|
|
{
|
|
bool showLastRecord = false;
|
|
PlayerStatsRecord record;
|
|
Leaderboard leaderboard;
|
|
public LeaderboardState(PlayerStatsRecord record)
|
|
{
|
|
this.record = record;
|
|
showLastRecord = true;
|
|
}
|
|
|
|
public LeaderboardState()
|
|
{
|
|
//showLastRecord = false;
|
|
showLastRecord = true;
|
|
}
|
|
|
|
public void enter()
|
|
{
|
|
leaderboard = GameManager.instance.leaderboard;
|
|
leaderboard.gameObject.SetActive(true);
|
|
|
|
bool showContacts = PlayerPrefs.GetInt("NeedSpecialPrize") == 1;
|
|
leaderboard.Initialize(showContacts: showContacts);
|
|
PlayerPrefs.SetInt("NeedSpecialPrize", 0);
|
|
|
|
if (showLastRecord)
|
|
{
|
|
PlayerStatsRecord lastRecord = GameManager.instance.StatsService.GetLatestRecord();
|
|
leaderboard.DisplayCurrentPlayer(record);
|
|
}
|
|
|
|
}
|
|
|
|
public void exit()
|
|
{
|
|
leaderboard.ClearRowsText();
|
|
|
|
leaderboard.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void update()
|
|
{
|
|
if (In.GetButtonDownAnyPlayer(PlayerAction.down))
|
|
{
|
|
GameManager.instance.stateMachine.ChangeState(new ClearFieldState(true, CellState.Player1));
|
|
}
|
|
}
|
|
}
|