Neg_Utils/NEG/UI/UnityUi/WindowSlot/SingleWindowSlot.cs

26 lines
744 B
C#

using NEG.UI.UnityUi.WindowSlot;
using NEG.UI.Window;
using UnityEngine;
namespace NEG.UI.WindowSlot
{
public class SingleWindowSlot : MonoWindowSlot
{
public IWindow CurrentWindow
{
get => currentWindow;
set
{
currentWindow?.SetClosedState();
currentWindow = value;
currentWindow?.SetOpenedState(this);
}
}
private IWindow currentWindow;
public override void AttachWindow(IWindow window) => CurrentWindow = window;
public override void DetachWindow(IWindow window) => CurrentWindow = null;
public override void CloseAllWindows() => CurrentWindow = null;
}
}