using JetBrains.Annotations;
using NEG.UI.Area;
using System;
namespace NEG.UI.Popup
{
[PublicAPI]
public interface IPopup : IUiElement
{
///
/// Call when popup is not forcly closed
///
event Action OnPopupClosed;
///
/// Is popup still valid to show
///
bool IsValid { get; }
///
/// Mark popup as ready to show.
///
internal void Show();
///
/// Close popup or mark as closed if not visible
///
/// Is closing by forced by system, ex. close area
void Close(bool isForced = false);
}
public static class PopupExtensions
{
public static void Show(this IPopup popup, IArea area = null)
{
if (area != null)
{
area.OpenPopup(popup);
return;
}
UiManager.Instance.CurrentArea.OpenPopup(popup);
}
}
}