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_ServicePointMapDescriptorComponent.c
Go to the documentation of this file.
1
class
SCR_ServicePointMapDescriptorComponentClass
:
SCR_MapDescriptorComponentClass
2
{
3
}
4
5
class
SCR_ServicePointMapDescriptorComponent
: SCR_MapDescriptorComponent
6
{
7
[
Attribute
(
""
,
desc
:
"Name of marker (service is active)."
)]
8
protected
string
m_sMarkerActive;
9
10
[
Attribute
(
""
,
desc
:
"Name of marker (service is inctive)."
)]
11
protected
string
m_sMarkerInactive;
12
13
[
Attribute
(
"Default Name"
,
desc
:
"Name of service to be shown on hover."
)]
14
protected
string
m_sMarkerName;
15
16
[
Attribute
(
"Default Description"
,
desc
:
"Description of service to be shown on hover."
)]
17
protected
string
m_sMarkerDesc;
18
19
[
Attribute
(
"{94F1E2223D7E0588}UI/layouts/Campaign/ServiceHint.layout"
)]
20
protected
ResourceName
m_sDescriptorServiceHint
;
21
22
protected
string
m_sMarkerSmall
=
"Slot_Small"
;
23
24
protected
Widget
m_wDescriptorServiceHint
;
25
26
protected
SCR_MilitaryBaseComponent
m_Base
;
27
28
//------------------------------------------------------------------------------------------------
31
void
SetParentBase
(SCR_MilitaryBaseComponent
base
,
bool
duringInit =
false
)
32
{
33
m_Base
=
base
;
34
35
if
(!
m_Base
||
m_Base
.GetFaction() !=
SCR_FactionManager
.SGetLocalPlayerFaction() || duringInit)
36
SetServiceMarker
(
m_Base
.GetFaction(),
false
);
37
}
38
39
//------------------------------------------------------------------------------------------------
42
void
SetServiceMarker
(
Faction
faction = null,
bool
visible =
true
)
43
{
44
MapItem
item = Item();
45
46
if
(!item)
47
return
;
48
49
if
(visible)
50
{
51
item.SetVisible(
true
);
52
}
53
else
54
{
55
item.SetVisible(
false
);
56
return
;
57
}
58
59
if
(!faction)
60
return
;
61
62
MapDescriptorProps
props = item.GetProps();
63
64
props.SetFrontColor(faction.GetFactionColor());
65
props.SetTextVisible(
false
);
66
props.Activate(
true
);
67
68
SCR_MapEntity
mapEntity =
SCR_MapEntity
.
GetMapInstance
();
69
70
if
(mapEntity)
71
SetVisible
(mapEntity.GetLayerIndex());
72
}
73
74
//------------------------------------------------------------------------------------------------
76
void
SetServiceMarkerActive
(
bool
active)
77
{
78
MapItem
item = Item();
79
80
if
(!item)
81
return
;
82
83
string
marker;
84
85
if
(active)
86
marker = m_sMarkerActive;
87
else
88
marker = m_sMarkerInactive;
89
90
item.SetImageDef(marker);
91
}
92
93
//------------------------------------------------------------------------------------------------
95
void
SetVisible
(
int
layer
)
96
{
97
if
(!
m_Base
)
98
return
;
99
100
MapItem
item = Item();
101
MapDescriptorProps
props = item.GetProps();
102
103
if
(
layer
== 0)
104
{
105
item.SetImageDef(m_sMarkerActive);
106
props.SetIconSize(32, 0.3, 0.3);
107
}
108
else
109
{
110
item.SetImageDef(
m_sMarkerSmall
);
111
props.SetIconSize(32, 0.1, 0.1);
112
}
113
114
// TODO: Get rid of Campaign dependency once radio signal range is a sandbox feature
115
SCR_CampaignMilitaryBaseComponent
campaignBase =
SCR_CampaignMilitaryBaseComponent
.Cast(
m_Base
);
116
117
if
(!campaignBase)
118
return
;
119
120
SCR_CampaignFaction
f =
SCR_CampaignFaction
.Cast(
SCR_FactionManager
.SGetLocalPlayerFaction());
121
122
if
(!f)
123
return
;
124
125
if
(campaignBase.
IsHQRadioTrafficPossible
(f))
126
Item().GetProps().SetVisible(
layer
< 3);
127
}
128
129
//------------------------------------------------------------------------------------------------
132
void
ShowServiceHint
(
MapItem
show)
133
{
134
MapItem
item = Item();
135
if
(show != item)
136
return
;
137
138
int
mx;
139
int
my;
140
WidgetManager
.GetMousePos(mx, my);
141
142
mx =
GetGame
().GetWorkspace().DPIUnscale(mx);
143
my =
GetGame
().GetWorkspace().DPIUnscale(my);
144
145
if
(!
m_wDescriptorServiceHint
)
146
{
147
SCR_MapEntity
entity =
SCR_MapEntity
.
GetMapInstance
();
148
m_wDescriptorServiceHint
= entity.
GetMapMenuRoot
().FindAnyWidget(
"ServiceHintRoot"
);
149
}
150
151
if
(!
m_wDescriptorServiceHint
)
152
return
;
153
154
if
(show)
155
{
156
FrameSlot
.SetPos(
m_wDescriptorServiceHint
, mx, my);
157
TextWidget
.Cast(
m_wDescriptorServiceHint
.FindAnyWidget(
"ServiceName"
)).SetTextFormat(m_sMarkerName);
158
Widget
resupplyText =
m_wDescriptorServiceHint
.FindAnyWidget(
"ResupplyText"
);
159
if
(resupplyText)
160
resupplyText.SetVisible(
false
);
161
162
TextWidget
serviceText =
TextWidget
.Cast(
m_wDescriptorServiceHint
.FindAnyWidget(
"ServiceText"
));
163
if
(serviceText)
164
{
165
if
(m_sMarkerDesc !=
"Default Description"
)
166
{
167
serviceText.SetTextFormat(m_sMarkerDesc);
168
serviceText.SetVisible(
true
);
169
}
170
else
171
{
172
serviceText.SetVisible(
false
);
173
}
174
}
175
}
176
177
m_wDescriptorServiceHint
.SetVisible(
true
)
178
}
179
180
//------------------------------------------------------------------------------------------------
183
void
HideServiceHint
(
MapItem
show)
184
{
185
MapItem
item = Item();
186
if
(show != item)
187
return
;
188
189
if
(
m_wDescriptorServiceHint
)
190
m_wDescriptorServiceHint
.SetVisible(
false
);
191
}
192
193
//------------------------------------------------------------------------------------------------
194
// constructor
198
void
SCR_ServicePointMapDescriptorComponent
(
IEntityComponentSource
src,
IEntity
ent,
IEntity
parent)
199
{
200
SCR_MapEntity
.
GetOnLayerChanged
().Insert(
SetVisible
);
201
SCR_MapEntity
.
GetOnHoverItem
().Insert(
ShowServiceHint
);
202
SCR_MapEntity
.
GetOnHoverEnd
().Insert(
HideServiceHint
);
203
}
204
205
//------------------------------------------------------------------------------------------------
206
// destructor
207
void
~SCR_ServicePointMapDescriptorComponent
()
208
{
209
SCR_MapEntity
.
GetOnLayerChanged
().Remove(
SetVisible
);
210
SCR_MapEntity
.
GetOnHoverItem
().Remove(
ShowServiceHint
);
211
SCR_MapEntity
.
GetOnHoverEnd
().Remove(
HideServiceHint
);
212
}
213
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
layer
LayerPresets layer
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
base
around base
Definition
SCR_HoldCampaignMilitaryBaseTaskEntity.c:9
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
~SCR_ServicePointMapDescriptorComponent
void ~SCR_ServicePointMapDescriptorComponent()
Definition
SCR_ServicePointMapDescriptorComponent.c:207
SetServiceMarker
void SetServiceMarker(Faction faction=null, bool visible=true)
Definition
SCR_ServicePointMapDescriptorComponent.c:42
SCR_ServicePointMapDescriptorComponent
void SCR_ServicePointMapDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_ServicePointMapDescriptorComponent.c:198
ShowServiceHint
void ShowServiceHint(MapItem show)
Definition
SCR_ServicePointMapDescriptorComponent.c:132
SetServiceMarkerActive
void SetServiceMarkerActive(bool active)
Definition
SCR_ServicePointMapDescriptorComponent.c:76
m_wDescriptorServiceHint
Widget m_wDescriptorServiceHint
Definition
SCR_ServicePointMapDescriptorComponent.c:24
HideServiceHint
void HideServiceHint(MapItem show)
Definition
SCR_ServicePointMapDescriptorComponent.c:183
m_sMarkerSmall
string m_sMarkerSmall
Definition
SCR_ServicePointMapDescriptorComponent.c:22
m_sDescriptorServiceHint
ResourceName m_sDescriptorServiceHint
Definition
SCR_ServicePointMapDescriptorComponent.c:20
SetVisible
void SetVisible(int layer)
Definition
SCR_ServicePointMapDescriptorComponent.c:95
SetParentBase
void SetParentBase(SCR_MilitaryBaseComponent base, bool duringInit=false)
Definition
SCR_ServicePointMapDescriptorComponent.c:31
m_Base
SCR_CampaignMilitaryBaseComponent m_Base
Definition
SCR_SuppliesTransferWaypoint.c:64
Faction
Definition
Faction.c:13
FrameSlot
Definition
FrameSlot.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntity
Definition
IEntity.c:13
MapDescriptorProps
Definition
MapDescriptorProps.c:13
MapItem
Definition
MapItem.c:13
ResourceName
Definition
ResourceName.c:13
SCR_CampaignFaction
Definition
SCR_CampaignFaction.c:2
SCR_CampaignMilitaryBaseComponent
Definition
SCR_CampaignMilitaryBaseComponent.c:38
SCR_CampaignMilitaryBaseComponent::IsHQRadioTrafficPossible
bool IsHQRadioTrafficPossible(notnull SCR_CampaignFaction faction, SCR_ERadioCoverageStatus direction=SCR_ERadioCoverageStatus.RECEIVE)
Definition
SCR_CampaignMilitaryBaseComponent.c:1165
SCR_MapDescriptorComponentClass
Definition
SCR_MapDescriptorComponent.c:2
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::GetMapMenuRoot
Widget GetMapMenuRoot()
Get map menu root widget.
Definition
SCR_MapEntity.c:186
SCR_MapEntity::GetOnHoverItem
static ScriptInvokerBase< MapItemInvoker > GetOnHoverItem()
Get on hover item invoker.
Definition
SCR_MapEntity.c:106
SCR_MapEntity::GetOnLayerChanged
static ScriptInvokerInt GetOnLayerChanged()
Get on layer changed invoker.
Definition
SCR_MapEntity.c:110
SCR_MapEntity::GetOnHoverEnd
static ScriptInvokerBase< MapItemInvoker > GetOnHoverEnd()
Get on hover end invoker.
Definition
SCR_MapEntity.c:108
SCR_MapEntity::GetMapInstance
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Definition
SCR_MapEntity.c:112
SCR_ServicePointMapDescriptorComponentClass
Definition
SCR_ServicePointMapDescriptorComponent.c:2
TextWidget
Definition
TextWidget.c:16
Widget
Definition
Widget.c:13
WidgetManager
Definition
WidgetManager.c:16
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Campaign
SCR_ServicePointMapDescriptorComponent.c
Generated by
1.17.0