diff --git a/NEG/UI/UnityUi/Area/MonoArea.cs b/NEG/UI/UnityUi/Area/MonoArea.cs index 85ef7b8..535489a 100644 --- a/NEG/UI/UnityUi/Area/MonoArea.cs +++ b/NEG/UI/UnityUi/Area/MonoArea.cs @@ -36,7 +36,7 @@ namespace NEG.UI.Area public void OpenWindow(IWindow window, object data = null) => DefaultWindowSlot.AttachWindow(window, data); - private void Awake() + protected virtual void Awake() { if (setAsDefaultArea) UiManager.Instance.CurrentArea = this; @@ -50,10 +50,8 @@ namespace NEG.UI.Area private void OnDestroy() { -#if !SERVER if (ReferenceEquals(UiManager.Instance.CurrentArea, this)) UiManager.Instance.CurrentArea = null; -#endif } public void TryUseBack(ref IControllable.BackUsed backUsed) => OnBackUsed?.Invoke(backUsed); diff --git a/NEG/UI/UnityUi/Buttons/BaseButton.cs b/NEG/UI/UnityUi/Buttons/BaseButton.cs index d9b6cce..939bdbf 100644 --- a/NEG/UI/UnityUi/Buttons/BaseButton.cs +++ b/NEG/UI/UnityUi/Buttons/BaseButton.cs @@ -77,13 +77,11 @@ namespace NEG.UI.UnityUi.Buttons protected virtual void Awake() { -#if !SERVER button.onClick.AddListener(OnClicked); if (groupButtonSettings == null) MonoUiManager.Instance.DefaultUiSettings.Apply(this); else groupButtonSettings.Apply(this); -#endif } private void Start() => OnDeselect(null); diff --git a/NEG/UI/UnityUi/MonoController.cs b/NEG/UI/UnityUi/MonoController.cs index 7c4afdb..44fbb3e 100644 --- a/NEG/UI/UnityUi/MonoController.cs +++ b/NEG/UI/UnityUi/MonoController.cs @@ -1,4 +1,5 @@ using KBCore.Refs; +using NEG.UI.UnityUi.Window; using NegUtils.NEG.UI; using System; using UnityEngine; @@ -10,6 +11,8 @@ namespace NEG.UI.UnityUi public IControllable Controllable => controllable.Value; [SerializeField, Self] protected InterfaceRef controllable; + + protected MonoWindow ControllableAsWindow => (MonoWindow)controllable.Value; protected virtual void Awake() {