Revamp the prompt system, the bootstrapper system, the starting cinematic
This commit is contained in:
@@ -3,6 +3,7 @@ using Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Input;
|
||||
using Bootstrap;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
@@ -11,23 +12,10 @@ namespace UI
|
||||
private static PauseMenu _instance;
|
||||
private static bool _isQuitting;
|
||||
|
||||
public static PauseMenu Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && Application.isPlaying && !_isQuitting)
|
||||
{
|
||||
_instance = FindAnyObjectByType<PauseMenu>();
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("PauseMenu");
|
||||
_instance = go.AddComponent<PauseMenu>();
|
||||
// DontDestroyOnLoad(go);
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Singleton instance of the PauseMenu. No longer creates an instance if one doesn't exist.
|
||||
/// </summary>
|
||||
public static PauseMenu Instance => _instance;
|
||||
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject pauseMenuPanel;
|
||||
@@ -43,18 +31,30 @@ namespace UI
|
||||
/// </summary>
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
SceneManagerService.Instance.SceneLoadCompleted += SetPauseMenuByLevel;
|
||||
|
||||
// SceneManagerService subscription moved to InitializePostBoot
|
||||
|
||||
// Set initial state based on current scene
|
||||
SetPauseMenuByLevel(SceneManager.GetActiveScene().name);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR
|
||||
// Initialize pause menu state
|
||||
HidePauseMenu(false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Logging.Debug("[PauseMenu] Subscribed to SceneManagerService events");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -81,9 +81,11 @@ namespace UI
|
||||
return;
|
||||
|
||||
bool isMainMenu = levelName.ToLower().Contains("mainmenu");
|
||||
gameObject.SetActive(!isMainMenu);
|
||||
bool isStartingLevel = levelName.ToLower().Contains("startingscene");
|
||||
|
||||
if(!isMainMenu)
|
||||
gameObject.SetActive(!(isMainMenu || isStartingLevel));
|
||||
|
||||
if(!isMainMenu && !isStartingLevel)
|
||||
HidePauseMenu(false); // Ensure menu is hidden when switching to a game level
|
||||
|
||||
Logging.Debug($"[PauseMenu] Setting pause menu active: {!isMainMenu} for scene: {levelName}");
|
||||
|
||||
Reference in New Issue
Block a user