Neg_Utils/NEG/UI/UnityUi/Area/MonoArea.cs

30 lines
847 B
C#

using System.Collections.Generic;
using UnityEngine;
using NEG.UI.Popup;
using NEG.UI.UnityUi.WindowSlot;
using NEG.UI.Window;
using NEG.UI.WindowSlot;
namespace NEG.UI.Area
{
public class MonoArea : MonoBehaviour, IArea
{
public IEnumerable<IWindowSlot> AvailableSlots => windowSlots;
public IWindowSlot DefaultWindowSlot => windowSlots[0];
public IEnumerable<IWindow> CurrentWindows { get; }
[SerializeField] private List<MonoWindowSlot> windowSlots;
[SerializeField] private Queue<IPopup> currentPopups = new();
public void SetEnabled(bool setEnabled) => gameObject.SetActive(setEnabled);
public void OpenWindow(IWindow window, object data = null)
{
DefaultWindowSlot.AttachWindow(window);
window.SetData(data);
}
}
}