Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ServicePointMapDescriptorComponent.c
Go to the documentation of this file.
2{
3}
4
5class 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")]
21
22 protected string m_sMarkerSmall = "Slot_Small";
23
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
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
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 //------------------------------------------------------------------------------------------------
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
146 {
148 m_wDescriptorServiceHint = entity.GetMapMenuRoot().FindAnyWidget("ServiceHintRoot");
149 }
150
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 //------------------------------------------------------------------------------------------------
184 {
185 MapItem item = Item();
186 if (show != item)
187 return;
188
190 m_wDescriptorServiceHint.SetVisible(false);
191 }
192
193 //------------------------------------------------------------------------------------------------
194 // constructor
204
205 //------------------------------------------------------------------------------------------------
206 // destructor
213}
ArmaReforgerScripted GetGame()
Definition game.c:1398
LayerPresets layer
void SCR_FactionManager(IEntitySource src, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void ~SCR_ServicePointMapDescriptorComponent()
void SetServiceMarker(Faction faction=null, bool visible=true)
void SCR_ServicePointMapDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void ShowServiceHint(MapItem show)
void SetServiceMarkerActive(bool active)
void HideServiceHint(MapItem show)
ResourceName m_sDescriptorServiceHint
void SetVisible(int layer)
void SetParentBase(SCR_MilitaryBaseComponent base, bool duringInit=false)
SCR_CampaignMilitaryBaseComponent m_Base
bool IsHQRadioTrafficPossible(notnull SCR_CampaignFaction faction, SCR_ERadioCoverageStatus direction=SCR_ERadioCoverageStatus.RECEIVE)
Widget GetMapMenuRoot()
Get map menu root widget.
static ScriptInvokerBase< MapItemInvoker > GetOnHoverItem()
Get on hover item invoker.
static ScriptInvokerInt GetOnLayerChanged()
Get on layer changed invoker.
static ScriptInvokerBase< MapItemInvoker > GetOnHoverEnd()
Get on hover end invoker.
static SCR_MapEntity GetMapInstance()
Get map entity instance.
SCR_FieldOfViewSettings Attribute