This commit is contained in:
Hubert Mattusch 2023-11-20 12:29:56 +01:00
parent 7131c14d99
commit 858bfaa0ae
3 changed files with 4 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace NEG.UI.Area
public void OpenWindow(IWindow window, object data = null) => DefaultWindowSlot.AttachWindow(window, data); public void OpenWindow(IWindow window, object data = null) => DefaultWindowSlot.AttachWindow(window, data);
private void Awake() protected virtual void Awake()
{ {
if (setAsDefaultArea) if (setAsDefaultArea)
UiManager.Instance.CurrentArea = this; UiManager.Instance.CurrentArea = this;
@ -50,10 +50,8 @@ namespace NEG.UI.Area
private void OnDestroy() private void OnDestroy()
{ {
#if !SERVER
if (ReferenceEquals(UiManager.Instance.CurrentArea, this)) if (ReferenceEquals(UiManager.Instance.CurrentArea, this))
UiManager.Instance.CurrentArea = null; UiManager.Instance.CurrentArea = null;
#endif
} }
public void TryUseBack(ref IControllable.BackUsed backUsed) => OnBackUsed?.Invoke(backUsed); public void TryUseBack(ref IControllable.BackUsed backUsed) => OnBackUsed?.Invoke(backUsed);

View File

@ -77,13 +77,11 @@ namespace NEG.UI.UnityUi.Buttons
protected virtual void Awake() protected virtual void Awake()
{ {
#if !SERVER
button.onClick.AddListener(OnClicked); button.onClick.AddListener(OnClicked);
if (groupButtonSettings == null) if (groupButtonSettings == null)
MonoUiManager.Instance.DefaultUiSettings.Apply(this); MonoUiManager.Instance.DefaultUiSettings.Apply(this);
else else
groupButtonSettings.Apply(this); groupButtonSettings.Apply(this);
#endif
} }
private void Start() => OnDeselect(null); private void Start() => OnDeselect(null);

View File

@ -1,4 +1,5 @@
using KBCore.Refs; using KBCore.Refs;
using NEG.UI.UnityUi.Window;
using NegUtils.NEG.UI; using NegUtils.NEG.UI;
using System; using System;
using UnityEngine; using UnityEngine;
@ -11,6 +12,8 @@ namespace NEG.UI.UnityUi
[SerializeField, Self] protected InterfaceRef<IControllable> controllable; [SerializeField, Self] protected InterfaceRef<IControllable> controllable;
protected MonoWindow ControllableAsWindow => (MonoWindow)controllable.Value;
protected virtual void Awake() protected virtual void Awake()
{ {
controllable.Value.OnOpened += OnOpened; controllable.Value.OnOpened += OnOpened;