using UnityEngine; namespace Ashwild.UI { /// /// Main-menu UI manager. Escape navigates the panel stack backwards; when already at the /// default panel (the main menu) it opens a fallback panel instead — typically the /// quit-confirmation. Put this on the menu canvas; gameplay uses . /// [DisallowMultipleComponent] public class MenuUIManager : UIManager { #region Serialized Fields [Header("Menu Escape")] [Tooltip("Panel opened by Escape when already on the default (main menu) panel — e.g. ConfirmQuitPanel.")] [SerializeField] private UIPanel escapeFallbackPanel; #endregion #region Escape Policy /// /// Escape: close the fallback if it is up, otherwise step back through the stack, /// and finally open the fallback when sitting on the default panel. /// protected override void OnEscape() { if (Current == null) return; if (escapeFallbackPanel != null && Current == escapeFallbackPanel) { Back(); return; } if (Current != defaultPanel) { Back(); return; } if (escapeFallbackPanel != null) OpenPanel(escapeFallbackPanel); } #endregion } }