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_CycleWaypointEditorUIComponent.c
Go to the documentation of this file.
1
class
SCR_CycleWaypointEditorUIComponent
: SCR_ModularButtonComponent
2
{
3
protected
SCR_BaseEditableEntityFilter
m_SelectedEntitiesManager
;
4
5
[
Attribute
()]
6
protected
string
m_sCycleWaypointsToggleWidgetName
;
7
8
[
Attribute
()]
9
protected
string
m_sSeparatorWidgetName
;
10
11
[
Attribute
()]
12
protected
string
m_sRadialActionName
;
13
14
[
Attribute
(
"0.8"
)]
15
protected
float
m_fGamepadScale
;
16
17
[
Attribute
(
"8.0"
)]
18
protected
float
m_fMKBottomPadding
;
19
20
protected
ButtonWidget
m_wCycleWaypointsToggle
;
21
protected
SCR_ModularButtonComponent
m_ModularButtonToggleComponent
;
22
protected
Widget
m_wSeparator
;
23
protected
SCR_PlacingEditorComponent
m_PlacingEditor
;
24
25
protected
bool
m_bIsGamepad
;
26
27
//------------------------------------------------------------------------------------------------
28
protected
void
OnInputDeviceIsGamepad
(
bool
isGamepad)
29
{
30
m_bIsGamepad
= isGamepad;
31
UpdateInputVisuals
();
32
}
33
34
35
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
36
//------------------------------------------------------------------------------------------------
38
protected
void
UpdateInputVisuals
()
39
{
40
if
(
m_wSeparator
)
41
m_wSeparator
.SetVisible(!
m_bIsGamepad
);
42
43
float
scale
= 1.0;
44
float
bottomPadding =
m_fMKBottomPadding
;
45
if
(
m_bIsGamepad
)
46
{
47
scale
=
m_fGamepadScale
;
48
bottomPadding = 0;
49
}
50
51
ScaleWidget
scaleWidget =
ScaleWidget
.Cast(
m_wCycleWaypointsToggle
.GetParent());
52
if
(scaleWidget)
53
scaleWidget.SetScale(
scale
);
54
55
}
56
//---- REFACTOR NOTE END ----
57
58
//------------------------------------------------------------------------------------------------
60
protected
void
OnSelectedEntitiesChange
(
EEditableEntityState
state, set<SCR_EditableEntityComponent> entitiesInsert, set<SCR_EditableEntityComponent> entitiesRemove)
61
{
62
Widget
container =
GetRootWidget
();
63
bool
isVisible =
CanShowToggleCycleWaypoint
();
64
if
(container)
65
container.SetVisible(isVisible);
66
67
if
(
m_ModularButtonToggleComponent
)
68
m_ModularButtonToggleComponent
.SetToggled(
GetHasCycleWaypointsActivated
());
69
}
70
71
//------------------------------------------------------------------------------------------------
72
override
void
HandlerAttached
(
Widget
w)
73
{
74
super.HandlerAttached(w);
75
76
SCR_EntitiesManagerEditorComponent
entitiesManager =
SCR_EntitiesManagerEditorComponent
.Cast(
SCR_EntitiesManagerEditorComponent
.GetInstance(
SCR_EntitiesManagerEditorComponent
));
77
if
(entitiesManager)
78
m_SelectedEntitiesManager
= entitiesManager.
GetFilter
(
EEditableEntityState
.SELECTED);
79
80
if
(
m_SelectedEntitiesManager
)
81
m_SelectedEntitiesManager
.GetOnChanged().Insert(
OnSelectedEntitiesChange
);
82
83
//++ Initializes toggle on
84
m_wCycleWaypointsToggle
=
ButtonWidget
.Cast(
GetRootWidget
().FindAnyWidget(
m_sCycleWaypointsToggleWidgetName
));
85
if
(!
m_wCycleWaypointsToggle
)
86
return
;
87
88
m_ModularButtonToggleComponent
= SCR_ModularButtonComponent.FindComponent(
m_wCycleWaypointsToggle
);
89
if
(
m_ModularButtonToggleComponent
)
90
{
91
m_ModularButtonToggleComponent
.m_OnClicked.Insert(
ToggleCycleWaypoints
);
92
93
//++ Style toggle
94
m_ModularButtonToggleComponent
.SetToggled(
GetHasCycleWaypointsActivated
());
95
}
96
97
m_PlacingEditor
=
SCR_PlacingEditorComponent
.Cast(
SCR_PlacingEditorComponent
.GetInstance(
SCR_PlacingEditorComponent
,
true
,
true
));
98
99
//++ Initializes the separator
100
m_wSeparator
=
GetRootWidget
().FindAnyWidget(
m_sSeparatorWidgetName
);
101
102
GetGame
().GetInputManager().AddActionListener(
m_sRadialActionName
,
EActionTrigger
.PRESSED,
ToggleCycleWaypoints
);
103
104
GetGame
().OnInputDeviceIsGamepadInvoker().Insert(
OnInputDeviceIsGamepad
);
105
UpdateInputVisuals
();
106
}
107
108
//------------------------------------------------------------------------------------------------
109
override
void
HandlerDeattached
(
Widget
w)
110
{
111
super.HandlerDeattached(w);
112
113
if
(
m_ModularButtonToggleComponent
)
114
m_ModularButtonToggleComponent
.m_OnClicked.Remove(
ToggleCycleWaypoints
);
115
116
GetGame
().GetInputManager().RemoveActionListener(
m_sRadialActionName
,
EActionTrigger
.PRESSED,
ToggleCycleWaypoints
);
117
}
118
119
120
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
121
//------------------------------------------------------------------------------------------------
123
protected
void
ToggleCycleWaypoints
()
124
{
125
set<SCR_EditableGroupComponent> selectedGroups =
new
set<SCR_EditableGroupComponent>();
126
if
(!
GetSelectedGroups
(selectedGroups))
127
return
;
128
129
bool
isEnabled = !selectedGroups.Get(0).AreCycledWaypointsEnabled();
130
if
(isEnabled)
131
EnableCycleWaypoints
();
132
else
133
DisableCycleWaypoints
();
134
}
135
//---- REFACTOR NOTE END ----
136
137
//------------------------------------------------------------------------------------------------
139
protected
void
EnableCycleWaypoints
()
140
{
141
set<SCR_EditableGroupComponent> selectedGroups =
new
set<SCR_EditableGroupComponent>();
142
if
(!
GetSelectedGroups
(selectedGroups))
143
return
;
144
145
if
(!
m_PlacingEditor
)
146
return
;
147
148
m_PlacingEditor
.SetCycleWaypoints(selectedGroups,
true
);
149
150
if
(
m_ModularButtonToggleComponent
)
151
m_ModularButtonToggleComponent
.SetToggled(
true
);
152
}
153
154
//------------------------------------------------------------------------------------------------
156
protected
void
DisableCycleWaypoints
()
157
{
158
set<SCR_EditableGroupComponent> selectedGroups =
new
set<SCR_EditableGroupComponent>();
159
if
(!
GetSelectedGroups
(selectedGroups))
160
return
;
161
162
if
(!
m_PlacingEditor
)
163
return
;
164
165
m_PlacingEditor
.SetCycleWaypoints(selectedGroups,
false
);
166
167
if
(
m_ModularButtonToggleComponent
)
168
m_ModularButtonToggleComponent
.SetToggled(
false
);
169
}
170
171
//------------------------------------------------------------------------------------------------
175
protected
bool
GetSelectedGroups
(notnull out set<SCR_EditableGroupComponent> selectedGroups)
176
{
177
set<SCR_EditableEntityComponent> selectedEntities =
new
set<SCR_EditableEntityComponent>();
178
m_SelectedEntitiesManager
.GetEntities(selectedEntities);
179
180
SCR_EditableGroupComponent
group;
181
foreach
(
SCR_EditableEntityComponent
entity : selectedEntities)
182
{
183
group =
SCR_EditableGroupComponent
.Cast(entity.GetAIGroup());
184
if
(group)
185
selectedGroups.Insert(group);
186
}
187
188
return
!selectedGroups.IsEmpty();
189
}
190
191
//------------------------------------------------------------------------------------------------
194
protected
bool
GetHasCycleWaypointsActivated
()
195
{
196
set<SCR_EditableEntityComponent> selectedEntities =
new
set<SCR_EditableEntityComponent>();
197
if
(
m_SelectedEntitiesManager
)
198
m_SelectedEntitiesManager
.GetEntities(selectedEntities);
199
200
SCR_EditableGroupComponent
group;
201
foreach
(
SCR_EditableEntityComponent
entity : selectedEntities)
202
{
203
group =
SCR_EditableGroupComponent
.Cast(entity.GetAIGroup());
204
if
(group && group.AreCycledWaypointsEnabled())
205
return
true
;
206
}
207
208
return
false
;
209
}
210
211
//------------------------------------------------------------------------------------------------
213
protected
bool
CanShowToggleCycleWaypoint
()
214
{
215
set<SCR_EditableEntityComponent> selectedEntities =
new
set<SCR_EditableEntityComponent>();
216
m_SelectedEntitiesManager
.GetEntities(selectedEntities);
217
218
foreach
(
SCR_EditableEntityComponent
entity : selectedEntities)
219
{
220
if
(
SCR_EditableGroupComponent
.Cast(entity.GetAIGroup()))
221
return
true
;
222
}
223
224
return
false
;
225
}
226
}
scale
vector scale
Definition
BlenderEndpoints.c:50
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_EditableGroupComponent
void SCR_EditableGroupComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_EditableGroupComponent.c:881
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
ButtonWidget
Definition
ButtonWidget.c:16
SCR_BaseEditableEntityFilter
Definition
SCR_BaseEditableEntityFilter.c:14
SCR_CycleWaypointEditorUIComponent
Definition
SCR_CycleWaypointEditorUIComponent.c:2
SCR_CycleWaypointEditorUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_CycleWaypointEditorUIComponent.c:72
SCR_CycleWaypointEditorUIComponent::GetSelectedGroups
bool GetSelectedGroups(notnull out set< SCR_EditableGroupComponent > selectedGroups)
Definition
SCR_CycleWaypointEditorUIComponent.c:175
SCR_CycleWaypointEditorUIComponent::m_sRadialActionName
string m_sRadialActionName
Definition
SCR_CycleWaypointEditorUIComponent.c:12
SCR_CycleWaypointEditorUIComponent::GetHasCycleWaypointsActivated
bool GetHasCycleWaypointsActivated()
Definition
SCR_CycleWaypointEditorUIComponent.c:194
SCR_CycleWaypointEditorUIComponent::m_fMKBottomPadding
float m_fMKBottomPadding
Definition
SCR_CycleWaypointEditorUIComponent.c:18
SCR_CycleWaypointEditorUIComponent::ToggleCycleWaypoints
void ToggleCycleWaypoints()
Toggle cycle waypoints for selected groups, based on the status of the first group.
Definition
SCR_CycleWaypointEditorUIComponent.c:123
SCR_CycleWaypointEditorUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_CycleWaypointEditorUIComponent.c:109
SCR_CycleWaypointEditorUIComponent::m_SelectedEntitiesManager
SCR_BaseEditableEntityFilter m_SelectedEntitiesManager
Definition
SCR_CycleWaypointEditorUIComponent.c:3
SCR_CycleWaypointEditorUIComponent::EnableCycleWaypoints
void EnableCycleWaypoints()
Enable cycle waypoints for selected groups.
Definition
SCR_CycleWaypointEditorUIComponent.c:139
SCR_CycleWaypointEditorUIComponent::DisableCycleWaypoints
void DisableCycleWaypoints()
Disable cycle waypoints for selected groups.
Definition
SCR_CycleWaypointEditorUIComponent.c:156
SCR_CycleWaypointEditorUIComponent::m_wSeparator
Widget m_wSeparator
Definition
SCR_CycleWaypointEditorUIComponent.c:22
SCR_CycleWaypointEditorUIComponent::m_sSeparatorWidgetName
string m_sSeparatorWidgetName
Definition
SCR_CycleWaypointEditorUIComponent.c:9
SCR_CycleWaypointEditorUIComponent::OnInputDeviceIsGamepad
void OnInputDeviceIsGamepad(bool isGamepad)
Definition
SCR_CycleWaypointEditorUIComponent.c:28
SCR_CycleWaypointEditorUIComponent::CanShowToggleCycleWaypoint
bool CanShowToggleCycleWaypoint()
Returns if toggle cycle waypoint button can be shown.
Definition
SCR_CycleWaypointEditorUIComponent.c:213
SCR_CycleWaypointEditorUIComponent::m_wCycleWaypointsToggle
ButtonWidget m_wCycleWaypointsToggle
Definition
SCR_CycleWaypointEditorUIComponent.c:20
SCR_CycleWaypointEditorUIComponent::UpdateInputVisuals
void UpdateInputVisuals()
Styles the widget according to the current input device.
Definition
SCR_CycleWaypointEditorUIComponent.c:38
SCR_CycleWaypointEditorUIComponent::m_ModularButtonToggleComponent
SCR_ModularButtonComponent m_ModularButtonToggleComponent
Definition
SCR_CycleWaypointEditorUIComponent.c:21
SCR_CycleWaypointEditorUIComponent::m_PlacingEditor
SCR_PlacingEditorComponent m_PlacingEditor
Definition
SCR_CycleWaypointEditorUIComponent.c:23
SCR_CycleWaypointEditorUIComponent::m_bIsGamepad
bool m_bIsGamepad
Definition
SCR_CycleWaypointEditorUIComponent.c:25
SCR_CycleWaypointEditorUIComponent::m_fGamepadScale
float m_fGamepadScale
Definition
SCR_CycleWaypointEditorUIComponent.c:15
SCR_CycleWaypointEditorUIComponent::OnSelectedEntitiesChange
void OnSelectedEntitiesChange(EEditableEntityState state, set< SCR_EditableEntityComponent > entitiesInsert, set< SCR_EditableEntityComponent > entitiesRemove)
Runs when selected entities from entities manager change. Used to update visibility of toggle.
Definition
SCR_CycleWaypointEditorUIComponent.c:60
SCR_CycleWaypointEditorUIComponent::m_sCycleWaypointsToggleWidgetName
string m_sCycleWaypointsToggleWidgetName
Definition
SCR_CycleWaypointEditorUIComponent.c:6
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_EntitiesManagerEditorComponent
Definition
SCR_EntitiesManagerEditorComponent.c:14
SCR_EntitiesManagerEditorComponent::GetFilter
SCR_BaseEditableEntityFilter GetFilter(EEditableEntityState state, bool showError=false)
Definition
SCR_EntitiesManagerEditorComponent.c:34
SCR_PlacingEditorComponent
Definition
SCR_PlacingEditorComponent.c:119
ScaleWidget
Definition
ScaleWidget.c:13
Widget
Definition
Widget.c:13
EEditableEntityState
EEditableEntityState
Definition
EEditableEntityState.c:38
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EActionTrigger
EActionTrigger
Definition
EActionTrigger.c:13
scripts
Game
Editor
UI
Components
Toolbar
SCR_CycleWaypointEditorUIComponent.c
Generated by
1.17.0