Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_HUDLayout.c
Go to the documentation of this file.
1
[
BaseContainerProps
(configRoot:
true
)]
2
class
SCR_HUDLayout
3
{
4
protected
ref array<ref Widget>
m_aAllGroups
= {};
5
protected
ref array<ref SCR_HUDElement>
m_aElements
= {};
6
7
[
Attribute
()]
8
protected
string
m_sIdentifier
;
9
10
[
Attribute
(
params
:
"layout"
)]
11
protected
ResourceName
m_sLayout
;
12
13
protected
Widget
m_wRoot
;
14
15
//------------------------------------------------------------------------------------------------
16
void
SetIdentifier
(
string
id
)
17
{
18
if
(
id
==
string
.Empty)
19
return
;
20
21
PlayerController pController =
GetGame
().GetPlayerController();
22
if
(!pController)
23
return
;
24
25
SCR_HUDManagerComponent
hudManager =
SCR_HUDManagerComponent
.Cast(pController.FindComponent(
SCR_HUDManagerComponent
));
26
if
(!hudManager)
27
return
;
28
29
SCR_HUDManagerLayoutHandler
layoutHandler =
SCR_HUDManagerLayoutHandler
.Cast(hudManager.
FindHandler
(
SCR_HUDManagerLayoutHandler
));
30
if
(!layoutHandler)
31
return
;
32
33
array <string> allIdentifiers = layoutHandler.
GetAllIdentifiers
();
34
35
if
(allIdentifiers.Contains(
id
))
36
{
37
Print
(
"HUDManager: Identifier: "
+
id
+
" is already used! Check if your Identifier is Unique!"
,
LogLevel
.ERROR);
38
return
;
39
}
40
41
m_sIdentifier
=
id
;
42
}
43
44
//------------------------------------------------------------------------------------------------
45
int
GetHUDElements
(notnull out array<SCR_HUDElement> hudElements)
46
{
47
foreach
(
SCR_HUDElement
element :
m_aElements
)
48
{
49
hudElements.Insert(element);
50
}
51
52
return
hudElements.Count();
53
}
54
55
//------------------------------------------------------------------------------------------------
56
string
GetIdentifier
()
57
{
58
return
m_sIdentifier
;
59
}
60
61
//------------------------------------------------------------------------------------------------
62
ResourceName
GetLayout
()
63
{
64
return
m_sLayout
;
65
}
66
67
//------------------------------------------------------------------------------------------------
68
Widget
GetRootWidget
()
69
{
70
return
m_wRoot
;
71
}
72
73
//------------------------------------------------------------------------------------------------
74
void
SetRootWidget
(notnull
Widget
widget)
75
{
76
m_wRoot
= widget;
77
78
Widget
iteratedWidget =
m_wRoot
.GetChildren();
79
while
(iteratedWidget)
80
{
81
Widget
iteratedChildWidget = iteratedWidget.GetChildren();
82
while
(iteratedChildWidget)
83
{
84
SCR_HUDGroupUIComponent
groupComponent =
SCR_HUDGroupUIComponent
.Cast(iteratedChildWidget.FindHandler(
SCR_HUDGroupUIComponent
));
85
if
(!groupComponent)
86
{
87
iteratedChildWidget = iteratedChildWidget.GetSibling();
88
continue
;
89
}
90
91
m_aAllGroups
.Insert(iteratedChildWidget);
92
iteratedChildWidget = iteratedChildWidget.GetSibling();
93
}
94
95
iteratedWidget = iteratedWidget.GetSibling();
96
}
97
}
98
99
//------------------------------------------------------------------------------------------------
100
void
ResizeLayout
()
101
{
102
array<SCR_HUDGroupUIComponent> groupsInLayout = {};
103
GetAllGroupComponents
(groupsInLayout);
104
105
foreach
(
SCR_HUDGroupUIComponent
groupComponent : groupsInLayout)
106
{
107
groupComponent.ResizeGroup();
108
}
109
}
110
111
//------------------------------------------------------------------------------------------------
112
void
AddHudElement
(notnull
SCR_HUDElement
element,
bool
replaceParent =
false
)
113
{
114
if
(!
m_wRoot
)
115
return
;
116
117
Widget
slotWidget = element.GetWidget();
118
if
(!slotWidget)
119
return
;
120
121
Widget
parentWidget =
m_wRoot
.FindAnyWidget(element.GetParentWidgetName());
122
if
(!parentWidget)
123
return
;
124
125
if
(replaceParent)
126
parentWidget.AddChild(slotWidget);
127
128
m_aElements
.Insert(element);
129
element.SetParentLayout(
this
);
130
}
131
132
//------------------------------------------------------------------------------------------------
133
void
RemoveHudElement
(notnull
SCR_HUDElement
element,
bool
replaceParent =
false
)
134
{
135
Widget
elementWidget = element.GetWidget();
136
if
(!elementWidget)
137
return
;
138
139
Widget
parentWidget = elementWidget.GetParent();
140
if
(replaceParent && parentWidget)
141
parentWidget.RemoveChild(elementWidget);
142
143
m_aElements
.RemoveItem(element);
144
}
145
146
//------------------------------------------------------------------------------------------------
151
Widget
GetGroupWidgetByName
(
string
groupName)
152
{
153
if
(!
m_wRoot
)
154
return
null;
155
156
return
m_wRoot
.FindAnyWidget(groupName);
157
}
158
159
//------------------------------------------------------------------------------------------------
164
SCR_HUDGroupUIComponent
GetGroupComponent
(
string
groupName)
165
{
166
Widget
group =
GetGroupWidgetByName
(groupName);
167
if
(!group)
168
return
null;
169
return
SCR_HUDGroupUIComponent
.Cast(group.FindHandler(
SCR_HUDGroupUIComponent
));
170
}
171
172
//------------------------------------------------------------------------------------------------
177
int
GetAllGroupComponents
(notnull out array<SCR_HUDGroupUIComponent> groupComponents)
178
{
179
groupComponents.Clear();
180
foreach
(
Widget
groupWidget :
m_aAllGroups
)
181
{
182
SCR_HUDGroupUIComponent
groupComponent =
SCR_HUDGroupUIComponent
.Cast(groupWidget.FindHandler(
SCR_HUDGroupUIComponent
));
183
if
(groupComponent)
184
groupComponents.Insert(groupComponent);
185
}
186
187
return
groupComponents.Count();
188
}
189
190
//------------------------------------------------------------------------------------------------
195
int
GetAllSlotComponents
(notnull out array<SCR_HUDSlotUIComponent> slotComponents)
196
{
197
slotComponents.Clear();
198
199
foreach
(
Widget
groupWidget :
m_aAllGroups
)
200
{
201
Widget
childWidget = groupWidget.GetChildren();
202
while
(childWidget)
203
{
204
SCR_HUDSlotUIComponent
slotComponent =
SCR_HUDSlotUIComponent
.Cast(childWidget.FindHandler(
SCR_HUDSlotUIComponent
));
205
if
(!slotComponent)
206
{
207
childWidget = childWidget.GetSibling();
208
continue
;
209
}
210
211
slotComponents.Insert(slotComponent);
212
childWidget = childWidget.GetSibling();
213
}
214
}
215
216
return
slotComponents.Count();
217
}
218
219
//------------------------------------------------------------------------------------------------
220
SCR_HUDSlotUIComponent
FindSlotComponent
(
string
slotName)
221
{
222
Widget
slotWidget =
m_wRoot
.FindAnyWidget(slotName);
223
if
(!slotWidget)
224
return
null;
225
226
return
SCR_HUDSlotUIComponent
.Cast(slotWidget.FindHandler(
SCR_HUDSlotUIComponent
));
227
}
228
229
//------------------------------------------------------------------------------------------------
230
Widget
FindWidgetByName
(
string
widgetName)
231
{
232
return
m_wRoot
.FindAnyWidget(widgetName);
233
}
234
}
id
AddonBuildInfoTool id
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
ResourceName
Definition
ResourceName.c:13
SCR_HUDElement
Definition
SCR_HUDFreeSlot.c:2
SCR_HUDGroupUIComponent
Definition
SCR_HUDGroupUIComponent.c:2
SCR_HUDLayout
Definition
SCR_HUDLayout.c:3
SCR_HUDLayout::RemoveHudElement
void RemoveHudElement(notnull SCR_HUDElement element, bool replaceParent=false)
Definition
SCR_HUDLayout.c:133
SCR_HUDLayout::AddHudElement
void AddHudElement(notnull SCR_HUDElement element, bool replaceParent=false)
Definition
SCR_HUDLayout.c:112
SCR_HUDLayout::m_aAllGroups
ref array< ref Widget > m_aAllGroups
Definition
SCR_HUDLayout.c:4
SCR_HUDLayout::ResizeLayout
void ResizeLayout()
Definition
SCR_HUDLayout.c:100
SCR_HUDLayout::GetGroupComponent
SCR_HUDGroupUIComponent GetGroupComponent(string groupName)
Definition
SCR_HUDLayout.c:164
SCR_HUDLayout::m_sIdentifier
string m_sIdentifier
Definition
SCR_HUDLayout.c:8
SCR_HUDLayout::m_aElements
ref array< ref SCR_HUDElement > m_aElements
Definition
SCR_HUDLayout.c:5
SCR_HUDLayout::GetAllGroupComponents
int GetAllGroupComponents(notnull out array< SCR_HUDGroupUIComponent > groupComponents)
Definition
SCR_HUDLayout.c:177
SCR_HUDLayout::GetLayout
ResourceName GetLayout()
Definition
SCR_HUDLayout.c:62
SCR_HUDLayout::SetIdentifier
void SetIdentifier(string id)
Definition
SCR_HUDLayout.c:16
SCR_HUDLayout::GetHUDElements
int GetHUDElements(notnull out array< SCR_HUDElement > hudElements)
Definition
SCR_HUDLayout.c:45
SCR_HUDLayout::GetRootWidget
Widget GetRootWidget()
Definition
SCR_HUDLayout.c:68
SCR_HUDLayout::FindWidgetByName
Widget FindWidgetByName(string widgetName)
Definition
SCR_HUDLayout.c:230
SCR_HUDLayout::GetIdentifier
string GetIdentifier()
Definition
SCR_HUDLayout.c:56
SCR_HUDLayout::m_sLayout
ResourceName m_sLayout
Definition
SCR_HUDLayout.c:11
SCR_HUDLayout::SetRootWidget
void SetRootWidget(notnull Widget widget)
Definition
SCR_HUDLayout.c:74
SCR_HUDLayout::GetGroupWidgetByName
Widget GetGroupWidgetByName(string groupName)
Definition
SCR_HUDLayout.c:151
SCR_HUDLayout::m_wRoot
Widget m_wRoot
Definition
SCR_HUDLayout.c:13
SCR_HUDLayout::GetAllSlotComponents
int GetAllSlotComponents(notnull out array< SCR_HUDSlotUIComponent > slotComponents)
Definition
SCR_HUDLayout.c:195
SCR_HUDLayout::FindSlotComponent
SCR_HUDSlotUIComponent FindSlotComponent(string slotName)
Definition
SCR_HUDLayout.c:220
SCR_HUDManagerComponent
Definition
SCR_HUDManagerComponent.c:24
SCR_HUDManagerComponent::FindHandler
SCR_HUDManagerHandler FindHandler(typename handlerType)
Definition
SCR_HUDManagerComponent.c:78
SCR_HUDManagerLayoutHandler
Definition
SCR_HUDManagerLayoutHandler.c:8
SCR_HUDManagerLayoutHandler::GetAllIdentifiers
array< string > GetAllIdentifiers()
Definition
SCR_HUDManagerLayoutHandler.c:78
SCR_HUDSlotUIComponent
Definition
SCR_HUDSlotUIComponent.c:6
Widget
Definition
Widget.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
HUD
SCR_HUDLayout.c
Generated by
1.17.0