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_CampaignMapUIService.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
class
SCR_CampaignMapUIService
:
SCR_CampaignMapUIElement
3
{
4
protected
SCR_CampaignMapUIBase
m_ParentBase
;
5
6
protected
SCR_EServicePointType
m_eServiceType
;
7
8
protected
bool
m_bEnabled
;
9
protected
string
m_sServiceName
;
10
protected
string
m_sServiceIcon
;
11
protected
string
m_sServiceText
;
12
13
//------------------------------------------------------------------------------
14
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
15
{
16
PlayHoverSound
(
m_sSoundService
);
17
18
ShowHint
(
true
);
19
if
(
m_ParentBase
)
20
m_ParentBase
.m_bIsAnyElementHovered =
true
;
21
22
return
false
;
23
}
24
25
//------------------------------------------------------------------------------
26
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
27
{
28
ShowHint
(
false
);
29
if
(
m_ParentBase
)
30
m_ParentBase
.m_bIsAnyElementHovered =
false
;
31
32
return
false
;
33
}
34
35
//------------------------------------------------------------------------------
36
override
bool
OnClick
(
Widget
w,
int
x,
int
y,
int
button)
37
{
38
SCR_MapEntity
mapa =
SCR_MapEntity
.
GetMapInstance
();
39
if
(
m_MapItem
&&
m_MapItem
.IsVisible() && mapa)
40
{
41
vector
pos =
m_MapItem
.GetPos();
42
mapa.
ZoomPanSmooth
(10, pos[0], pos[2]);
43
}
44
45
return
false
;
46
}
47
48
//------------------------------------------------------------------------------
49
override
void
AnimExpand
()
50
{
51
}
52
53
//------------------------------------------------------------------------------
54
override
void
AnimCollapse
()
55
{
56
}
57
58
//------------------------------------------------------------------------------
59
override
void
HandlerAttached
(
Widget
w)
60
{
61
super.HandlerAttached(w);
62
m_eIconType
=
SCR_EIconType
.SERVICE;
63
}
64
65
//------------------------------------------------------------------------------
66
void
ShowHint
(
bool
show)
67
{
68
if
(
m_ParentBase
)
69
{
70
SCR_CampaignMilitaryBaseComponent
base
=
m_ParentBase
.GetBase();
71
72
if
(
m_eServiceType
==
EEditableEntityLabel
.SERVICE_SUPPLY_STORAGE &&
base
)
73
{
74
Faction
playerFaction =
SCR_FactionManager
.SGetLocalPlayerFaction();
75
if
(
base
.GetFaction() == playerFaction)
76
{
77
int
supplies =
base
.GetSupplies();
78
int
suppliesMax =
base
.GetSuppliesMax();
79
80
m_sServiceText
=
"#AR-Campaign_BaseSuppliesHintAmount"
;
81
m_ParentBase
.ShowServiceHint(
m_sServiceName
,
m_sServiceText
, show, supplies, suppliesMax);
82
}
83
else
84
{
85
m_sServiceText
=
"#AR-Campaign_BaseSuppliesHintUnknown"
;
86
m_ParentBase
.ShowServiceHint(
m_sServiceName
,
m_sServiceText
, show);
87
}
88
}
89
else
90
{
91
m_ParentBase
.ShowServiceHint(
m_sServiceName
,
m_sServiceText
, show);
92
}
93
}
94
}
95
96
//------------------------------------------------------------------------------
97
void
SetServiceImage
()
98
{
99
switch
(
m_eServiceType
)
100
{
101
case
SCR_EServicePointType
.BARRACKS:
102
{
103
SetImage
(
m_sBarracks
);
104
m_sServiceName
=
"#AR-Campaign_Building_Barracks"
;
105
}
break
;
106
107
case
SCR_EServicePointType
.FIELD_HOSPITAL:
108
{
109
SetImage
(
m_sFieldHospital
);
110
m_sServiceName
=
"#AR-Campaign_Building_FieldHospital"
;
111
}
break
;
112
113
case
SCR_EServicePointType
.LIGHT_VEHICLE_DEPOT:
114
{
115
SetImage
(
m_sLightVehicleDepot
);
116
m_sServiceName
=
"#AR-Comm_Variable_Miscellaneous_LightVehicleDepot"
;
117
}
break
;
118
119
case
SCR_EServicePointType
.HEAVY_VEHICLE_DEPOT:
120
{
121
SetImage
(
m_sHeavyVehicleDepot
);
122
m_sServiceName
=
"#AR-Comm_Variable_Miscellaneous_HeavyVehicleDepot"
;
123
}
break
;
124
125
case
SCR_EServicePointType
.RADIO_ANTENNA:
126
{
127
SetImage
(
m_sRadioAntenna
);
128
m_sServiceName
=
"#AR-Comm_Variable_Miscellaneous_RadioAntenna"
;
129
}
break
;
130
131
case
SCR_EServicePointType
.SUPPLY_DEPOT:
132
{
133
SetImage
(
m_sSupplyDepot
);
134
m_sServiceName
=
"#AR-Comm_Variable_Miscellaneous_Supplydepot_US"
;
135
}
break
;
136
137
case
SCR_EServicePointType
.ARMORY:
138
{
139
SetImage
(
m_sArmory
);
140
m_sServiceName
=
"#AR-Campaign_Building_Armory"
;
141
}
break
;
142
143
case
SCR_EServicePointType
.FUEL_DEPOT:
144
{
145
SetImage
(
m_sFuelDepot
);
146
m_sServiceName
=
"#AR-Comm_Variable_Miscellaneous_Fueldepot_US"
;
147
}
break
;
148
149
case
SCR_EServicePointType
.HELIPAD:
150
{
151
SetImage
(
m_sHelipad
);
152
m_sServiceName
=
"#AR-EditableEntity_Helipad_L_US_01_Name"
;
153
}
break
;
154
155
/*case SCR_EServicePointType.VEHICLE_DEPOT:
156
{
157
SetImage(m_sVehicleDepot);
158
m_sServiceName = "#AR-Campaign_Building_MotorPool";
159
} break;*/
160
}
161
}
162
163
//------------------------------------------------------------------------------
164
void
SetParent
(
SCR_CampaignMapUIBase
parent)
165
{
166
m_ParentBase
= parent;
167
}
168
169
//------------------------------------------------------------------------------
170
void
SetService
(
EEditableEntityLabel
type
, SCR_ServicePointDelegateComponent service)
171
{
172
m_bEnabled
= service != null;
173
m_eServiceType
=
type
;
174
SetServiceImage
();
175
176
if
(!service)
177
return
;
178
179
IEntity
owner = service.GetOwner();
180
181
if
(!owner)
182
return
;
183
184
SCR_ServicePointMapDescriptorComponent
descr =
SCR_ServicePointMapDescriptorComponent
.Cast(owner.
FindComponent
(
SCR_ServicePointMapDescriptorComponent
));
185
186
if
(!descr)
187
{
188
IEntity
compositionParent =
SCR_EntityHelper
.
GetMainParent
(owner,
true
);
189
descr =
SCR_ServicePointMapDescriptorComponent
.Cast(compositionParent.
FindComponent
(
SCR_ServicePointMapDescriptorComponent
));
190
}
191
192
if
(descr)
193
m_MapItem
= descr.Item();
194
}
195
196
//------------------------------------------------------------------------------
197
override
void
SetImage
(
string
image)
198
{
199
m_sServiceIcon
= image;
200
string
suffix =
string
.Empty;
201
202
SCR_ButtonImageComponent
img =
SCR_ButtonImageComponent
.Cast(
m_wRoot
.FindHandler(
SCR_ButtonImageComponent
));
203
if
(img)
204
{
205
img.SetImage(
m_sImageSet
, image + suffix);
206
img.SetEnabled(
m_bEnabled
);
207
}
208
}
209
};
EEditableEntityLabel
EEditableEntityLabel
Definition
EEditableEntityLabel.c:2
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
base
around base
Definition
SCR_HoldCampaignMilitaryBaseTaskEntity.c:9
SCR_EIconType
SCR_EIconType
Definition
SCR_MapUIElement.c:2
ShowHint
void ShowHint()
Definition
SCR_PerceivedFactionManagerComponent.c:54
SCR_EServicePointType
SCR_EServicePointType
Definition
SCR_ServicePointComponent.c:215
SCR_ServicePointMapDescriptorComponent
void SCR_ServicePointMapDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_ServicePointMapDescriptorComponent.c:198
Faction
Definition
Faction.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_ButtonImageComponent
Definition
SCR_ButtonImageComponent.c:3
SCR_CampaignMapUIBase
Definition
SCR_CampaignMapUIBase.c:3
SCR_CampaignMapUIElement
Definition
SCR_CampaignMapUIElement.c:3
SCR_CampaignMapUIElement::m_sHeavyVehicleDepot
string m_sHeavyVehicleDepot
Definition
SCR_CampaignMapUIElement.c:12
SCR_CampaignMapUIElement::m_sHelipad
string m_sHelipad
Definition
SCR_CampaignMapUIElement.c:24
SCR_CampaignMapUIElement::m_sImageSet
ResourceName m_sImageSet
Definition
SCR_CampaignMapUIElement.c:49
SCR_CampaignMapUIElement::m_sFuelDepot
string m_sFuelDepot
Definition
SCR_CampaignMapUIElement.c:8
SCR_CampaignMapUIElement::m_sArmory
string m_sArmory
Definition
SCR_CampaignMapUIElement.c:6
SCR_CampaignMapUIElement::m_sFieldHospital
string m_sFieldHospital
Definition
SCR_CampaignMapUIElement.c:16
SCR_CampaignMapUIElement::m_sBarracks
string m_sBarracks
Definition
SCR_CampaignMapUIElement.c:18
SCR_CampaignMapUIElement::m_sLightVehicleDepot
string m_sLightVehicleDepot
Definition
SCR_CampaignMapUIElement.c:10
SCR_CampaignMapUIElement::m_sRadioAntenna
string m_sRadioAntenna
Definition
SCR_CampaignMapUIElement.c:14
SCR_CampaignMapUIElement::m_sSupplyDepot
string m_sSupplyDepot
Definition
SCR_CampaignMapUIElement.c:20
SCR_CampaignMapUIService
Definition
SCR_CampaignMapUIService.c:3
SCR_CampaignMapUIService::m_sServiceIcon
string m_sServiceIcon
Definition
SCR_CampaignMapUIService.c:10
SCR_CampaignMapUIService::m_sServiceText
string m_sServiceText
Definition
SCR_CampaignMapUIService.c:11
SCR_CampaignMapUIService::m_sServiceName
string m_sServiceName
Definition
SCR_CampaignMapUIService.c:9
SCR_CampaignMapUIService::m_eServiceType
SCR_EServicePointType m_eServiceType
Definition
SCR_CampaignMapUIService.c:6
SCR_CampaignMapUIService::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_CampaignMapUIService.c:59
SCR_CampaignMapUIService::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_CampaignMapUIService.c:26
SCR_CampaignMapUIService::SetService
void SetService(EEditableEntityLabel type, SCR_ServicePointDelegateComponent service)
Definition
SCR_CampaignMapUIService.c:170
SCR_CampaignMapUIService::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
SCR_CampaignMapUIService.c:36
SCR_CampaignMapUIService::SetParent
void SetParent(SCR_CampaignMapUIBase parent)
Definition
SCR_CampaignMapUIService.c:164
SCR_CampaignMapUIService::AnimExpand
override void AnimExpand()
Definition
SCR_CampaignMapUIService.c:49
SCR_CampaignMapUIService::m_ParentBase
SCR_CampaignMapUIBase m_ParentBase
Definition
SCR_CampaignMapUIService.c:4
SCR_CampaignMapUIService::ShowHint
void ShowHint(bool show)
Definition
SCR_CampaignMapUIService.c:66
SCR_CampaignMapUIService::m_bEnabled
bool m_bEnabled
Definition
SCR_CampaignMapUIService.c:8
SCR_CampaignMapUIService::AnimCollapse
override void AnimCollapse()
Definition
SCR_CampaignMapUIService.c:54
SCR_CampaignMapUIService::SetImage
override void SetImage(string image)
Definition
SCR_CampaignMapUIService.c:197
SCR_CampaignMapUIService::SetServiceImage
void SetServiceImage()
Definition
SCR_CampaignMapUIService.c:97
SCR_CampaignMapUIService::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_CampaignMapUIService.c:14
SCR_CampaignMilitaryBaseComponent
Definition
SCR_CampaignMilitaryBaseComponent.c:38
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_EntityHelper::GetMainParent
static IEntity GetMainParent(IEntity entity, bool self=false)
Definition
SCR_EntityHelper.c:325
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::ZoomPanSmooth
void ZoomPanSmooth(float targetPixPerUnit, float worldX, float worldY, float zoomTime=0.25)
Definition
SCR_MapEntity.c:694
SCR_MapEntity::GetMapInstance
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Definition
SCR_MapEntity.c:112
SCR_MapUIElement::m_eIconType
SCR_EIconType m_eIconType
Definition
SCR_MapUIElement.c:26
SCR_MapUIElement::m_MapItem
MapItem m_MapItem
Definition
SCR_MapUIElement.c:17
SCR_MapUIElement::m_sSoundService
string m_sSoundService
Definition
SCR_MapUIElement.c:51
SCR_MapUIElement::PlayHoverSound
void PlayHoverSound(string sound)
Definition
SCR_MapUIElement.c:169
SCR_ScriptedWidgetComponent::m_wRoot
Widget m_wRoot
Definition
SCR_ScriptedWidgetComponent.c:9
Widget
Definition
Widget.c:13
vector
Definition
vector.c:13
scripts
Game
UI
Conflict
SCR_CampaignMapUIService.c
Generated by
1.17.0