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_MapUISpawnPoint.c
Go to the documentation of this file.
1
class
SCR_MapUISpawnPoint
:
SCR_MapUIElement
2
{
3
[
Attribute
(
"Select"
)]
4
protected
string
m_sSelection
;
5
[
Attribute
(
"Base_Main"
)]
6
protected
string
m_sSpawnPoint
;
7
8
protected
SCR_SpawnPoint
m_SpawnPoint
;
9
protected
RplId
m_SpawnPointId
;
10
protected
string
m_sFactionKey
;
11
protected
TextWidget
m_wSpawnPointName
;
12
protected
Widget
m_wImageOverlay
;
13
protected
OverlayWidget
m_wSymbolOverlay
;
14
protected
SCR_MilitarySymbolUIComponent
m_MilitarySymbolComponent
;
15
protected
ButtonWidget
m_wButton
;
16
protected
SizeLayoutWidget
m_wSizeLayout
;
17
protected
Widget
m_wSupplies
;
18
protected
RichTextWidget
m_wSuppliesText
19
20
protected
SCR_ResourceComponent
m_ResourceComponent
;
21
protected
SCR_ResourceConsumer
m_ResourceConsumer
;
22
protected
ref
SCR_ResourceSystemSubscriptionHandleBase
m_ResourceSubscriptionHandleConsumer
;
23
protected
RplId
m_ResourceInventoryPlayerComponentRplId
;
24
25
//------------------------------------------------------------------------------
26
void
Init
(notnull
SCR_SpawnPoint
spawnPoint)
27
{
28
m_SpawnPoint
= spawnPoint;
29
m_SpawnPointId
= spawnPoint.GetRplId();
30
m_sFactionKey
= spawnPoint.GetFactionKey();
31
// TODO@AS: Api?
32
m_wSpawnPointName
.SetText(spawnPoint.GetSpawnPointName());
33
UpdateIcon
();
34
35
if
(!m_wSuppliesText)
36
return
;
37
38
m_ResourceComponent
= SCR_ResourceComponent.FindResourceComponent(spawnPoint);
39
40
if
(!
m_ResourceComponent
)
41
return
;
42
43
m_ResourceConsumer
=
m_ResourceComponent
.GetConsumer(
EResourceGeneratorID
.DEFAULT,
EResourceType
.SUPPLIES);
44
45
if
(!
m_ResourceConsumer
)
46
return
;
47
48
m_ResourceInventoryPlayerComponentRplId
=
Replication
.FindItemId(
SCR_ResourcePlayerControllerInventoryComponent
.Cast(
GetGame
().
GetPlayerController
().FindComponent(
SCR_ResourcePlayerControllerInventoryComponent
)));
49
m_ResourceSubscriptionHandleConsumer
=
GetGame
().GetResourceSystemSubscriptionManager().RequestSubscriptionListenerHandle(
m_ResourceConsumer
,
m_ResourceInventoryPlayerComponentRplId
);
50
51
m_ResourceComponent
.TEMP_GetOnInteractorReplicated().Insert(
UpdateResources
);
52
UpdateResources
();
53
}
54
55
//------------------------------------------------------------------------------------------------
56
override
void
SetName
(
string
name)
57
{
58
if
(
m_wSpawnPointName
)
59
m_wSpawnPointName
.SetText(name);
60
}
61
62
//------------------------------------------------------------------------------------------------
63
override
vector
GetPos
()
64
{
65
return
m_SpawnPoint
.GetOrigin();
66
}
67
68
//------------------------------------------------------------------------------------------------
69
protected
void
UpdateResources
()
70
{
71
if
(!
m_ResourceComponent
|| !
m_ResourceComponent
.GetConsumer(
EResourceGeneratorID
.DEFAULT,
EResourceType
.SUPPLIES,
m_ResourceConsumer
))
72
return
;
73
74
m_wSuppliesText.SetText(
string
.
ToString
(
m_ResourceConsumer
.GetAggregatedResourceValue()));
75
}
76
77
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
78
//------------------------------------------------------------------------------
79
void
UpdateIcon
()
80
{
81
SCR_MilitarySymbol
symbol =
new
SCR_MilitarySymbol
();
82
83
SCR_GroupIdentityCore
core =
SCR_GroupIdentityCore
.Cast(
SCR_GroupIdentityCore
.GetInstance(
SCR_GroupIdentityCore
));
84
if
(!core)
85
return
;
86
87
SCR_Faction
faction =
SCR_Faction
.Cast(
GetGame
().GetFactionManager().
GetFactionByKey
(
m_sFactionKey
));
88
if
(faction)
89
{
90
SCR_MilitarySymbolRuleSet
ruleSet = core.
GetSymbolRuleSet
();
91
ruleSet.
UpdateSymbol
(symbol, faction);
92
}
93
else
94
{
95
symbol.
SetIdentity
(
EMilitarySymbolIdentity
.UNKNOWN);
96
}
97
98
//Selection visuals
99
string
selection;
100
string
highlight;
101
switch
(symbol.
GetIdentity
())
102
{
103
case
EMilitarySymbolIdentity
.INDFOR:
104
{
105
selection =
"Neutral_Select"
;
106
highlight =
"Neutral_Focus"
;
107
break
;
108
}
109
case
EMilitarySymbolIdentity
.OPFOR:
110
{
111
selection =
"Hostile_Select"
;
112
highlight =
"Hostile_Focus"
;
113
break
;
114
}
115
case
EMilitarySymbolIdentity
.BLUFOR:
116
{
117
selection =
"Friend_Select"
;
118
highlight =
"Friend_Focus"
;
119
break
;
120
}
121
case
EMilitarySymbolIdentity
.UNKNOWN:
122
{
123
selection =
"Unknown_Select"
;
124
highlight =
"Unknown_Focus"
;
125
break
;
126
}
127
}
128
m_bVisible
=
true
;
129
130
m_wHighlightImg
.LoadImageFromSet(0,
m_sImageSetARO
, highlight);
131
m_wSelectImg
.LoadImageFromSet(0,
m_sImageSetARO
, selection);
132
133
if
(SCR_PlayerSpawnPoint.Cast(
m_SpawnPoint
))
134
symbol.
SetIcons
(
EMilitarySymbolIcon
.RELAY);
135
else
136
symbol.
SetIcons
(
EMilitarySymbolIcon
.RESPAWN);
137
138
m_wSymbolOverlay
.SetColor(
GetColorForFaction
(
m_sFactionKey
));
139
if
(
m_wGradient
)
140
m_wGradient
.SetColor(
GetColorForFaction
(
m_sFactionKey
));
141
142
if
(faction)
143
m_MilitarySymbolComponent
.Update(symbol);
144
}
145
//---- REFACTOR NOTE END ----
146
147
//------------------------------------------------------------------------------
148
override
void
HandlerAttached
(
Widget
w)
149
{
150
super.HandlerAttached(w);
151
152
m_wImageOverlay
= w.FindAnyWidget(
"IconOverlay"
);
153
m_wSizeLayout
=
SizeLayoutWidget
.Cast(w.FindAnyWidget(
"SizeLayout"
));
154
m_wSpawnPointName
=
TextWidget
.Cast(w.FindAnyWidget(
"Name"
));
155
m_wSymbolOverlay
=
OverlayWidget
.Cast(
m_wImageOverlay
.FindWidget(
"Symbol"
));
156
157
if
(!
m_wSymbolOverlay
)
158
return
;
159
160
m_MilitarySymbolComponent
=
SCR_MilitarySymbolUIComponent
.Cast(
m_wSymbolOverlay
.FindHandler(
SCR_MilitarySymbolUIComponent
));
161
162
m_wButton
=
ButtonWidget
.Cast(w.FindAnyWidget(
"Button"
));
163
164
if
(
m_wButton
)
165
m_wButton
.SetEnabled(
false
);
166
167
m_wSupplies
= w.FindAnyWidget(
"w_Supplies"
);
168
169
if
(
m_wSupplies
)
170
m_wSuppliesText =
RichTextWidget
.Cast(
m_wSupplies
.FindAnyWidget(
"SuppliesText"
));
171
}
172
173
//------------------------------------------------------------------------------------------------
174
override
void
HandlerDeattached
(
Widget
w)
175
{
176
super.HandlerDeattached(w);
177
178
if
(
m_ResourceComponent
)
179
m_ResourceComponent
.TEMP_GetOnInteractorReplicated().Remove(
UpdateResources
);
180
181
m_ResourceSubscriptionHandleConsumer
= null;
182
}
183
184
//------------------------------------------------------------------------------
185
override
void
SelectIcon
(
bool
invoke =
true
)
186
{
187
if
(!
m_wSelectImg
)
188
return
;
189
190
if
(
s_SelectedElement
&&
s_SelectedElement
!=
this
)
191
s_SelectedElement
.Select(
false
);
192
193
Select
();
194
195
m_wSelectImg
.SetVisible(
true
);
196
if
(
m_wGradient
)
197
m_wGradient
.SetVisible(
true
);
198
199
if
(
m_bIsSelected
&& invoke)
200
m_Parent
.OnSpawnPointSelected(
m_SpawnPointId
);
201
}
202
203
// todo@lk: plug this somewhere later
204
// protected void OnSelected(SCR_SpawnPoint sp)
205
// {
206
// if (!sp)
207
// return;
208
// if (sp == m_SpawnPoint)
209
// {
210
// AnimExpand();
211
// m_wRoot.SetZOrder(1);
212
// m_wSelectImg.SetVisible(true);
213
// if (m_wGradient)
214
// m_wGradient.SetVisible(true);
215
// }
216
// else
217
// {
218
// AnimCollapse();
219
// m_wRoot.SetZOrder(0);
220
// m_wSelectImg.SetVisible(false);
221
// if (m_wGradient)
222
// m_wGradient.SetVisible(false);
223
// }
224
// }
225
226
//------------------------------------------------------------------------------
227
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
228
{
229
if
(
m_wSizeLayout
&& w ==
m_wSizeLayout
&&
m_wButton
)
230
m_wButton
.SetEnabled(
true
);
231
232
GetGame
().GetWorkspace().SetFocusedWidget(w);
233
super.OnMouseEnter(w, x, y);
234
m_wRoot
.SetZOrder(1);
235
m_wHighlightImg
.SetVisible(
true
);
236
237
if
(
m_wGradient
)
238
m_wGradient
.SetVisible(
true
);
239
240
if
(!
m_bIsSelected
)
241
AnimExpand
();
242
243
return
false
;
244
}
245
246
//------------------------------------------------------------------------------
247
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
248
{
249
super.OnMouseLeave(w, enterW, x, y);
250
m_wRoot
.SetZOrder(0);
251
m_wHighlightImg
.SetVisible(
false
);
252
if
(!
m_bIsSelected
&&
m_wGradient
)
253
m_wGradient
.SetVisible(
false
);
254
if
(!
m_bIsSelected
)
255
{
256
AnimCollapse
();
257
}
258
259
if
(
RenderTargetWidget
.Cast(enterW) &&
m_wButton
.IsEnabled())
260
m_wButton
.SetEnabled(
false
);
261
262
return
false
;
263
}
264
265
override
RplId
GetSpawnPointId
()
266
{
267
return
m_SpawnPointId
;
268
}
269
};
EMilitarySymbolIdentity
EMilitarySymbolIdentity
Definition
EMilitarySymbol.c:2
EMilitarySymbolIcon
EMilitarySymbolIcon
Definition
EMilitarySymbol.c:30
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
EResourceType
EResourceType
Definition
SCR_ResourceContainer.c:2
EResourceGeneratorID
EResourceGeneratorID
Definition
SCR_ResourceGenerator.c:2
ButtonWidget
Definition
ButtonWidget.c:16
OverlayWidget
Definition
OverlayWidget.c:16
RenderTargetWidget
Definition
RenderTargetWidget.c:13
Replication
Main replication API.
Definition
Replication.c:14
RichTextWidget
Definition
RichTextWidget.c:13
RplId
Replication item identifier.
Definition
RplId.c:14
SCR_Faction
Definition
SCR_Faction.c:6
SCR_GroupIdentityCore
Definition
SCR_GroupIdentityCore.c:3
SCR_GroupIdentityCore::GetSymbolRuleSet
SCR_MilitarySymbolRuleSet GetSymbolRuleSet()
Definition
SCR_GroupIdentityCore.c:21
SCR_MapUIElement
Definition
SCR_MapUIElement.c:13
SCR_MapUIElement::AnimCollapse
void AnimCollapse()
Definition
SCR_MapUIElement.c:164
SCR_MapUIElement::GetColorForFaction
Color GetColorForFaction(string factionKey)
Definition
SCR_MapUIElement.c:186
SCR_MapUIElement::m_bIsSelected
bool m_bIsSelected
Definition
SCR_MapUIElement.c:24
SCR_MapUIElement::m_sImageSetARO
ResourceName m_sImageSetARO
Definition
SCR_MapUIElement.c:30
SCR_MapUIElement::s_SelectedElement
static SCR_MapUIElement s_SelectedElement
Definition
SCR_MapUIElement.c:15
SCR_MapUIElement::m_bVisible
bool m_bVisible
Definition
SCR_MapUIElement.c:27
SCR_MapUIElement::m_wSelectImg
ImageWidget m_wSelectImg
Definition
SCR_MapUIElement.c:21
SCR_MapUIElement::m_Parent
SCR_MapUIElementContainer m_Parent
Definition
SCR_MapUIElement.c:14
SCR_MapUIElement::AnimExpand
void AnimExpand()
Definition
SCR_MapUIElement.c:159
SCR_MapUIElement::m_wGradient
ImageWidget m_wGradient
Definition
SCR_MapUIElement.c:20
SCR_MapUIElement::m_wHighlightImg
ImageWidget m_wHighlightImg
Definition
SCR_MapUIElement.c:22
SCR_MapUIElement::Select
void Select(bool select=true)
Definition
SCR_MapUIElement.c:138
SCR_MapUISpawnPoint
Definition
SCR_MapUISpawnPoint.c:2
SCR_MapUISpawnPoint::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_MapUISpawnPoint.c:148
SCR_MapUISpawnPoint::m_ResourceComponent
SCR_ResourceComponent m_ResourceComponent
Definition
SCR_MapUISpawnPoint.c:20
SCR_MapUISpawnPoint::m_wImageOverlay
Widget m_wImageOverlay
Definition
SCR_MapUISpawnPoint.c:12
SCR_MapUISpawnPoint::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_MapUISpawnPoint.c:247
SCR_MapUISpawnPoint::GetSpawnPointId
override RplId GetSpawnPointId()
Definition
SCR_MapUISpawnPoint.c:265
SCR_MapUISpawnPoint::m_wSpawnPointName
TextWidget m_wSpawnPointName
Definition
SCR_MapUISpawnPoint.c:11
SCR_MapUISpawnPoint::m_ResourceConsumer
SCR_ResourceConsumer m_ResourceConsumer
Definition
SCR_MapUISpawnPoint.c:21
SCR_MapUISpawnPoint::m_SpawnPointId
RplId m_SpawnPointId
Definition
SCR_MapUISpawnPoint.c:9
SCR_MapUISpawnPoint::m_wSizeLayout
SizeLayoutWidget m_wSizeLayout
Definition
SCR_MapUISpawnPoint.c:16
SCR_MapUISpawnPoint::Init
void Init(notnull SCR_SpawnPoint spawnPoint)
Definition
SCR_MapUISpawnPoint.c:26
SCR_MapUISpawnPoint::m_MilitarySymbolComponent
SCR_MilitarySymbolUIComponent m_MilitarySymbolComponent
Definition
SCR_MapUISpawnPoint.c:14
SCR_MapUISpawnPoint::SelectIcon
override void SelectIcon(bool invoke=true)
Definition
SCR_MapUISpawnPoint.c:185
SCR_MapUISpawnPoint::SetName
override void SetName(string name)
Definition
SCR_MapUISpawnPoint.c:56
SCR_MapUISpawnPoint::m_wButton
ButtonWidget m_wButton
Definition
SCR_MapUISpawnPoint.c:15
SCR_MapUISpawnPoint::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_MapUISpawnPoint.c:227
SCR_MapUISpawnPoint::m_wSupplies
Widget m_wSupplies
Definition
SCR_MapUISpawnPoint.c:17
SCR_MapUISpawnPoint::m_sSpawnPoint
string m_sSpawnPoint
Definition
SCR_MapUISpawnPoint.c:6
SCR_MapUISpawnPoint::m_sFactionKey
string m_sFactionKey
Definition
SCR_MapUISpawnPoint.c:10
SCR_MapUISpawnPoint::m_sSelection
string m_sSelection
Definition
SCR_MapUISpawnPoint.c:4
SCR_MapUISpawnPoint::m_ResourceInventoryPlayerComponentRplId
RplId m_ResourceInventoryPlayerComponentRplId
Definition
SCR_MapUISpawnPoint.c:23
SCR_MapUISpawnPoint::m_SpawnPoint
SCR_SpawnPoint m_SpawnPoint
Definition
SCR_MapUISpawnPoint.c:8
SCR_MapUISpawnPoint::UpdateIcon
void UpdateIcon()
Definition
SCR_MapUISpawnPoint.c:79
SCR_MapUISpawnPoint::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_MapUISpawnPoint.c:174
SCR_MapUISpawnPoint::m_wSymbolOverlay
OverlayWidget m_wSymbolOverlay
Definition
SCR_MapUISpawnPoint.c:13
SCR_MapUISpawnPoint::GetPos
override vector GetPos()
Definition
SCR_MapUISpawnPoint.c:63
SCR_MapUISpawnPoint::m_ResourceSubscriptionHandleConsumer
ref SCR_ResourceSystemSubscriptionHandleBase m_ResourceSubscriptionHandleConsumer
Definition
SCR_MapUISpawnPoint.c:22
SCR_MapUISpawnPoint::UpdateResources
void UpdateResources()
Definition
SCR_MapUISpawnPoint.c:69
SCR_MilitarySymbol
Definition
SCR_MilitarySymbol.c:3
SCR_MilitarySymbol::SetIcons
void SetIcons(EMilitarySymbolIcon icons)
Definition
SCR_MilitarySymbol.c:60
SCR_MilitarySymbol::GetIdentity
EMilitarySymbolIdentity GetIdentity()
Definition
SCR_MilitarySymbol.c:20
SCR_MilitarySymbol::SetIdentity
void SetIdentity(EMilitarySymbolIdentity identity)
Definition
SCR_MilitarySymbol.c:28
SCR_MilitarySymbolRuleSet
Definition
SCR_MilitarySymbolRuleSet.c:3
SCR_MilitarySymbolRuleSet::UpdateSymbol
void UpdateSymbol(out notnull SCR_MilitarySymbol outSymbol, SCR_Faction faction)
Definition
SCR_MilitarySymbolRuleSet.c:26
SCR_MilitarySymbolUIComponent
Definition
SCR_MilitarySymbolUIComponent.c:2
SCR_ResourcePlayerControllerInventoryComponent
Definition
SCR_ResourcePlayerControllerInventoryComponent.c:25
SCR_ResourceSystemSubscriptionHandleBase
Definition
SCR_ResourceSystemSubscriptionHandleBase.c:2
SCR_ScriptedWidgetComponent::m_wRoot
Widget m_wRoot
Definition
SCR_ScriptedWidgetComponent.c:9
SCR_SpawnPoint
Spawn point entity defines positions on which players can possibly spawn.
Definition
SCR_SpawnPoint.c:28
SizeLayoutWidget
Definition
SizeLayoutWidget.c:16
TextWidget
Definition
TextWidget.c:16
Widget
Definition
Widget.c:13
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
GetFactionByKey
FactionManagerClass GenericEntityClass GetFactionByKey(FactionKey factionKey)
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
ToString
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
scripts
Game
UI
Conflict
SCR_MapUISpawnPoint.c
Generated by
1.17.0