AlicizaX/Client/Packages/com.alicizax.unity.ui/Runtime/UI/Base/Manager/PanelInfo.cs
2025-01-24 16:21:00 +08:00

81 lines
2.0 KiB
C#

using System;
using AlicizaX.Runtime;
namespace AlicizaX.UI.Runtime
{
public enum EPanelState
{
/// <summary>
/// 没创建
/// </summary>
None,
/// <summary>
/// /已经打开
/// </summary>
Show,
/// <summary>
/// 缓存
/// </summary>
Cache
}
public class PanelInfo
{
public UIWindow UIBasePanel { get; private set; }
public bool Visible => UIBasePanel?.Visible ?? false;
public string Name { get; internal set; }
public EUIResLoadType UIResLoadType { get; internal set; }
public UILayer UIPanelLayer { get; internal set; }
public bool FullScreen { get; internal set; }
public string Res { get; internal set; }
public int DelayedClose { get; internal set; }
public Type UIClsType { get; internal set; }
public EPanelState PanelState = EPanelState.None;
internal void Reset(UIBase uiBase)
{
switch (uiBase)
{
case null:
UIBasePanel = null;
break;
case UIWindow uiWindow:
UIBasePanel = uiWindow;
break;
default:
Log.Error($"当前UI 不是Panel 请检查 ");
break;
}
}
internal void SetPanelState(EPanelState state)
{
PanelState = state;
}
public static PanelInfo Create(string name, EUIResLoadType resLoadType, UILayer layer, bool fullScreen, string res, int delayedClose, Type type)
{
PanelInfo panelInfo = new PanelInfo();
panelInfo.Name = name;
panelInfo.UIResLoadType = resLoadType;
panelInfo.UIPanelLayer = layer;
panelInfo.FullScreen = fullScreen;
panelInfo.Res = res;
panelInfo.DelayedClose = delayedClose;
panelInfo.UIClsType = type;
return panelInfo;
}
}
}