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_ActionsRadialMenuEditorComponent.c
Go to the documentation of this file.
1
3
4
[
ComponentEditorProps
(
category
:
"GameScripted/Editor"
, description:
"Responsible for controlling radial menus used within GameMaster"
, icon:
"WBData/ComponentEditorProps/componentEditor.png"
)]
5
class
SCR_ActionsRadialMenuEditorComponentClass
:
SCR_BaseEditorComponentClass
6
{
7
}
8
10
class
SCR_ActionsRadialMenuEditorComponent :
SCR_BaseEditorComponent
11
{
12
[
Attribute
()]
13
protected
ref
SCR_RadialMenuController
m_ActionsMenuController;
14
15
[
Attribute
()]
16
protected
ref
SCR_RadialMenuController
m_CommandsMenuController
;
17
18
[
Attribute
()]
19
protected
ref
SCR_RadialMenuController
m_AddCommandsMenuController
;
20
21
// Action names
22
23
[
Attribute
()]
24
protected
string
m_sActionName
;
25
26
[
Attribute
()]
27
protected
string
m_sCommandActionName
;
28
29
[
Attribute
()]
30
protected
string
m_sAddCommandActionName
;
31
32
//---- REFACTOR NOTE START: Implementation of multiple radial menus is not very modular ----
33
34
//------------------------------------------------------------------------------------------------
37
void
OnInputDeviceChanged
(
bool
isGamepad)
38
{
39
// Clearup and close radial menu if not using gamepad
40
if
(!isGamepad)
41
{
42
CleanMenu
();
43
44
if
(m_ActionsMenuController)
45
{
46
m_ActionsMenuController.SetEnableControl(
false
);
47
m_ActionsMenuController.StopControl(
true
);
48
}
49
50
if
(
m_CommandsMenuController
)
51
{
52
m_CommandsMenuController
.SetEnableControl(
false
);
53
m_CommandsMenuController
.StopControl(
true
);
54
}
55
56
if
(
m_AddCommandsMenuController
)
57
{
58
m_AddCommandsMenuController
.SetEnableControl(
false
);
59
m_AddCommandsMenuController
.StopControl(
true
);
60
}
61
62
return
;
63
}
64
65
// Gamepad
66
if
(m_ActionsMenuController)
67
m_ActionsMenuController.SetEnableControl(
true
);
68
69
if
(
m_CommandsMenuController
)
70
m_CommandsMenuController
.SetEnableControl(
true
);
71
72
if
(
m_AddCommandsMenuController
)
73
m_AddCommandsMenuController
.SetEnableControl(
true
);
74
}
75
76
//------------------------------------------------------------------------------------------------
77
protected
void
OnBeforeMenuOpen
(notnull
SCR_RadialMenuController
menuController, notnull SCR_BaseActionsEditorComponent actionsComponent,
int
flags
= 0)
78
{
79
CleanMenu
();
80
81
if
(
GetGame
().
GetInputManager
().GetLastUsedInputDevice() != EInputDeviceType.GAMEPAD)
82
return
;
83
84
SCR_MenuLayoutEditorComponent
editorMenuLayout =
SCR_MenuLayoutEditorComponent
.Cast(
SCR_MenuLayoutEditorComponent
.GetInstance(
SCR_MenuLayoutEditorComponent
,
true
));
85
if
(!editorMenuLayout)
86
return
;
87
88
SCR_RadialMenu
radialMenu = menuController.GetRadialMenu();
89
if
(!radialMenu)
90
return
;
91
92
vector
cursorWorldPosition;
93
if
(!editorMenuLayout.
GetCursorWorldPos
(cursorWorldPosition))
94
return
;
95
96
array<ref SCR_EditorActionData> filteredActions = {};
97
actionsComponent.GetAndEvaluateActions(cursorWorldPosition, filteredActions,
flags
);
98
99
// Close menu if there is nothing to display.
100
if
(filteredActions.IsEmpty())
101
{
102
CleanMenu
();
103
return
;
104
}
105
106
array<ref SCR_SelectionMenuEntry> radialMenuEntries = {};
107
foreach
(
SCR_EditorActionData
actionData : filteredActions)
108
{
109
SCR_BaseEditorAction
action = actionData.GetAction();
110
if
(!action)
111
continue
;
112
113
SCR_UIInfo
info = action.
GetInfo
();
114
if
(!info)
115
continue
;
116
117
SCR_EditorActionSelectionMenuEntry
menuEntry =
new
SCR_EditorActionSelectionMenuEntry
(action, actionsComponent, cursorWorldPosition,
flags
);
118
119
menuEntry.Enable(
true
);
120
menuEntry.SetName(info.GetName());
121
menuEntry.SetIcon(info.
GetIconPath
());
122
menuEntry.SetDescription(info.GetDescription());
123
menuEntry.SetInputAction(action.
GetShortcut
());
124
125
radialMenuEntries.Insert(menuEntry);
126
}
127
128
radialMenu.GetOnClose().Insert(
CleanMenu
);
129
radialMenu.AddEntries(radialMenuEntries,
true
);
130
131
menuController.OnInputOpen();
132
}
133
134
//------------------------------------------------------------------------------------------------
135
protected
void
CleanMenu
()
136
{
137
SCR_RadialMenu
radialMenu = null;
138
139
if
(m_ActionsMenuController)
140
radialMenu = m_ActionsMenuController.GetRadialMenu();
141
142
if
(radialMenu)
143
{
144
radialMenu.ClearEntries();
145
radialMenu = null;
146
}
147
148
if
(
m_CommandsMenuController
)
149
radialMenu =
m_CommandsMenuController
.GetRadialMenu();
150
151
if
(radialMenu)
152
{
153
radialMenu.ClearEntries();
154
radialMenu = null;
155
}
156
157
if
(
m_AddCommandsMenuController
)
158
radialMenu =
m_AddCommandsMenuController
.GetRadialMenu();
159
160
if
(radialMenu)
161
{
162
radialMenu.ClearEntries();
163
radialMenu = null;
164
}
165
}
166
167
//------------------------------------------------------------------------------------------------
168
protected
void
OnActionRadialMenuOpen
()
169
{
170
if
(!m_ActionsMenuController)
171
return
;
172
173
m_ActionsMenuController.Control(
GetOwner
());
174
175
SCR_ContextActionsEditorComponent
editorActionsComponent =
SCR_ContextActionsEditorComponent
.Cast(
SCR_ContextActionsEditorComponent
.GetInstance(
SCR_ContextActionsEditorComponent
,
true
));
176
if
(!editorActionsComponent)
177
return
;
178
179
OnBeforeMenuOpen
(m_ActionsMenuController, editorActionsComponent);
180
}
181
182
//------------------------------------------------------------------------------------------------
183
protected
void
OnCommandsRadialMenu
()
184
{
185
if
(!
m_CommandsMenuController
)
186
return
;
187
188
m_CommandsMenuController
.Control(
GetOwner
());
189
190
SCR_CommandActionsEditorComponent
editorCommandsComponent =
SCR_CommandActionsEditorComponent
.Cast(
SCR_CommandActionsEditorComponent
.GetInstance(
SCR_CommandActionsEditorComponent
,
true
));
191
if
(!editorCommandsComponent)
192
return
;
193
194
if
(
m_CommandsMenuController
)
195
{
196
SCR_RadialMenu
radialMenu =
m_CommandsMenuController
.GetRadialMenu();
197
if
(radialMenu)
198
radialMenu.
m_eRadialType
=
SCR_ERadialMenuType
.ADD_COMMANDS_MENU;
199
}
200
201
OnBeforeMenuOpen
(
m_CommandsMenuController
, editorCommandsComponent, 0);
202
}
203
204
//------------------------------------------------------------------------------------------------
205
protected
void
OnAddCommandsRadialMenu
()
206
{
207
if
(!
m_AddCommandsMenuController
)
208
return
;
209
210
m_AddCommandsMenuController
.Control(
GetOwner
());
211
212
SCR_CommandActionsEditorComponent
editorCommandsComponent =
SCR_CommandActionsEditorComponent
.Cast(
SCR_CommandActionsEditorComponent
.GetInstance(
SCR_CommandActionsEditorComponent
,
true
));
213
if
(!editorCommandsComponent)
214
return
;
215
216
OnBeforeMenuOpen
(
m_AddCommandsMenuController
, editorCommandsComponent,
EEditorCommandActionFlags
.IS_QUEUE);
217
}
218
219
//------------------------------------------------------------------------------------------------
220
protected
override
void
EOnEditorActivate
()
221
{
222
#ifdef WORKBENCH
223
if
(
SCR_Global
.
IsEditMode
())
224
return
;
225
#endif
226
227
GetGame
().OnInputDeviceIsGamepadInvoker().Insert(
OnInputDeviceChanged
);
228
229
InputManager
inputManager =
GetGame
().GetInputManager();
230
231
// Clearup
232
inputManager.RemoveActionListener(
m_sActionName
,
EActionTrigger
.DOWN,
OnActionRadialMenuOpen
);
233
inputManager.RemoveActionListener(
m_sCommandActionName
,
EActionTrigger
.DOWN,
OnCommandsRadialMenu
);
234
inputManager.RemoveActionListener(
m_sAddCommandActionName
,
EActionTrigger
.DOWN,
OnAddCommandsRadialMenu
);
235
236
// Setup
237
inputManager.AddActionListener(
m_sActionName
,
EActionTrigger
.DOWN,
OnActionRadialMenuOpen
);
238
inputManager.AddActionListener(
m_sCommandActionName
,
EActionTrigger
.DOWN,
OnCommandsRadialMenu
);
239
inputManager.AddActionListener(
m_sAddCommandActionName
,
EActionTrigger
.DOWN,
OnAddCommandsRadialMenu
);
240
}
241
242
//------------------------------------------------------------------------------------------------
243
protected
override
void
EOnEditorDelete
()
244
{
245
#ifdef WORKBENCH
246
if
(
SCR_Global
.
IsEditMode
())
247
return
;
248
#endif
249
}
250
//---- REFACTOR NOTE END ----
251
}
flags
SCR_EAIThreatSectorFlags flags
Definition
AIControlComponentSerializer.c:16
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
GetInputManager
InputManager GetInputManager()
Definition
SCR_BaseManualCameraComponent.c:205
m_sActionName
string m_sActionName
Definition
SCR_PlayerCommandsConfig.c:1
SCR_ERadialMenuType
SCR_ERadialMenuType
Definition
SCR_RadialMenu.c:2
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
InputManager
Input management system for user interactions.
Definition
InputManager.c:20
SCR_ActionsRadialMenuEditorComponentClass
Definition
SCR_ActionsRadialMenuEditorComponent.c:6
SCR_BaseEditorAction
Definition
SCR_BaseEditorAction.c:25
SCR_BaseEditorAction::GetInfo
SCR_UIInfo GetInfo()
Definition
SCR_BaseEditorAction.c:111
SCR_BaseEditorAction::GetShortcut
string GetShortcut()
Definition
SCR_BaseEditorAction.c:132
SCR_BaseEditorComponentClass
Definition
SCR_BaseEditorComponent.c:3
SCR_BaseEditorComponent
Definition
SCR_BaseEditorComponent.c:120
SCR_BaseEditorComponent::EOnEditorDelete
void EOnEditorDelete()
When the entity is destroyed.
SCR_BaseEditorComponent::EOnEditorActivate
void EOnEditorActivate()
SCR_CommandActionsEditorComponent
Definition
SCR_CommandActionsEditorComponent.c:11
SCR_ContextActionsEditorComponent
Definition
SCR_ContextActionsEditorComponent.c:16
SCR_EditorActionData
Definition
SCR_BaseEditorAction.c:281
SCR_EditorActionSelectionMenuEntry
Definition
SCR_EditorActionSelectionMenuEntry.c:10
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_MenuLayoutEditorComponent
Definition
SCR_MenuLayoutEditorComponent.c:16
SCR_MenuLayoutEditorComponent::GetCursorWorldPos
bool GetCursorWorldPos(out vector worldPos, TraceFlags flags=-1)
Definition
SCR_MenuLayoutEditorComponent.c:46
SCR_RadialMenuController
Definition
SCR_RadialMenuController.c:16
SCR_RadialMenu
Definition
SCR_RadialMenu.c:19
SCR_RadialMenu::m_eRadialType
SCR_ERadialMenuType m_eRadialType
Definition
SCR_RadialMenu.c:47
SCR_UIInfo
Definition
SCR_UIInfo.c:8
SCR_UIInfo::GetIconPath
ResourceName GetIconPath()
Definition
SCR_UIInfo.c:20
ScriptComponent::GetOwner
proto external GenericEntity GetOwner()
Get owner entity.
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EEditorCommandActionFlags
EEditorCommandActionFlags
Simplified action conditions.
Definition
EEditorCommandActionFlags.c:6
OnAddCommandsRadialMenu
void OnAddCommandsRadialMenu()
Definition
SCR_ActionsRadialMenuEditorComponent.c:205
OnCommandsRadialMenu
void OnCommandsRadialMenu()
Definition
SCR_ActionsRadialMenuEditorComponent.c:183
m_sCommandActionName
string m_sCommandActionName
Definition
SCR_ActionsRadialMenuEditorComponent.c:27
m_CommandsMenuController
ref SCR_RadialMenuController m_CommandsMenuController
Definition
SCR_ActionsRadialMenuEditorComponent.c:16
CleanMenu
void CleanMenu()
Definition
SCR_ActionsRadialMenuEditorComponent.c:135
OnActionRadialMenuOpen
void OnActionRadialMenuOpen()
Definition
SCR_ActionsRadialMenuEditorComponent.c:168
m_sAddCommandActionName
string m_sAddCommandActionName
Definition
SCR_ActionsRadialMenuEditorComponent.c:30
OnInputDeviceChanged
void OnInputDeviceChanged(bool isGamepad)
Definition
SCR_ActionsRadialMenuEditorComponent.c:37
OnBeforeMenuOpen
void OnBeforeMenuOpen(notnull SCR_RadialMenuController menuController, notnull SCR_BaseActionsEditorComponent actionsComponent, int flags=0)
Definition
SCR_ActionsRadialMenuEditorComponent.c:77
m_AddCommandsMenuController
ref SCR_RadialMenuController m_AddCommandsMenuController
Definition
SCR_ActionsRadialMenuEditorComponent.c:19
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
scripts
Game
Editor
Components
Editor
SCR_ActionsRadialMenuEditorComponent.c
Generated by
1.17.0