chip-game/Assets/Scripts/GameFSM/LeaderboardState.cs

57 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}
}