using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using VContainer;

public class PauseScreenController
{
    private PauseScreenView _pauseScreenView;
    [Inject]private InputReader _inputReader;
    public PauseScreenController(PauseScreenView pauseScreenView)
    {
        this._pauseScreenView = pauseScreenView;
        _pauseScreenView.resumeBtn.onClick.AddListener( ResumeBtnClicked);
        _pauseScreenView.BackBtn.onClick.AddListener(BackBtnClicked);
    }

    public void ShowPauseScreen()
    {
        _inputReader.isBlocked = true;
        _pauseScreenView.Show();
    }

    private void ResumeBtnClicked()
    {
        _inputReader.isBlocked = false;

        Time.timeScale = 1.0f;
        _pauseScreenView.Hide();
    }
    public void BackBtnClicked()
    {
        _inputReader.isBlocked = false;
        _pauseScreenView.Hide();
        Time.timeScale = 1.0f;
        SceneManager.LoadScene(0);
    }
}
