using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Mainmenu : MonoBehaviour
{
    [SerializeField] private Button playButton;
    [SerializeField] private Button howToPlayButton;
    [SerializeField] private Button quitButton;
    [SerializeField] private GameObject howToPlayPanel;
    [SerializeField] private Button closeHowToPlayButton;

    void Start()
    {
        // Ensure the How to Play panel is hidden at the start
        howToPlayPanel.SetActive(false);

        // Assign button listeners
        playButton.onClick.AddListener(StartGame);
        howToPlayButton.onClick.AddListener(ShowHowToPlay);
        quitButton.onClick.AddListener(QuitGame);
        closeHowToPlayButton.onClick.AddListener(HideHowToPlay);
    }

    private void StartGame()
    {
        // Load the main game scene (replace "GameScene" with your scene name)
        SceneManager.LoadScene("LivingRoom");
    }

    private void ShowHowToPlay()
    {
        // Show the How to Play panel
        howToPlayPanel.SetActive(true);
    }

    private void HideHowToPlay()
    {
        // Hide the How to Play panel
        howToPlayPanel.SetActive(false);
    }

    private void QuitGame()
    {
        // Quit the application
        Application.Quit();
        Debug.Log("Quit Game"); // Debug message for Editor mode
    }
}
