diff --git a/NEG/UI/UiManager.cs b/NEG/UI/UiManager.cs index 70b7478..59c2bb0 100644 --- a/NEG/UI/UiManager.cs +++ b/NEG/UI/UiManager.cs @@ -152,7 +152,8 @@ namespace NEG.UI { if(CurrentMainWindow != window) return; - + + CurrentMainWindow = null; //TODO: select new main window } diff --git a/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs b/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs new file mode 100644 index 0000000..c9ba380 --- /dev/null +++ b/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs @@ -0,0 +1,17 @@ +using NEG.UI.UnityUi.Window; +using NEG.UI.Window; +using UnityEngine; + +namespace NEG.UI.Area +{ + public class AutoOpenWindowWhenNoOther : MonoBehaviour + { + [SerializeField] private MonoWindow window; + + private void Start() + { + if(UiManager.Instance.CurrentMainWindow == null) + window.Open(); + } + } +} \ No newline at end of file diff --git a/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs.meta b/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs.meta new file mode 100644 index 0000000..14ed8c2 --- /dev/null +++ b/NEG/UI/UnityUi/Area/AutoOpenWindowWhenNoOther.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 473c065573984067a824ebf3b605c3ab +timeCreated: 1695048071 \ No newline at end of file diff --git a/NEG/UI/UnityUi/Window/MonoWindow.cs b/NEG/UI/UnityUi/Window/MonoWindow.cs index db8b882..b6b8986 100644 --- a/NEG/UI/UnityUi/Window/MonoWindow.cs +++ b/NEG/UI/UnityUi/Window/MonoWindow.cs @@ -55,6 +55,12 @@ namespace NEG.UI.UnityUi.Window private void Awake() => ((IWindow)this).SetHiddenState(); + private void OnDestroy() + { + if(gameObject.activeSelf) + UiManager.Instance.OnWindowClosed(this); + } + private void OnValidate() { #if !NEG_UI_DISABLE_WARNING_DEFAULT_SELECTION