57 lines
1.4 KiB
C#
57 lines
1.4 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 FieldCleaner(true, CellState.Player1));
|
||
FieldCleaner.Clear(true, CellState.Player1);
|
||
}
|
||
}
|
||
}
|