Neg_Utils/NEG/UI/UnityUi/WindowSlot/SingleWindowSlot.cs
2023-08-12 11:14:57 +02:00

31 lines
830 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, object data)
{
CurrentWindow = window;
window.FireOpenCallback(data);
}
public override void DetachWindow(IWindow window) => CurrentWindow = null;
public override void CloseAllWindows() => CurrentWindow = null;
}
}