using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class MenuManager : MonoBehaviour
{
    // Start is called before the first frame update
    public Text highScoreValue;
    public Text coinsValue;
    public Text soundBtnText;

    int hs = 0;
    int coins = 0;
    void Start()
    {
        if (PlayerPrefs.HasKey("HighScoreValue"))
        {
            hs = PlayerPrefs.GetInt("HighScoreValue");
        }

        if (PlayerPrefs.HasKey("Coins"))
        {
            coins = PlayerPrefs.GetInt("Coins");
        }

        UpdateUI();
    }

    public void UpdateUI()
    {
        highScoreValue.text = hs.ToString();
        coinsValue.text = coins.ToString();

        if (SoundManager.instance.GetMuted())
        {
            soundBtnText.text = "TURN ON SOUND";
        }
        else
            soundBtnText.text = "TURN OFF SOUND";
    }

    public void PlayButton()
    {
        SceneManager.LoadScene("Game");
    }

    public void SoundButton()
    {
        SoundManager.instance.ToggleMuted();
        UpdateUI();
    }

    // Update is called once per frameif(
    void Update()
    {
        
    }
}
