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_LoadoutGallery.c
Go to the documentation of this file.
1
void
OnLoadoutFocusLostDelegate
(
SCR_BasePlayerLoadout
base
);
2
3
typedef
func
OnLoadoutFocusLostDelegate
;
4
5
typedef
ScriptInvokerBase<OnLoadoutFocusLostDelegate>
OnLoadoutFocusLostInvoker
;
6
7
class
SCR_LoadoutGallery
:
SCR_GalleryComponent
8
{
9
[
Attribute
(
"{39D815C843414C76}UI/layouts/Menus/DeployMenu/LoadoutButton.layout"
)]
10
protected
ResourceName
m_sLoadoutButton
;
11
protected
ref set<SCR_LoadoutButton>
m_aLoadoutButtons
=
new
set<SCR_LoadoutButton>();
12
13
protected
ref
ScriptInvoker<SCR_LoadoutButton>
m_OnLoadoutClicked
;
14
protected
ref
ScriptInvoker<SCR_BasePlayerLoadout>
m_OnLoadoutHovered
;
15
protected
ref
OnLoadoutFocusLostInvoker
m_OnLoadoutFocusLost
;
16
protected
ref
ScriptInvokerBool
m_OnFocusChange
=
new
ScriptInvokerBool
();
17
protected
bool
m_bFocused
;
18
protected
SCR_LoadoutButton
m_SelectedButton
;
19
20
override
void
HandlerAttached
(
Widget
w)
21
{
22
super.HandlerAttached(w);
23
EnablePagingInputListeners
(
false
);
24
}
25
26
ScriptInvokerBool
GetOnFocusChange
()
27
{
28
return
m_OnFocusChange
;
29
}
30
31
void
SetGalleryFocused
(
bool
focused)
32
{
33
Widget
focusedWidget =
GetGame
().GetWorkspace().GetFocusedWidget();
34
if
(
m_bFocused
&& (focusedWidget && focusedWidget.IsInherited(
SCR_LoadoutButton
)))
35
return
;
36
37
m_bFocused
= focused;
38
m_OnFocusChange
.Invoke(
m_bFocused
);
39
}
40
41
override
bool
OnFocus
(
Widget
w,
int
x,
int
y)
42
{
43
super.OnFocus(w, x, y);
44
SetGalleryFocused
(
true
);
45
46
return
false
;
47
}
48
49
override
bool
OnFocusLost
(
Widget
w,
int
x,
int
y)
50
{
51
super.OnFocusLost(w, x, y);
52
SetGalleryFocused
(
false
);
53
54
return
false
;
55
}
56
57
bool
GetFocused
()
58
{
59
return
m_bFocused
;
60
}
61
62
void
EnablePagingInputListeners
(
bool
enable)
63
{
64
GetGame
().GetInputManager().RemoveActionListener(
m_sActionLeft
,
EActionTrigger
.DOWN,
OnCustomLeft
);
65
GetGame
().GetInputManager().RemoveActionListener(
m_sActionRight
,
EActionTrigger
.DOWN,
OnCustomRight
);
66
67
if
(!enable)
68
return
;
69
70
GetGame
().GetInputManager().AddActionListener(
m_sActionLeft
,
EActionTrigger
.DOWN,
OnCustomLeft
);
71
GetGame
().GetInputManager().AddActionListener(
m_sActionRight
,
EActionTrigger
.DOWN,
OnCustomRight
);
72
}
73
74
int
AddItem
(
SCR_BasePlayerLoadout
loadout
,
bool
enabled =
true
)
75
{
76
Widget
supplies =
GetGame
().GetWorkspace().FindAnyWidget(
"w_Supplies"
);
77
Widget
loadoutEntry =
GetGame
().GetWorkspace().CreateWidgets(
m_sLoadoutButton
, supplies);
78
SCR_LoadoutButton
loadoutBtn =
SCR_LoadoutButton
.Cast(loadoutEntry.FindHandler(
SCR_LoadoutButton
));
79
if
(loadoutBtn)
80
{
81
loadoutBtn.
SetLoadout
(
loadout
);
82
loadoutBtn.SetEnabled(enabled);
83
84
loadoutBtn.m_OnClicked.Insert(
OnLoadoutClicked
);
85
loadoutBtn.m_OnFocus.Insert(
OnLoadoutHovered
);
86
loadoutBtn.m_OnMouseEnter.Insert(
OnLoadoutHovered
);
87
loadoutBtn.m_OnMouseLeave.Insert(
OnLoadoutMouseLeave
);
88
loadoutBtn.m_OnFocusLost.Insert(
OnLoadoutFocusLost
);
89
90
m_aLoadoutButtons
.Insert(loadoutBtn);
91
}
92
93
int
itm =
AddItem
(loadoutEntry);
94
ShowPagingButtons
();
// hack to go around hajkovinas
95
96
return
itm;
97
}
98
99
override
void
ShowPagingButtons
(
bool
animate =
true
)
100
{
101
bool
show = (
m_aWidgets
.Count() >
m_iCountShownItems
);
102
if
(
m_PagingLeft
)
103
m_PagingLeft
.SetVisible(show,
false
);
104
105
if
(
m_PagingRight
)
106
m_PagingRight
.SetVisible(show,
false
);
107
}
108
109
protected
void
OnLoadoutClicked
(notnull
SCR_LoadoutButton
loadoutBtn)
110
{
111
GetOnLoadoutClicked
().Invoke(loadoutBtn);
112
}
113
114
protected
void
OnLoadoutHovered
(notnull
Widget
btn)
115
{
116
SCR_LoadoutButton
loadoutBtn =
SCR_LoadoutButton
.Cast(btn.FindHandler(
SCR_LoadoutButton
));
117
if
(loadoutBtn)
118
GetOnLoadoutHovered
().Invoke(loadoutBtn.
GetLoadout
());
119
}
120
121
protected
void
OnLoadoutFocusLost
(notnull
Widget
btn)
122
{
123
SCR_LoadoutButton
loadoutBtn =
SCR_LoadoutButton
.Cast(btn.FindHandler(
SCR_LoadoutButton
));
124
if
(!loadoutBtn)
125
return
;
126
127
if
(loadoutBtn.
IsSelected
() &&
m_OnLoadoutFocusLost
)
128
GetOnLoadoutFocusLost
().Invoke(loadoutBtn.
GetLoadout
());
129
130
if
(
m_SelectedButton
&& !loadoutBtn.
IsSelected
() &&
m_OnLoadoutClicked
)
131
GetOnLoadoutClicked
().Invoke(
m_SelectedButton
);
132
}
133
134
protected
void
OnLoadoutMouseLeave
(notnull
Widget
btn)
135
{
136
OnLoadoutFocusLost
(btn);
137
}
138
139
Widget
GetContentRoot
()
140
{
141
return
m_wContentRoot
;
142
}
143
144
void
SetSelected
(
SCR_BasePlayerLoadout
loadout
)
145
{
146
foreach
(
SCR_LoadoutButton
loadoutBtn :
m_aLoadoutButtons
)
147
{
148
if
(loadoutBtn.GetLoadout() ==
loadout
)
149
{
150
loadoutBtn.SetSelected(
true
);
151
m_SelectedButton
= loadoutBtn;
152
}
153
else
154
{
155
loadoutBtn.SetSelected(
false
);
156
}
157
}
158
}
159
160
override
void
ClearAll
()
161
{
162
super.ClearAll();
163
m_aLoadoutButtons
.Clear();
164
}
165
166
SCR_LoadoutButton
GetButtonForLoadout
(
SCR_BasePlayerLoadout
loadout
)
167
{
168
foreach
(
SCR_LoadoutButton
btn :
m_aLoadoutButtons
)
169
{
170
if
(btn.GetLoadout() ==
loadout
)
171
return
btn;
172
}
173
174
return
null;
175
}
176
177
ScriptInvoker
GetOnLoadoutClicked
()
178
{
179
if
(!
m_OnLoadoutClicked
)
180
m_OnLoadoutClicked
=
new
ScriptInvoker
();
181
182
return
m_OnLoadoutClicked
;
183
}
184
185
ScriptInvoker
GetOnLoadoutHovered
()
186
{
187
if
(!
m_OnLoadoutHovered
)
188
m_OnLoadoutHovered
=
new
ScriptInvoker
();
189
190
return
m_OnLoadoutHovered
;
191
}
192
193
OnLoadoutFocusLostInvoker
GetOnLoadoutFocusLost
()
194
{
195
if
(!
m_OnLoadoutFocusLost
)
196
m_OnLoadoutFocusLost
=
new
OnLoadoutFocusLostInvoker
();
197
198
return
m_OnLoadoutFocusLost
;
199
}
200
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
func
func
Definition
SCR_AIThreatSystem.c:6
loadout
string loadout
Definition
SCR_ArsenalManagerComponent.c:0
base
around base
Definition
SCR_HoldCampaignMilitaryBaseTaskEntity.c:9
OnLoadoutFocusLostDelegate
func OnLoadoutFocusLostDelegate
Definition
SCR_LoadoutGallery.c:3
OnLoadoutFocusLostInvoker
ScriptInvokerBase< OnLoadoutFocusLostDelegate > OnLoadoutFocusLostInvoker
Definition
SCR_LoadoutGallery.c:5
ScriptInvokerBool
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
Definition
SCR_ScriptInvokerHelper.c:41
ResourceName
Definition
ResourceName.c:13
SCR_BasePlayerLoadout
Definition
SCR_BasePlayerLoadout.c:3
SCR_GalleryComponent
Definition
SCR_GalleryComponent.c:2
SCR_GalleryComponent::OnCustomLeft
void OnCustomLeft()
Definition
SCR_GalleryComponent.c:256
SCR_GalleryComponent::m_wContentRoot
Widget m_wContentRoot
Definition
SCR_GalleryComponent.c:48
SCR_GalleryComponent::OnCustomRight
void OnCustomRight()
Definition
SCR_GalleryComponent.c:271
SCR_GalleryComponent::AddItem
Widget AddItem()
Definition
SCR_GalleryComponent.c:408
SCR_GalleryComponent::m_sActionRight
string m_sActionRight
Definition
SCR_GalleryComponent.c:24
SCR_GalleryComponent::m_aWidgets
ref array< Widget > m_aWidgets
Definition
SCR_GalleryComponent.c:44
SCR_GalleryComponent::m_PagingRight
SCR_PagingButtonComponent m_PagingRight
Definition
SCR_GalleryComponent.c:47
SCR_GalleryComponent::m_sActionLeft
string m_sActionLeft
Definition
SCR_GalleryComponent.c:21
SCR_GalleryComponent::m_PagingLeft
SCR_PagingButtonComponent m_PagingLeft
Definition
SCR_GalleryComponent.c:46
SCR_GalleryComponent::m_iCountShownItems
int m_iCountShownItems
Definition
SCR_GalleryComponent.c:9
SCR_LoadoutButton
Definition
SCR_LoadoutRequestUIComponent.c:771
SCR_LoadoutButton::IsSelected
bool IsSelected()
Definition
SCR_LoadoutRequestUIComponent.c:925
SCR_LoadoutButton::GetLoadout
SCR_BasePlayerLoadout GetLoadout()
return player loadout
Definition
SCR_LoadoutRequestUIComponent.c:949
SCR_LoadoutButton::SetLoadout
void SetLoadout(SCR_BasePlayerLoadout loadout)
Assign loadout associated with this button.
Definition
SCR_LoadoutRequestUIComponent.c:850
SCR_LoadoutGallery
Definition
SCR_LoadoutGallery.c:8
SCR_LoadoutGallery::GetOnLoadoutClicked
ScriptInvoker GetOnLoadoutClicked()
Definition
SCR_LoadoutGallery.c:177
SCR_LoadoutGallery::GetOnLoadoutHovered
ScriptInvoker GetOnLoadoutHovered()
Definition
SCR_LoadoutGallery.c:185
SCR_LoadoutGallery::OnLoadoutFocusLost
void OnLoadoutFocusLost(notnull Widget btn)
Definition
SCR_LoadoutGallery.c:121
SCR_LoadoutGallery::AddItem
int AddItem(SCR_BasePlayerLoadout loadout, bool enabled=true)
Definition
SCR_LoadoutGallery.c:74
SCR_LoadoutGallery::GetFocused
bool GetFocused()
Definition
SCR_LoadoutGallery.c:57
SCR_LoadoutGallery::GetContentRoot
Widget GetContentRoot()
Definition
SCR_LoadoutGallery.c:139
SCR_LoadoutGallery::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
SCR_LoadoutGallery.c:41
SCR_LoadoutGallery::m_bFocused
bool m_bFocused
Definition
SCR_LoadoutGallery.c:17
SCR_LoadoutGallery::SetGalleryFocused
void SetGalleryFocused(bool focused)
Definition
SCR_LoadoutGallery.c:31
SCR_LoadoutGallery::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_LoadoutGallery.c:20
SCR_LoadoutGallery::SetSelected
void SetSelected(SCR_BasePlayerLoadout loadout)
Definition
SCR_LoadoutGallery.c:144
SCR_LoadoutGallery::m_sLoadoutButton
ResourceName m_sLoadoutButton
Definition
SCR_LoadoutGallery.c:10
SCR_LoadoutGallery::m_OnLoadoutClicked
ref ScriptInvoker< SCR_LoadoutButton > m_OnLoadoutClicked
Definition
SCR_LoadoutGallery.c:13
SCR_LoadoutGallery::m_OnLoadoutFocusLost
ref OnLoadoutFocusLostInvoker m_OnLoadoutFocusLost
Definition
SCR_LoadoutGallery.c:15
SCR_LoadoutGallery::GetOnFocusChange
ScriptInvokerBool GetOnFocusChange()
Definition
SCR_LoadoutGallery.c:26
SCR_LoadoutGallery::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
SCR_LoadoutGallery.c:49
SCR_LoadoutGallery::GetButtonForLoadout
SCR_LoadoutButton GetButtonForLoadout(SCR_BasePlayerLoadout loadout)
Definition
SCR_LoadoutGallery.c:166
SCR_LoadoutGallery::GetOnLoadoutFocusLost
OnLoadoutFocusLostInvoker GetOnLoadoutFocusLost()
Definition
SCR_LoadoutGallery.c:193
SCR_LoadoutGallery::m_SelectedButton
SCR_LoadoutButton m_SelectedButton
Definition
SCR_LoadoutGallery.c:18
SCR_LoadoutGallery::ShowPagingButtons
override void ShowPagingButtons(bool animate=true)
Definition
SCR_LoadoutGallery.c:99
SCR_LoadoutGallery::m_aLoadoutButtons
ref set< SCR_LoadoutButton > m_aLoadoutButtons
Definition
SCR_LoadoutGallery.c:11
SCR_LoadoutGallery::ClearAll
override void ClearAll()
Definition
SCR_LoadoutGallery.c:160
SCR_LoadoutGallery::OnLoadoutHovered
void OnLoadoutHovered(notnull Widget btn)
Definition
SCR_LoadoutGallery.c:114
SCR_LoadoutGallery::m_OnFocusChange
ref ScriptInvokerBool m_OnFocusChange
Definition
SCR_LoadoutGallery.c:16
SCR_LoadoutGallery::OnLoadoutMouseLeave
void OnLoadoutMouseLeave(notnull Widget btn)
Definition
SCR_LoadoutGallery.c:134
SCR_LoadoutGallery::OnLoadoutClicked
void OnLoadoutClicked(notnull SCR_LoadoutButton loadoutBtn)
Definition
SCR_LoadoutGallery.c:109
SCR_LoadoutGallery::m_OnLoadoutHovered
ref ScriptInvoker< SCR_BasePlayerLoadout > m_OnLoadoutHovered
Definition
SCR_LoadoutGallery.c:14
SCR_LoadoutGallery::EnablePagingInputListeners
void EnablePagingInputListeners(bool enable)
Definition
SCR_LoadoutGallery.c:62
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
UI
Menu
DeployMenu
SCR_LoadoutGallery.c
Generated by
1.17.0