AlicizaX/Client/Packages/com.alicizax.unity.ui/Runtime/UI/Base/Manager/UIManager.Open.cs

40 lines
1.5 KiB
C#
Raw Normal View History

2025-01-24 16:21:00 +08:00
using System;
using System.Collections.Generic;
using AlicizaX.Runtime;
using AlicizaX.UI.Runtime;
namespace AlicizaX.UI.Runtime
{
internal sealed partial class UIManager
{
private readonly Dictionary<string, PanelInfo> m_PanelCfgMap = new Dictionary<string, PanelInfo>();
private PanelInfo GetWindowInfo(Type type)
{
string windowName = type.Name;
if (!m_PanelCfgMap.ContainsKey(windowName))
{
var info = GetWindowAttributeInfo(type);
m_PanelCfgMap.Add(windowName, info);
}
return m_PanelCfgMap[windowName];
}
private PanelInfo GetWindowAttributeInfo(Type type)
{
string windowName = type.Name;
WindowAttribute windowAttribute = Attribute.GetCustomAttribute(type, typeof(WindowAttribute)) as WindowAttribute;
if (windowAttribute == null)
throw new GameFrameworkException($"Window {type.FullName} WindowAttribute can be null.");
UIResAttribute resAttribute = Attribute.GetCustomAttribute(type, typeof(UIResAttribute)) as UIResAttribute;
if (resAttribute == null)
throw new GameFrameworkException($"Window {type.FullName} UIResAttribute can be null.");
return PanelInfo.Create(windowName, resAttribute.ResLoadType, windowAttribute.WindowLayer, windowAttribute.FullScreen, resAttribute.ResLocation, windowAttribute.DelayedClose, type);
}
}
}