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 m_PanelCfgMap = new Dictionary(); 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); } } }