4 protected ref array<ref Widget> m_aAllGroups = {};
5 protected ref array<ref SCR_HUDElement> m_aElements = {};
8 protected string m_sIdentifier;
11 protected ResourceName m_sLayout;
13 protected Widget m_wRoot;
16 void SetIdentifier(
string id)
18 if (
id ==
string.Empty)
21 PlayerController pController =
GetGame().GetPlayerController();
33 array <string> allIdentifiers = layoutHandler.GetAllIdentifiers();
35 if (allIdentifiers.Contains(
id))
37 Print(
"HUDManager: Identifier: " +
id +
" is already used! Check if your Identifier is Unique!", LogLevel.ERROR);
45 int GetHUDElements(notnull out array<SCR_HUDElement> hudElements)
49 hudElements.Insert(element);
52 return hudElements.Count();
56 string GetIdentifier()
62 ResourceName GetLayout()
68 Widget GetRootWidget()
74 void SetRootWidget(notnull Widget widget)
78 Widget iteratedWidget =
m_wRoot.GetChildren();
79 while (iteratedWidget)
81 Widget iteratedChildWidget = iteratedWidget.GetChildren();
82 while (iteratedChildWidget)
87 iteratedChildWidget = iteratedChildWidget.GetSibling();
91 m_aAllGroups.Insert(iteratedChildWidget);
92 iteratedChildWidget = iteratedChildWidget.GetSibling();
95 iteratedWidget = iteratedWidget.GetSibling();
102 array<SCR_HUDGroupUIComponent> groupsInLayout = {};
103 GetAllGroupComponents(groupsInLayout);
107 groupComponent.ResizeGroup();
112 void AddHudElement(notnull
SCR_HUDElement element,
bool replaceParent =
false)
117 Widget slotWidget = element.GetWidget();
121 Widget parentWidget =
m_wRoot.FindAnyWidget(element.GetParentWidgetName());
126 parentWidget.AddChild(slotWidget);
129 element.SetParentLayout(
this);
133 void RemoveHudElement(notnull
SCR_HUDElement element,
bool replaceParent =
false)
135 Widget elementWidget = element.GetWidget();
139 Widget parentWidget = elementWidget.GetParent();
140 if (replaceParent && parentWidget)
141 parentWidget.RemoveChild(elementWidget);
151 Widget GetGroupWidgetByName(
string groupName)
156 return m_wRoot.FindAnyWidget(groupName);
166 Widget group = GetGroupWidgetByName(groupName);
177 int GetAllGroupComponents(notnull out array<SCR_HUDGroupUIComponent> groupComponents)
179 groupComponents.Clear();
180 foreach (Widget groupWidget : m_aAllGroups)
184 groupComponents.Insert(groupComponent);
187 return groupComponents.Count();
195 int GetAllSlotComponents(notnull out array<SCR_HUDSlotUIComponent> slotComponents)
197 slotComponents.Clear();
199 foreach (Widget groupWidget : m_aAllGroups)
201 Widget childWidget = groupWidget.GetChildren();
207 childWidget = childWidget.GetSibling();
211 slotComponents.Insert(slotComponent);
212 childWidget = childWidget.GetSibling();
216 return slotComponents.Count();
222 Widget slotWidget =
m_wRoot.FindAnyWidget(slotName);
230 Widget FindWidgetByName(
string widgetName)
232 return m_wRoot.FindAnyWidget(widgetName);