using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class MainMenuManager : MonoBehaviour
{
[Header("Scene Settings")]
[Tooltip("The exact name of the scene you want to load when starting a new game (e.g. 'Level1' or 'WorldMap').")]
public string newGameSceneName = "Level1";
///
/// Call this method from the 'On Click ()' event of your Start Game Button.
///
public void StartNewGame()
{
Debug.Log($"[MainMenuManager] Handing off to LevelLoader for: {newGameSceneName}...");
// Pass the request to our global LevelLoader which will handle the loading screen!
LevelLoader.LoadLevel(newGameSceneName);
}
///
/// Call this method from the 'On Click ()' event of your Quit or Exit Button.
///
public void ExitToDesktop()
{
Debug.Log("[MainMenuManager] Exiting to Desktop...");
// This closes the actual built game executable (.exe)
Application.Quit();
// If you are testing this inside the Unity Editor, Application.Quit() does nothing.
// This preprocessor directive forcefully stops Play Mode so you can still test the quit button!
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}