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_TutorialFastTravelMapMenuUI.c
Go to the documentation of this file.
1
2
//------------------------------------------------------------------------------------------------
4
class
SCR_TutorialFastTravelMapMenuUI
:
ChimeraMenuBase
5
{
6
protected
SCR_MapEntity
m_MapEntity
;
7
protected
SCR_TutorialFastTravelSpinBox
m_SpinboxComp
;
8
protected
SCR_Task
m_SelectedTask
;
9
10
//------------------------------------------------------------------------------------------------
11
protected
SCR_TutorialTaskMapUIComponent
GetTaskMapUIComponent
(
SCR_Task
task
)
12
{
13
if
(!
task
|| !
m_MapEntity
)
14
return
null;
15
16
SCR_MapUIElementContainer
mapUIElementContainer =
SCR_MapUIElementContainer
.Cast(
m_MapEntity
.GetMapUIComponent(
SCR_MapUIElementContainer
));
17
if
(!mapUIElementContainer)
18
return
null;
19
20
return
SCR_TutorialTaskMapUIComponent
.Cast(mapUIElementContainer.
GetTaskFromID
(
task
.GetTaskID()));
21
}
22
23
//------------------------------------------------------------------------------------------------
24
protected
void
ConfirmSelection
()
25
{
26
if
(!
m_SelectedTask
)
27
return
;
28
29
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
30
if
(!tutorial)
31
return
;
32
33
tutorial.FastTravelToCourse(
m_SelectedTask
.GetTaskID().ToInt());
34
35
MenuManager
menuMan =
GetGame
().GetMenuManager();
36
if
(menuMan)
37
menuMan.
FindMenuByPreset
(
ChimeraMenuPreset
.TutorialFastTravel).Close();
38
}
39
40
//------------------------------------------------------------------------------------------------
41
protected
void
SelectTask
(
SCR_Task
task
)
42
{
43
if
(!
task
)
44
return
;
45
46
if
(
m_SelectedTask
)
47
{
48
SCR_TutorialTaskMapUIComponent
taskUI =
GetTaskMapUIComponent
(
m_SelectedTask
);
49
if
(taskUI)
50
taskUI.
SetSelected
(
false
);
51
}
52
53
m_SelectedTask
=
task
;
54
SCR_TutorialTaskMapUIComponent
taskUI =
GetTaskMapUIComponent
(
m_SelectedTask
);
55
if
(taskUI)
56
taskUI.
SetSelected
(
true
);
57
58
vector
position
=
task
.GetOrigin();
59
if
(
m_MapEntity
)
60
m_MapEntity
.ZoomPanSmooth(1.5,
position
[0],
position
[2]);
61
62
m_SpinboxComp
.SetCurrentItem(
m_SpinboxComp
.GetItemIndex(
task
));
63
}
64
65
//------------------------------------------------------------------------------------------------
66
override
void
OnMenuOpen
()
67
{
68
if
(!
m_MapEntity
)
69
return
;
70
71
MapConfiguration
mapConfigFullscreen =
m_MapEntity
.SetupMapConfig(
EMapEntityMode
.TUTORIALFASTTRAVEL,
"{727AAAACDCBB4EFE}Configs/Map/TutorialFastTravelMap.conf"
, GetRootWidget());
72
m_MapEntity
.OpenMap(mapConfigFullscreen);
73
74
m_MapEntity
.GetOnMapOpen().Insert(
OnMapOpen
);
75
76
SetupSpinbox
();
77
78
SCR_TaskManagerUIComponent
taskManagerUI =
SCR_TaskManagerUIComponent
.
GetInstance
();
79
if
(taskManagerUI)
80
taskManagerUI.
GetOnTaskSelected
().Insert(
SelectTask
);
81
}
82
83
//------------------------------------------------------------------------------------------------
84
void
OnTaskClick
(
SCR_Task
task
)
85
{
86
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
87
if
(!tutorial)
88
return
;
89
90
InputManager
inputMan =
GetGame
().GetInputManager();
91
if
(!inputMan)
92
return
;
93
94
if
(inputMan.IsUsingMouseAndKeyboard())
95
{
96
tutorial.FastTravelToCourse(
task
.GetTaskID().ToInt());
97
98
MenuManager
menuMan =
GetGame
().GetMenuManager();
99
if
(menuMan)
100
menuMan.
FindMenuByPreset
(
ChimeraMenuPreset
.TutorialFastTravel).Close();
101
102
return
;
103
}
104
105
SelectTask
(
task
);
106
}
107
108
//------------------------------------------------------------------------------------------------
109
protected
void
SetupSpinbox
()
110
{
111
Widget
spinBox =
GetRootWidget
().FindAnyWidget(
"FastTravelSpinBox"
);
112
if
(!spinBox)
113
return
;
114
115
m_SpinboxComp
=
SCR_TutorialFastTravelSpinBox
.Cast(spinBox.FindHandler(
SCR_TutorialFastTravelSpinBox
));
116
if
(!
m_SpinboxComp
)
117
return
;
118
119
SCR_TaskSystem
taskSystem =
SCR_TaskSystem
.GetInstance();
120
if
(!taskSystem)
121
return
;
122
123
array<SCR_Task> tasks = {};
124
taskSystem.GetTasks(tasks);
125
126
foreach
(
SCR_Task
task
: tasks)
127
{
128
if
(
task
.GetTaskVisibility() ==
SCR_ETaskVisibility
.NONE)
129
continue
;
130
131
m_SpinboxComp
.AddItem(
task
.GetTaskName(),
false
,
task
);
132
}
133
134
m_SpinboxComp
.m_OnChanged.Insert(
OnSpinboxChanged
);
135
}
136
137
//------------------------------------------------------------------------------------------------
138
void
OnSpinboxChanged
()
139
{
140
SelectTask
(
SCR_Task
.Cast(
m_SpinboxComp
.GetCurrentItemData()));
141
}
142
143
//------------------------------------------------------------------------------------------------
144
void
OnMapOpen
(
MapConfiguration
config)
145
{
146
m_MapEntity
.GetOnMapOpen().Remove(
OnMapOpen
);
147
148
m_MapEntity
.ZoomPanSmooth(0.35,
m_MapEntity
.GetMapSizeX()/ 2,
m_MapEntity
.GetMapSizeY()* 0.5);
149
150
SCR_UISoundEntity
.SoundEvent(
SCR_SoundEvent
.SOUND_HUD_MAP_OPEN);
151
152
InputManager
inputMan =
GetGame
().GetInputManager();
153
if
(inputMan)
154
{
155
inputMan.AddActionListener(
"TutorialFastTravelMapMenuClose"
,
EActionTrigger
.DOWN, Close);
156
inputMan.AddActionListener(
"TutorialFastTravelMapMenuConfirm"
,
EActionTrigger
.DOWN,
ConfirmSelection
);
157
inputMan.AddActionListener(
"TutorialFastTravelMapSpinboxLeaveHorizontal"
,
EActionTrigger
.DOWN,
ResetFocus
);
158
inputMan.AddActionListener(
"TutorialFastTravelMapSpinboxLeaveVertical"
,
EActionTrigger
.DOWN,
ResetFocus
);
159
OnInputDeviceIsGamepad
(!inputMan.IsUsingMouseAndKeyboard());
160
}
161
162
GetGame
().OnInputDeviceIsGamepadInvoker().Insert(
OnInputDeviceIsGamepad
);
163
}
164
165
//------------------------------------------------------------------------------------------------
166
override
void
OnMenuClose
()
167
{
168
SCR_MapEntity
.
GetOnMapOpen
().Remove(
OnMapOpen
);
169
if
(
m_MapEntity
)
170
{
171
m_MapEntity
.CloseMap();
172
173
SCR_UISoundEntity
.SoundEvent(
SCR_SoundEvent
.SOUND_HUD_MAP_CLOSE);
174
}
175
176
InputManager
inputMan =
GetGame
().GetInputManager();
177
if
(!inputMan)
178
return
;
179
180
inputMan.RemoveActionListener(
"TutorialFastTravelMapSpinboxLeaveHorizontal"
,
EActionTrigger
.DOWN,
ResetFocus
);
181
inputMan.RemoveActionListener(
"TutorialFastTravelMapSpinboxLeaveVertical"
,
EActionTrigger
.DOWN,
ResetFocus
);
182
inputMan.RemoveActionListener(
"TutorialFastTravelMapMenuClose"
,
EActionTrigger
.DOWN, Close);
183
inputMan.RemoveActionListener(
"TutorialFastTravelMapMenuConfirm"
,
EActionTrigger
.DOWN,
ConfirmSelection
);
184
185
GetGame
().OnInputDeviceIsGamepadInvoker().Remove(
OnInputDeviceIsGamepad
);
186
}
187
188
//------------------------------------------------------------------------------------------------
189
override
void
OnMenuInit
()
190
{
191
if
(!
m_MapEntity
)
192
m_MapEntity
=
SCR_MapEntity
.
GetMapInstance
();
193
}
194
195
//------------------------------------------------------------------------------------------------
196
protected
void
TasksIgnoreStandardInputs
(
bool
ignore)
197
{
198
SCR_TaskSystem
taskSystem =
SCR_TaskSystem
.GetInstance();
199
if
(!taskSystem)
200
return
;
201
202
array<SCR_Task> tasks = {};
203
taskSystem.GetTasks(tasks);
204
205
SCR_TutorialTaskMapUIComponent
mapUiComp;
206
foreach
(
SCR_Task
task
: tasks)
207
{
208
mapUiComp =
GetTaskMapUIComponent
(
task
);
209
if
(mapUiComp)
210
mapUiComp.
IgnoreStandardInputs
(ignore);
211
}
212
}
213
214
//------------------------------------------------------------------------------------------------
215
protected
void
ResetFocus
()
216
{
217
GetGame
().GetWorkspace().SetFocusedWidget(null);
218
}
219
220
//------------------------------------------------------------------------------------------------
221
protected
void
OnInputDeviceIsGamepad
(
bool
isGamepad)
222
{
223
if
(!
m_SpinboxComp
)
224
return
;
225
226
ScriptInvokerBool
invoker =
m_SpinboxComp
.GetOnFocus();
227
if
(!invoker)
228
return
;
229
230
if
(isGamepad)
231
{
232
TasksIgnoreStandardInputs
(
true
);
233
invoker.Insert(
TasksIgnoreStandardInputs
);
234
}
235
else
236
{
237
TasksIgnoreStandardInputs
(
false
);
238
invoker.Remove(
TasksIgnoreStandardInputs
);
239
}
240
}
241
}
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
EMapEntityMode
EMapEntityMode
Mode of the map.
Definition
SCR_MapConstants.c:29
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
ScriptInvokerBool
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
Definition
SCR_ScriptInvokerHelper.c:41
SCR_ETaskVisibility
SCR_ETaskVisibility
Definition
SCR_Task.c:24
SCR_Task
void SCR_Task(IEntitySource src, IEntity parent)
Definition
SCR_Task.c:1938
task
from task
Definition
SCR_TaskNotificationConfigs.c:12
ChimeraMenuBase
Constant variables used in various menus.
Definition
ChimeraMenuBase.c:72
InputManager
Input management system for user interactions.
Definition
InputManager.c:20
MapConfiguration
Definition
MapConfiguration.c:3
MenuManager
Definition
MenuManager.c:13
MenuManager::FindMenuByPreset
proto external MenuBase FindMenuByPreset(ScriptMenuPresetEnum preset)
Finds first menu/dialog with given preset index, or nullptr when there is no such menu opened.
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::GetOnMapOpen
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapOpen()
Get on map open invoker.
Definition
SCR_MapEntity.c:88
SCR_MapEntity::GetMapInstance
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Definition
SCR_MapEntity.c:112
SCR_MapUIElementContainer
Definition
SCR_MapUIElementContainer.c:2
SCR_MapUIElementContainer::GetTaskFromID
SCR_TaskMapUIComponent GetTaskFromID(string taskID)
Definition
SCR_MapUIElementContainer.c:554
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_TaskManagerUIComponent::GetOnTaskSelected
SCR_TaskSelectedInvoker GetOnTaskSelected()
Definition
SCR_TaskManagerUIComponent.c:648
SCR_TaskSystem
Definition
SCR_TaskSystem.c:6
SCR_TutorialFastTravelMapMenuUI
Tutorial fast travel map menu.
Definition
SCR_TutorialFastTravelMapMenuUI.c:5
SCR_TutorialFastTravelMapMenuUI::ResetFocus
void ResetFocus()
Definition
SCR_TutorialFastTravelMapMenuUI.c:215
SCR_TutorialFastTravelMapMenuUI::OnMenuClose
override void OnMenuClose()
Definition
SCR_TutorialFastTravelMapMenuUI.c:166
SCR_TutorialFastTravelMapMenuUI::OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition
SCR_TutorialFastTravelMapMenuUI.c:144
SCR_TutorialFastTravelMapMenuUI::SetupSpinbox
void SetupSpinbox()
Definition
SCR_TutorialFastTravelMapMenuUI.c:109
SCR_TutorialFastTravelMapMenuUI::m_MapEntity
SCR_MapEntity m_MapEntity
Definition
SCR_TutorialFastTravelMapMenuUI.c:6
SCR_TutorialFastTravelMapMenuUI::OnSpinboxChanged
void OnSpinboxChanged()
Definition
SCR_TutorialFastTravelMapMenuUI.c:138
SCR_TutorialFastTravelMapMenuUI::OnTaskClick
void OnTaskClick(SCR_Task task)
Definition
SCR_TutorialFastTravelMapMenuUI.c:84
SCR_TutorialFastTravelMapMenuUI::OnMenuInit
override void OnMenuInit()
Definition
SCR_TutorialFastTravelMapMenuUI.c:189
SCR_TutorialFastTravelMapMenuUI::SelectTask
void SelectTask(SCR_Task task)
Definition
SCR_TutorialFastTravelMapMenuUI.c:41
SCR_TutorialFastTravelMapMenuUI::ConfirmSelection
void ConfirmSelection()
Definition
SCR_TutorialFastTravelMapMenuUI.c:24
SCR_TutorialFastTravelMapMenuUI::m_SpinboxComp
SCR_TutorialFastTravelSpinBox m_SpinboxComp
Definition
SCR_TutorialFastTravelMapMenuUI.c:7
SCR_TutorialFastTravelMapMenuUI::GetTaskMapUIComponent
SCR_TutorialTaskMapUIComponent GetTaskMapUIComponent(SCR_Task task)
Definition
SCR_TutorialFastTravelMapMenuUI.c:11
SCR_TutorialFastTravelMapMenuUI::OnInputDeviceIsGamepad
void OnInputDeviceIsGamepad(bool isGamepad)
Definition
SCR_TutorialFastTravelMapMenuUI.c:221
SCR_TutorialFastTravelMapMenuUI::m_SelectedTask
SCR_Task m_SelectedTask
Definition
SCR_TutorialFastTravelMapMenuUI.c:8
SCR_TutorialFastTravelMapMenuUI::OnMenuOpen
override void OnMenuOpen()
Definition
SCR_TutorialFastTravelMapMenuUI.c:66
SCR_TutorialFastTravelMapMenuUI::TasksIgnoreStandardInputs
void TasksIgnoreStandardInputs(bool ignore)
Definition
SCR_TutorialFastTravelMapMenuUI.c:196
SCR_TutorialFastTravelSpinBox
Definition
SCR_TutorialFastTravelSpinBox.c:2
SCR_TutorialTaskMapUIComponent
Definition
SCR_TutorialTaskMapUIComponent.c:2
SCR_TutorialTaskMapUIComponent::SetSelected
void SetSelected(bool select)
Definition
SCR_TutorialTaskMapUIComponent.c:55
SCR_TutorialTaskMapUIComponent::IgnoreStandardInputs
void IgnoreStandardInputs(bool ignore)
Definition
SCR_TutorialTaskMapUIComponent.c:65
SCR_UISoundEntity
Definition
SCR_UISoundEntity.c:8
Widget
Definition
Widget.c:13
vector
Definition
vector.c:13
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
scripts
Game
UI
Tutorial
SCR_TutorialFastTravelMapMenuUI.c
Generated by
1.17.0