CapersProject/Assets/02.Scripts/Ui/Popup/PopupUiController.cs

83 lines
2.0 KiB
C#
Raw Normal View History

2024-10-29 06:45:18 +00:00
using System.Collections.Generic;
using BlueWater.Uis;
namespace BlueWater
{
public static class PopupUiController
{
public static List<PopupUi> PopupUis { get; private set; } = new();
// Popup 등록
public static void RegisterPopup(PopupUi popup)
{
if (!PopupUis.Contains(popup))
{
2024-11-17 04:29:57 +00:00
foreach (var element in PopupUis)
{
element.DisableInput();
}
2024-10-29 06:45:18 +00:00
PopupUis.Add(popup);
2024-11-17 04:29:57 +00:00
popup.EnableInput();
2024-10-29 06:45:18 +00:00
}
}
// Popup 해제
public static void UnregisterPopup(PopupUi popup)
{
if (PopupUis.Contains(popup))
{
2024-11-30 11:53:38 +00:00
popup.DisableInput();
2024-10-29 06:45:18 +00:00
PopupUis.Remove(popup);
2024-11-17 04:29:57 +00:00
if (PopupUis.Count > 0)
{
PopupUis[^1].EnableInput();
}
2024-10-29 06:45:18 +00:00
}
}
// 마지막 Popup 닫기
public static void CloseLastPopup()
{
if (PopupUis.Count <= 0) return;
PopupUis[^1].Close();
}
// 모든 Popup 닫기
public static void CloseAllPopup()
{
foreach (var element in PopupUis)
{
if (!element.IsOpened) continue;
element.Close();
}
}
2024-12-18 16:00:39 +00:00
/// <summary>
/// 현재 열려있는 팝업 리스트 중에 시간을 멈춘 팝업이 있는지 없는지 확인
/// </summary>
public static bool IsPausedPopupList()
{
foreach (var element in PopupUis)
{
if (!element.IsPaused) continue;
return true;
}
return false;
}
2024-10-29 06:45:18 +00:00
// Popup 목록이 비어 있는지 확인
public static bool IsPopupListEmpty() => PopupUis.Count == 0;
2024-11-18 03:51:28 +00:00
public static void ClearPopup()
{
PopupUis.Clear();
}
2024-10-29 06:45:18 +00:00
}
}