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_MapTaskListUI.c
Go to the documentation of this file.
1
class
SCR_MapTaskListUI
:
SCR_MapUIBaseComponent
2
{
3
[
Attribute
(
"exclamationCircle"
,
desc
:
"Map task list imageset quad name"
)]
4
protected
string
m_sTaskListToolMenuIconName
;
5
6
[
Attribute
(
"{ACCF501DD69CAF7B}UI/layouts/Tasks/TaskListWrapper.layout"
)]
7
protected
ResourceName
m_sTaskListLayout
;
8
9
[
Attribute
(
"MapTaskList"
,
desc
:
"Map task list root widget name"
)]
10
protected
string
m_sMapTaskListFrame
;
11
12
[
Attribute
(
"m_wTaskList"
,
desc
:
"Task list widget name"
)]
13
protected
string
m_sTaskList
;
14
15
[
Attribute
(
"8"
,
desc
:
"Offset substracted from total widget size."
,
params
:
"0 inf"
)]
16
protected
int
m_iOffset
;
17
18
[
Attribute
(
"0"
,
desc
:
"Show assign group list"
)]
19
protected
bool
m_bShowAssignGroupList
;
20
21
[
Attribute
(
"1"
,
desc
:
"Show all task types"
)]
22
protected
bool
m_bShowAllTaskTypenames
;
23
24
[
Attribute
(
""
,
UIWidgets
.Auto,
"Show only task typenames, which is in the list, only if m_bShowAllTaskType is false"
)]
25
protected
ref array<string>
m_aAllowedTaskTypenames
;
26
27
protected
const
string
ICON_NAME
=
"faction"
;
28
protected
const
float
TASK_LIST_HUD_OFFSET
= -0.25;
29
protected
const
string
CONTEXT_ASSIGN_GROUP_LIST
=
"TaskAssignGroupListContext"
;
30
protected
Widget
m_wTaskList
;
31
protected
Widget
m_wTaskListFrame
;
32
protected
SCR_TaskManagerUIComponent
m_TaskUIManager
;
33
protected
SCR_MapToolMenuUI
m_ToolMenu
;
34
protected
SCR_MapToolEntry
m_ToolMenuEntry
;
35
36
protected
SCR_TaskListUIComponent
m_TaskComponent
;
37
38
protected
bool
m_bOpened
;
39
protected
bool
m_bMapContextAllowed
;
40
41
protected
const
string
ACTION_OPEN_TASK_LIST
=
"TasksOpen"
;
42
43
//------------------------------------------------------------------------------------------------
46
override
protected
void
OnMapOpen
(
MapConfiguration
config)
47
{
48
m_wTaskListFrame
=
m_RootWidget
.FindAnyWidget(
m_sMapTaskListFrame
);
49
if
(!
m_wTaskListFrame
)
50
return
;
51
52
CreateTaskList
(
m_wTaskListFrame
);
53
54
GetGame
().GetCallqueue().Call(
UpdateTaskListHeight
);
55
GetGame
().GetInputManager().AddActionListener(
ACTION_OPEN_TASK_LIST
,
EActionTrigger
.DOWN,
ToggleTaskListListener
);
56
ToggleTaskList
(
false
);
57
}
58
59
//------------------------------------------------------------------------------------------------
62
override
protected
void
OnMapClose
(
MapConfiguration
config)
63
{
64
SCR_MapCursorModule cursorModule = SCR_MapCursorModule.Cast(
m_MapEntity
.GetMapModule(SCR_MapCursorModule));
65
if
(cursorModule)
66
cursorModule.SetJournalVisibility(
false
);
67
68
GetGame
().GetInputManager().RemoveActionListener(
ACTION_OPEN_TASK_LIST
,
EActionTrigger
.DOWN,
ToggleTaskListListener
);
69
if
(!
m_wTaskListFrame
)
70
return
;
71
72
array<ref Widget> tasks = {};
73
SCR_WidgetHelper
.GetAllChildren(
m_wTaskListFrame
, tasks);
74
75
foreach
(
Widget
w : tasks)
76
{
77
w.RemoveFromHierarchy();
78
}
79
80
m_ToolMenuEntry
.SetActive(
false
);
81
}
82
83
//------------------------------------------------------------------------------------------------
85
override
void
Init
()
86
{
87
m_TaskUIManager
=
SCR_TaskManagerUIComponent
.
GetInstance
();
88
if
(!
m_TaskUIManager
)
89
{
90
SetActive
(
false
);
// deactivate component
91
return
;
92
}
93
94
m_ToolMenu
=
SCR_MapToolMenuUI
.Cast(
m_MapEntity
.GetMapUIComponent(
SCR_MapToolMenuUI
));
95
if
(
m_ToolMenu
)
96
{
97
m_ToolMenuEntry
=
m_ToolMenu
.RegisterToolMenuEntry(
SCR_MapToolMenuUI
.s_sToolMenuIcons,
ICON_NAME
, 2,
m_bIsExclusive
);
98
m_ToolMenuEntry
.m_OnClick.Insert(
OnMapTaskListClicked
);
99
m_ToolMenuEntry
.GetOnDisableMapUIInvoker().Insert(
DisableMapUIComponent
);
100
m_ToolMenuEntry
.SetEnabled(
true
);
101
}
102
103
GetGame
().OnInputDeviceIsGamepadInvoker().Insert(
OnInputDeviceIsGamepad
);
104
105
//If there is a OverlayWidget like on the DeployMenu we use that instead of the default one
106
m_wTaskListFrame
=
m_RootWidget
.FindAnyWidget(
m_sMapTaskListFrame
);
107
}
108
109
//------------------------------------------------------------------------------------------------
112
protected
void
CreateTaskList
(
Widget
parent = null)
113
{
114
Widget
widget;
115
if
(parent)
116
{
117
widget =
GetGame
().GetWorkspace().CreateWidgets(
m_sTaskListLayout
, parent);
118
}
119
else
120
{
121
widget =
GetGame
().GetWorkspace().CreateWidgets(
m_sTaskListLayout
);
122
FrameSlot
.SetAlignment(widget, 0,
TASK_LIST_HUD_OFFSET
);
123
}
124
125
if
(!widget)
126
return
;
127
128
m_wTaskList
= widget.FindAnyWidget(
m_sTaskList
);
129
if
(!
m_wTaskList
)
130
return
;
131
132
m_TaskComponent
= SCR_TaskListUIComponent.Cast(
m_wTaskList
.FindHandler(SCR_TaskListUIComponent));
133
if
(!
m_TaskComponent
)
134
return
;
135
136
if
(!
m_bShowAllTaskTypenames
&&
m_TaskUIManager
)
137
{
138
m_TaskComponent
.AddAllowedTaskTypenames(
m_aAllowedTaskTypenames
);
139
}
140
141
m_TaskComponent
.RefreshTaskList();
142
m_TaskComponent
.GetOnButtonTaskListHide().Insert(
OnButtonTaskListHide
);
143
144
m_TaskComponent
.SetTaskListVisibility(
false
);
145
146
SCR_UISoundEntity
.SoundEvent(
SCR_SoundEvent
.SOUND_HUD_TASK_MENU_OPEN);
147
}
148
149
//------------------------------------------------------------------------------------------------
150
override
void
Update
(
float
timeSlice)
151
{
152
if
(!
m_TaskComponent
|| !
m_TaskComponent
.GetTaskDescription())
153
return
;
154
155
if
(
m_TaskComponent
.GetTaskDescription().IsAssignGroupListOpened())
156
GetGame
().GetInputManager().ActivateContext(
CONTEXT_ASSIGN_GROUP_LIST
);
157
}
158
159
//------------------------------------------------------------------------------------------------
161
protected
void
UpdateTaskListHeight
()
162
{
163
Widget
toolMenuBackground =
m_ToolMenu
.GetBackgroundWidget();
164
if
(!toolMenuBackground)
165
return
;
166
167
toolMenuBackground.Update();
168
169
float
sizeW, sizeY;
170
toolMenuBackground.GetScreenSize(sizeW, sizeY);
171
172
sizeY =
GetGame
().GetWorkspace().DPIUnscale(sizeY) -
m_iOffset
;
173
174
m_TaskComponent
.SetTaskListHeight(sizeY);
175
}
176
177
//------------------------------------------------------------------------------------------------
179
protected
void
ToggleTaskListListener
()
180
{
181
ToggleTaskList
(!
m_bOpened
);
182
}
183
184
//------------------------------------------------------------------------------------------------
186
void
SetMapContextAllowed
(
bool
val)
187
{
188
m_bMapContextAllowed
= val;
189
}
190
191
//------------------------------------------------------------------------------------------------
194
void
ToggleTaskList
(
bool
visibility)
195
{
196
m_wTaskListFrame
.SetVisible(visibility);
197
if
(
m_TaskComponent
)
198
{
199
m_TaskComponent
.SetTaskListVisibility(visibility);
200
m_TaskComponent
.FocusOnEntry();
201
}
202
203
m_bOpened
= visibility;
204
205
if
(
m_ToolMenuEntry
)
206
m_ToolMenuEntry
.SetActive(visibility);
207
}
208
209
//------------------------------------------------------------------------------------------------
212
protected
void
OnMapTaskListClicked
(notnull
SCR_ButtonBaseComponent
comp)
213
{
214
if
(!
m_TaskComponent
)
215
return
;
216
217
ToggleTaskList
(!
m_TaskComponent
.GetTaskListVisibility());
218
219
array<ref SCR_MapToolEntry> menuEntries = {};
220
menuEntries =
m_ToolMenu
.GetMenuEntries();
221
if
(!menuEntries || menuEntries.IsEmpty())
222
return
;
223
224
Widget
mapTaskListFrame;
225
foreach
(
SCR_MapToolEntry
toolEntry : menuEntries)
226
{
227
if
(toolEntry.GetImageSet() !=
m_sTaskListToolMenuIconName
)
228
continue
;
229
230
toolEntry.SetActive(
false
);
231
232
break
;
233
}
234
}
235
236
//------------------------------------------------------------------------------------------------
237
protected
void
OnButtonTaskListHide
()
238
{
239
DisableMapUIComponent
();
240
}
241
242
//------------------------------------------------------------------------------------------------
243
protected
void
OnInputDeviceIsGamepad
(
bool
isGamepad)
244
{
245
if
(isGamepad &&
m_bOpened
)
246
{
247
m_bMapContextAllowed
=
false
;
248
return
;
249
}
250
251
m_bMapContextAllowed
=
true
;
252
}
253
254
//------------------------------------------------------------------------------------------------
255
override
void
HandlerDeattached
(
Widget
w)
256
{
257
if
(
SCR_Global
.
IsEditMode
())
258
return
;
259
260
if
(
m_ToolMenuEntry
)
261
m_ToolMenuEntry
.GetOnDisableMapUIInvoker().Remove(
DisableMapUIComponent
);
262
263
GetGame
().OnInputDeviceIsGamepadInvoker().Remove(
OnInputDeviceIsGamepad
);
264
}
265
266
//------------------------------------------------------------------------------------------------
267
bool
IsTaskListVisible
()
268
{
269
if
(
m_wTaskList
)
270
return
m_wTaskList
.IsVisible();
271
272
return
false
;
273
}
274
275
//------------------------------------------------------------------------------------------------
276
protected
void
DisableMapUIComponent
()
277
{
278
ToggleTaskList
(
false
);
279
}
280
281
//------------------------------------------------------------------------------------------------
283
bool
CanShowAssignGroupList
()
284
{
285
return
m_bShowAssignGroupList
;
286
}
287
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_MapToolMenuUI
void SCR_MapToolMenuUI()
Definition
SCR_MapToolMenuUI.c:484
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
FrameSlot
Definition
FrameSlot.c:13
MapConfiguration
Definition
MapConfiguration.c:3
ResourceName
Definition
ResourceName.c:13
SCR_ButtonBaseComponent
Base class for any button, regardless its own content.
Definition
SCR_ButtonBaseComponent.c:7
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_MapTaskListUI
Definition
SCR_MapTaskListUI.c:2
SCR_MapTaskListUI::TASK_LIST_HUD_OFFSET
const float TASK_LIST_HUD_OFFSET
Definition
SCR_MapTaskListUI.c:28
SCR_MapTaskListUI::m_bMapContextAllowed
bool m_bMapContextAllowed
Definition
SCR_MapTaskListUI.c:39
SCR_MapTaskListUI::m_ToolMenuEntry
SCR_MapToolEntry m_ToolMenuEntry
Definition
SCR_MapTaskListUI.c:34
SCR_MapTaskListUI::SetMapContextAllowed
void SetMapContextAllowed(bool val)
Definition
SCR_MapTaskListUI.c:186
SCR_MapTaskListUI::m_TaskUIManager
SCR_TaskManagerUIComponent m_TaskUIManager
Definition
SCR_MapTaskListUI.c:32
SCR_MapTaskListUI::m_sTaskListToolMenuIconName
string m_sTaskListToolMenuIconName
Definition
SCR_MapTaskListUI.c:4
SCR_MapTaskListUI::OnButtonTaskListHide
void OnButtonTaskListHide()
Definition
SCR_MapTaskListUI.c:237
SCR_MapTaskListUI::m_TaskComponent
SCR_TaskListUIComponent m_TaskComponent
Definition
SCR_MapTaskListUI.c:36
SCR_MapTaskListUI::DisableMapUIComponent
void DisableMapUIComponent()
Definition
SCR_MapTaskListUI.c:276
SCR_MapTaskListUI::m_wTaskList
Widget m_wTaskList
Definition
SCR_MapTaskListUI.c:30
SCR_MapTaskListUI::CreateTaskList
void CreateTaskList(Widget parent=null)
Definition
SCR_MapTaskListUI.c:112
SCR_MapTaskListUI::Init
override void Init()
Register task list button to the tools menu.
Definition
SCR_MapTaskListUI.c:85
SCR_MapTaskListUI::m_bShowAllTaskTypenames
bool m_bShowAllTaskTypenames
Definition
SCR_MapTaskListUI.c:22
SCR_MapTaskListUI::ICON_NAME
const string ICON_NAME
Definition
SCR_MapTaskListUI.c:27
SCR_MapTaskListUI::OnMapClose
void OnMapClose(MapConfiguration config)
Definition
SCR_MapTaskListUI.c:62
SCR_MapTaskListUI::m_iOffset
int m_iOffset
Definition
SCR_MapTaskListUI.c:16
SCR_MapTaskListUI::OnInputDeviceIsGamepad
void OnInputDeviceIsGamepad(bool isGamepad)
Definition
SCR_MapTaskListUI.c:243
SCR_MapTaskListUI::ToggleTaskListListener
void ToggleTaskListListener()
Toggle task list visibility.
Definition
SCR_MapTaskListUI.c:179
SCR_MapTaskListUI::m_bOpened
bool m_bOpened
Definition
SCR_MapTaskListUI.c:38
SCR_MapTaskListUI::Update
override void Update(float timeSlice)
Definition
SCR_MapTaskListUI.c:150
SCR_MapTaskListUI::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_MapTaskListUI.c:255
SCR_MapTaskListUI::OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition
SCR_MapTaskListUI.c:46
SCR_MapTaskListUI::UpdateTaskListHeight
void UpdateTaskListHeight()
Update task list height to match tools menu height.
Definition
SCR_MapTaskListUI.c:161
SCR_MapTaskListUI::OnMapTaskListClicked
void OnMapTaskListClicked(notnull SCR_ButtonBaseComponent comp)
Definition
SCR_MapTaskListUI.c:212
SCR_MapTaskListUI::m_sTaskList
string m_sTaskList
Definition
SCR_MapTaskListUI.c:13
SCR_MapTaskListUI::ToggleTaskList
void ToggleTaskList(bool visibility)
Definition
SCR_MapTaskListUI.c:194
SCR_MapTaskListUI::m_sMapTaskListFrame
string m_sMapTaskListFrame
Definition
SCR_MapTaskListUI.c:10
SCR_MapTaskListUI::m_sTaskListLayout
ResourceName m_sTaskListLayout
Definition
SCR_MapTaskListUI.c:7
SCR_MapTaskListUI::CONTEXT_ASSIGN_GROUP_LIST
const string CONTEXT_ASSIGN_GROUP_LIST
Definition
SCR_MapTaskListUI.c:29
SCR_MapTaskListUI::ACTION_OPEN_TASK_LIST
const string ACTION_OPEN_TASK_LIST
Definition
SCR_MapTaskListUI.c:41
SCR_MapTaskListUI::IsTaskListVisible
bool IsTaskListVisible()
Definition
SCR_MapTaskListUI.c:267
SCR_MapTaskListUI::m_aAllowedTaskTypenames
ref array< string > m_aAllowedTaskTypenames
Definition
SCR_MapTaskListUI.c:25
SCR_MapTaskListUI::m_ToolMenu
SCR_MapToolMenuUI m_ToolMenu
Definition
SCR_MapTaskListUI.c:33
SCR_MapTaskListUI::m_wTaskListFrame
Widget m_wTaskListFrame
Definition
SCR_MapTaskListUI.c:31
SCR_MapTaskListUI::CanShowAssignGroupList
bool CanShowAssignGroupList()
return true if can show assign group list
Definition
SCR_MapTaskListUI.c:283
SCR_MapTaskListUI::m_bShowAssignGroupList
bool m_bShowAssignGroupList
Definition
SCR_MapTaskListUI.c:19
SCR_MapToolEntry
Map tool menu entry data class.
Definition
SCR_MapToolMenuUI.c:3
SCR_MapUIBaseComponent::m_bIsExclusive
bool m_bIsExclusive
Definition
SCR_MapUIBaseComponent.c:9
SCR_MapUIBaseComponent::SCR_MapUIBaseComponent
void SCR_MapUIBaseComponent()
Definition
SCR_MapUIBaseComponent.c:94
SCR_MapUIBaseComponent::m_MapEntity
SCR_MapEntity m_MapEntity
Definition
SCR_MapUIBaseComponent.c:13
SCR_MapUIBaseComponent::m_RootWidget
Widget m_RootWidget
Definition
SCR_MapUIBaseComponent.c:12
SCR_MapUIBaseComponent::SetActive
void SetActive(bool active, bool isCleanup=false)
Definition
SCR_MapUIBaseComponent.c:55
SCR_SoundEvent
Definition
SCR_SoundEvent.c:2
SCR_TaskManagerUIComponent
Definition
SCR_TaskManagerUIComponent.c:27
SCR_TaskManagerUIComponent::GetInstance
static SCR_TaskManagerUIComponent GetInstance()
Definition
SCR_TaskManagerUIComponent.c:436
SCR_UISoundEntity
Definition
SCR_UISoundEntity.c:8
SCR_WidgetHelper
Definition
SCR_WidgetHelper.c:2
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
scripts
Game
Map
ComponentsUI
SCR_MapTaskListUI.c
Generated by
1.17.0