Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignMapUIBase.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute("{14E86B20D0ED993F}UI/layouts/Campaign/ServiceContainer.layout")]
6
7 [Attribute("{94F1E2223D7E0588}UI/layouts/Campaign/ServiceHint.layout")]
9
10 [Attribute("{CA8B528037B6831A}UI/Textures/InventoryIcons/Supplies_icon_UI.edds")]
12
13 [Attribute("OpenButton")]
14 protected string m_sOpenButtonName;
15
16 [Attribute("60", params: "0 inf 1", desc: "How many seconds between updates of next shipment text. If set to 0, the text will not be updated at all.")]
18
19 [Attribute("NextShipmentWrapper")]
21
22 [Attribute("NextShipmentLabel")]
23 protected string m_sNextShipmentLabelName;
24
25 [Attribute("NextShipmentText")]
26 protected string m_sNextShipmentTextName;
27
28 protected static const float OPACITY_DISABLED = 0.5;
29 protected static const float OPACITY_UNSELECTED = 0.9;
30
31 protected static const LocalizedString NEXT_SHIPMENT_ETA = "#AR-FactionCommander_LogisticUIBaseNextShipmentETA";
32
33 /*
34 note(koudelkaluk): base name and service container offsets
35 are currently hardcoded in SetBaseImage() based on the icon size.
36 Once this system starts utilizing SCR_MilitarySymbolUIComponent,
37 this whole thing can be redone in a better way.
38 */
39 protected int m_iServicesPadding = 0;
40 protected float m_fNameOffset = 2;
41
43
45 protected string m_sFactionKey;
47 protected SCR_CampaignMobileAssemblyStandaloneComponent m_MobileAssembly;
48 protected SCR_ResourceComponent m_ResourceComponent;
49 protected SCR_ResourceConsumer m_ResourceConsumer;
52
60 protected static Widget m_wServiceHint;
64
69 protected TextWidget m_wSuppliesText
72
77 protected LocalizedString m_sRallyPointText = "#AR-RallyPoint_Name";
78
82
83 protected int m_iBaseSize = 80; // Maximum base icon size - it needs to be divisible by 4, otherwise the texture will look blurred
84 protected int m_iDefBaseSize = 46; // Default base size
85 protected int m_iMaxBaseSize = 80; // Maximum size of the base, everything is calculated from this value, changing it will change the scale of all the steps
86 protected int m_iDefHQSize = 88;
87 protected int m_iDefRelaySize = 64;
88
91 protected LocalizedString m_sAssembly = "#AR-Vehicle_MobileAssembly_Name";
92
94
98
102 protected bool m_bServicesShown;
103 protected bool m_bCanRespawn;
104 protected bool m_bIsRespawnMenu;
105 protected bool m_bIsEditor;
106 protected bool m_bCanPlaySounds = true;
107
109
110 //------------------------------------------------------------------------------------------------
120
121 //------------------------------------------------------------------------------------------------
131
132 //------------------------------------------------------------------------------------------------
134 {
135 return m_iBaseSize;
136 }
137
138 //------------------------------------------------------------------------------------------------
139 override bool OnClick(Widget w, int x, int y, int button)
140 {
142 m_OnMapIconClick.Invoke();
143
145
147 {
149 SelectIcon();
151 m_wHighlightImg.SetVisible(false);
152 }
153 return false;
154 }
155
156 //------------------------------------------------------------------------------------------------
157 override void SelectIcon(bool invoke = true)
158 {
159 if (!m_wSelectImg)
160 return;
161
163 {
164 s_SelectedElement.Select(false);
165 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_MAP_CLICK_POINT_ON);
166 }
167
168 Select(invoke);
169
170 m_wSelectImg.SetVisible(true);
171 if (m_wGradient)
172 m_wGradient.SetVisible(true);
173
174 if (m_bIsSelected && invoke)
175 m_Parent.OnSpawnPointSelected(m_SpawnPoint.GetRplId());
176 }
177
178 //------------------------------------------------------------------------------------------------
182 void FlashBaseIcon(Faction faction = null, bool changeToDefault = false)
183 {
184 // Flash the icon only if base faction is known to player's faction
185 // Otherwise just switch to default
186 if (m_Base.IsHQRadioTrafficPossible(SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction())))
187 {
188 if (changeToDefault)
189 SetBaseIconFactionColor(m_Base.GetCampaignFaction());
190 else
192 }
193 else
194 {
195 if (!changeToDefault)
196 return;
197
199 }
200 }
201
202 //------------------------------------------------------------------------------------------------
205 void SetCaptureWarning(bool isEnabled)
206 {
207 // Show only if base faction is known to player's faction
209 m_wCaptureWarning.SetVisible(isEnabled && m_Base.IsHQRadioTrafficPossible(SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction())));
210 }
211
212 //------------------------------------------------------------------------------------------------
213 override bool OnMouseEnter(Widget w, int x, int y)
214 {
215 if (m_wOpenButton)
216 m_wOpenButton.SetVisible(CanShowOpenButton());
217
218 if (m_wImageOverlay && w == m_wImageOverlay && !m_wBaseOverlay.IsEnabled())
219 m_wBaseOverlay.SetEnabled(true); // enable the underlying button, allowing click
220
222 SCR_DeployMenuMain deployMenu = SCR_DeployMenuMain.GetDeployMenu();
223 if (tm && deployMenu && !tm.IsTaskListOpen() && deployMenu.GetAllowMapContext())
224 {
225 GetGame().GetWorkspace().SetFocusedWidget(w);
226 }
227
229 m_OnMapIconEnter.Invoke();
230
231 super.OnMouseEnter(w, x, y);
232
233 m_bHighlighted = true;
234
235 if (w.Type() == ButtonWidget)
236 AnimExpand();
237
238 if (m_Base)
239 {
240 m_Base.GetMapDescriptor().OnIconHovered(true);
241
242 bool isSupportedBaseType = m_Base.GetType() == SCR_ECampaignBaseType.BASE || m_Base.GetType() == SCR_ECampaignBaseType.SOURCE_BASE;
243 bool isInRadioRange = m_Base.IsHQRadioTrafficPossible(SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction()));
244 if (m_wServices && isSupportedBaseType && isInRadioRange)
245 {
246 m_wServices.SetVisible(!m_mServices.IsEmpty());
247 m_wServices.SetEnabled(!m_mServices.IsEmpty());
248 }
249
250 bool isLocalPlayerFactionOwned = m_Base.GetFaction() == SCR_FactionManager.SGetLocalPlayerFaction();
251 bool shouldDisplayShipmentInterval = m_Base.GetSuppliesIncome() > 0 && (!SCR_GameModeCampaign.GetInstance().GetSuppliesAutoRegenerationEnabled() || m_Base.GetType() == SCR_ECampaignBaseType.SOURCE_BASE);
252 SetNextShipmentTextVisible(isSupportedBaseType && isInRadioRange && isLocalPlayerFactionOwned && shouldDisplayShipmentInterval);
253 }
254 else if (m_MobileAssembly)
255 {
256 SCR_RadioCoverageMapDescriptorComponent mapDesc = SCR_RadioCoverageMapDescriptorComponent.Cast(m_MobileAssembly.GetOwner().FindComponent(SCR_RadioCoverageMapDescriptorComponent));
257
258 if (mapDesc)
259 mapDesc.OnIconHovered(true);
260
262 }
263
264 if (m_wInfoText)
265 {
266 m_wInfoText.SetVisible(true);
267 m_wRoot.SetZOrder(1);
268 }
269
270 if (m_MobileAssembly){
271 m_wServices.SetVisible(true);
272 m_w_ServicesOverlay.SetVisible(false);
273 m_wRoot.SetZOrder(1);
274 }
275
277 return false;
278
279 SCR_MapCampaignUI mapCampaignUI = SCR_MapCampaignUI.Cast(m_Parent);
280 if (mapCampaignUI)
281 mapCampaignUI.SetHoveredBase(GetBase());
282
283 return false;
284 }
285
286 //------------------------------------------------------------------------------------------------
287 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
288 {
289 super.OnMouseLeave(w, enterW, x, y);
290
291 AnimCollapse();
292
293 m_bHighlighted = false;
294
295 if (m_wInfoText)
296 {
297 m_wInfoText.SetVisible(false);
298 m_wRoot.SetZOrder(0);
299 }
300
301 if (m_Base)
302 {
303 m_Base.GetMapDescriptor().OnIconHovered(false);
304 }
305 else if (m_MobileAssembly)
306 {
307 SCR_RadioCoverageMapDescriptorComponent mapDesc = SCR_RadioCoverageMapDescriptorComponent.Cast(m_MobileAssembly.GetOwner().FindComponent(SCR_RadioCoverageMapDescriptorComponent));
308
309 if (mapDesc)
310 mapDesc.OnIconHovered(false);
311 }
312
313 m_wInfoText.SetVisible(false);
314
315 GetGame().GetCallqueue().Remove(SetNextShipmentText);
316
318 return false;
319
320 if (m_wServices)
321 m_wServices.SetEnabled(false);
322
323 if (m_wLocalTask.IsEnabled())
324 m_wLocalTask.SetVisible(true);
325
326 if (enterW)
327 m_bCanPlaySounds = w.FindHandler(SCR_CampaignMapUIService) == null;
328 else
329 m_bCanPlaySounds = true;
330
331 if (RenderTargetWidget.Cast(enterW) && m_wBaseOverlay.IsEnabled())
332 {
333 m_wBaseOverlay.SetEnabled(false); // disable the base widget when not hovered, deactivating the button
334 m_bCanPlaySounds = true;
335 }
336
337 SCR_MapCampaignUI mapCampaignUI = SCR_MapCampaignUI.Cast(m_Parent);
338 if (mapCampaignUI)
339 mapCampaignUI.SetHoveredBase(null);
340
341 return false;
342 }
343
344 //------------------------------------------------------------------------------------------------
345 protected void SelectBase()
346 {
348 s_SelectedElement.Select(false);
349
350 Select();
351 }
352
353 //------------------------------------------------------------------------------------------------
354 protected void OnLeave()
355 {
356 }
357
358 //------------------------------------------------------------------------------------------------
359 override void AnimExpand()
360 {
361 if (!m_bHighlighted)
362 return;
363
365 {
366 switch (m_eIconType)
367 {
368 case SCR_EIconType.NONE:
369 {
370 } break;
371
372 case SCR_EIconType.BASE:
373 {
376 } break;
377
378 case SCR_EIconType.ENEMY_BASE:
379 {
381 } break;
382
383 case SCR_EIconType.RELAY:
384 {
386 } break;
387 }
388 }
389
390// int paddingLeft = 0;
391// int paddingRight = 0;
392// int paddingBottom = 0;
393// int expand = -5;
394// if (m_mTasks.IsEmpty())
395// paddingRight = 0;
396// if (m_mServices.IsEmpty())
397// paddingLeft = 0;
398
399 if (m_wServices)
401
402 m_wHighlightImg.SetVisible(true);
403 if (m_wGradient)
404 m_wGradient.SetVisible(true);
405 }
406
407 //------------------------------------------------------------------------------------------------
408 override void AnimCollapse()
409 {
410 m_wHighlightImg.SetVisible(false);
412 m_wGradient.SetVisible(false);
413
414 if (m_wServices)
415 {
417 }
418 }
419
420 //------------------------------------------------------------------------------------------------
427 void ShowServiceHint(string name, string text, bool show, int suppliesAmount = -1, int suppliesMax = -1)
428 {
429 int mx;
430 int my;
431
432 WidgetManager.GetMousePos(mx, my);
433
434 mx = GetGame().GetWorkspace().DPIUnscale(mx);
435 my = GetGame().GetWorkspace().DPIUnscale(my);
436
437 if (!m_wServiceHint)
438 {
440 m_wServiceHint = entity.GetMapMenuRoot().FindAnyWidget("ServiceHintRoot");
441 }
442
443 if (show)
444 {
445 FrameSlot.SetPos(m_wServiceHint, mx, my);
446 TextWidget.Cast(m_wServiceHint.FindAnyWidget("ServiceName")).SetTextFormat(name);
447 Widget resupplyText = m_wServiceHint.FindAnyWidget("ResupplyText");
448 if (resupplyText)
449 resupplyText.SetVisible(false);
450
451 if (suppliesAmount > -1 && suppliesMax > -1)
452 {
453 TextWidget serviceText = TextWidget.Cast(m_wServiceHint.FindAnyWidget("ServiceText"));
454 if (serviceText)
455 serviceText.SetTextFormat(text, suppliesAmount, suppliesMax);
456
457 if (resupplyText)
458 resupplyText.SetVisible(suppliesAmount < suppliesMax);
459 }
460 else
461 {
462 TextWidget serviceText = TextWidget.Cast(m_wServiceHint.FindAnyWidget("ServiceText"));
463 if (serviceText)
464 serviceText.SetTextFormat(text);
465 }
466 }
467
468 m_wServiceHint.SetVisible(show)
469 }
470
471 //------------------------------------------------------------------------------------------------
472 override void HandlerAttached(Widget w)
473 {
474 super.HandlerAttached(w);
475
476// SCR_SelectSpawnPointSubMenu.Event_OnSpawnPointChanged.Insert(OnSelected);
477
478 m_wImageOverlay = SizeLayoutWidget.Cast(w.FindAnyWidget("SizeBaseIcon"));
479 m_wBaseOverlay = w.FindAnyWidget("ImageOverlay");
480 m_wInfoOverlay = w.FindAnyWidget("InfoOverlay");
481 m_wServices = w.FindAnyWidget("ServicesFrame");
482 m_w_ServicesOverlay = w.FindAnyWidget("ServicesSizeOverlay");
483
484 m_wBaseFrame = w.FindAnyWidget("BaseFrame");
485 m_wBaseIcon =w.FindAnyWidget("SideSymbol");
486
487 m_wBaseName = TextWidget.Cast(w.FindAnyWidget("Name"));
488 m_wCallsignName = TextWidget.Cast(w.FindAnyWidget("Callsign"));
489
490 m_wBaseNameDialog = TextWidget.Cast(w.FindAnyWidget("m_w_NameDialog"));
491 m_wCallsignNameDialog = TextWidget.Cast(w.FindAnyWidget("Callsign-Dialog"));
492
493
494 m_wInfoText = w.FindAnyWidget("Info");
495 m_wAntennaImg = w.FindAnyWidget("AntenaOff");
496
497 m_wRallyPointIconTop = w.FindAnyWidget("RallyPointIconTop");
498 m_wRallyPointIconBalancer = w.FindAnyWidget("RallyPointIconBalancer");
499 m_wRallyPointIconBottom = w.FindAnyWidget("RallyPointIconBottom");
500 m_wRallyPointText = TextWidget.Cast(w.FindAnyWidget("RallyPointText"));
502 m_wRallyPointText.SetTextFormat("(%1)", m_sRallyPointText);
503
507
508 m_wLocalTask = ImageWidget.Cast(w.FindAnyWidget("LocalTask"));
509 m_wCaptureWarning = OverlayWidget.Cast(w.FindAnyWidget("CaptureWarning"));
510
511 SCR_GameModeCampaign gameMode = SCR_GameModeCampaign.GetInstance();
512 if (gameMode)
513 {
514 SCR_CampaignMobileAssemblyStandaloneComponent.s_OnUpdateRespawnCooldown.Insert(SetIconInfoText);
515 SCR_CampaignMobileAssemblyStandaloneComponent.s_OnSpawnPointOwnerChanged.Insert(UpdateAssemblyIcon);
516 }
517
520
521 m_bIsRespawnMenu = SCR_DeployMenuMain.GetDeployMenu() != null;
522 m_bIsEditor = SCR_EditorManagerEntity.IsOpenedInstance(false);
524 m_PlayerFaction = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
525
526 if (m_wInfoText)
527 m_wSuppliesText = TextWidget.Cast(m_wInfoText.FindAnyWidget("Supplies"));
528
530 }
531
532 //------------------------------------------------------------------------------------------------
536 {
537 RemoveHint();
538 }
539
540 //------------------------------------------------------------------------------------------------
543 {
544 if (m_wServiceHint)
545 m_wServiceHint.RemoveFromHierarchy();
546 m_wServiceHint = null;
547 }
548
549 //------------------------------------------------------------------------------------------------
550 override void HandlerDeattached(Widget w)
551 {
552 RemoveHint();
553
554 if (SCR_GameModeCampaign.GetInstance())
555 {
556 SCR_CampaignMobileAssemblyStandaloneComponent.s_OnUpdateRespawnCooldown.Remove(SetIconInfoText);
557 SCR_CampaignMobileAssemblyStandaloneComponent.s_OnSpawnPointOwnerChanged.Remove(UpdateAssemblyIcon);
558 }
559
563 GetGame().GetCallqueue().Remove(SetNextShipmentText);
564
566 m_ResourceComponent.TEMP_GetOnInteractorReplicated().Remove(UpdateIconAndText);
567
569
571 }
572
573 //------------------------------------------------------------------------------------------------
574 protected bool CanShowOpenButton()
575 {
576 SCR_CampaignFaction faction = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
577 if (!m_Base || faction != m_Base.GetFaction() || m_Base.GetType() == SCR_ECampaignBaseType.SOURCE_BASE)
578 return false;
579
580 return true;
581 }
582
583 //------------------------------------------------------------------------------------------------
584 protected void InitOpenButton(Widget w)
585 {
587 return;
588
589 m_wOpenButton = w.FindAnyWidget(m_sOpenButtonName);
590 if (!m_wOpenButton)
591 return;
592
596
597 m_wOpenButton.SetVisible(CanShowOpenButton());
598 }
599
600 //------------------------------------------------------------------------------------------------
601 protected void DeinitOpenButton(Widget w)
602 {
605 }
606
607 //------------------------------------------------------------------------------------------------
608 protected void OnOpenButtonActivated(SCR_InputButtonComponent button, string action)
609 {
610 m_OnClick.Invoke(this);
611 }
612
613 //------------------------------------------------------------------------------------------------
614 protected void FocusOnBase(SCR_SpawnPoint sp)
615 {
616 OnLeave();
617
618 if (!sp)
619 return;
620
621 IEntity parent = sp.GetParent();
622 if (!parent)
623 return;
624
626 {
627 SelectBase();
628 }
629 else
630 {
632
633 if (base && base == m_Base)
634 SelectBase();
635 }
636 }
637
638 //------------------------------------------------------------------------------------------------
639 protected void OnSelected(SCR_SpawnPoint sp)
640 {
641 if (!sp)
642 return;
643 if (sp == m_SpawnPoint)
644 {
645 m_wRoot.SetZOrder(1);
646 m_wSelectImg.SetVisible(true);
647 if (m_wGradient)
648 m_wGradient.SetVisible(true);
649 }
650 else
651 {
652 m_wRoot.SetZOrder(0);
653 m_wSelectImg.SetVisible(false);
654 if (m_wGradient)
655 m_wGradient.SetVisible(false);
656 }
657 }
658
659 //------------------------------------------------------------------------------------------------
660 protected void ShowServices(bool show)
661 {
662 m_wServices.SetVisible(show);
663 }
664
665 //------------------------------------------------------------------------------------------------
666 protected void ShowBase(bool show)
667 {
668 m_wBaseFrame.SetVisible(show);
669 }
670
671 //------------------------------------------------------------------------------------------------
672 protected void UpdateIconAndText()
673 {
675 SetBaseImage();
676 }
677
678 //------------------------------------------------------------------------------------------------
681 {
682 if (!m_wInfoText)
683 return;
684
686 {
687 m_MobileAssembly.UpdateRespawnCooldown(m_wInfoText);
688 m_MobileAssembly.UpdateSuppliesAmount(m_wInfoText);
689 }
690
691 if (!m_Base)
692 return;
693
694 Faction playerFaction = SCR_FactionManager.SGetLocalPlayerFaction();
695
696 if (!playerFaction)
697 return;
698
700
701 SCR_CampaignFaction baseFaction = m_Base.GetCampaignFaction();
702 ChimeraWorld world = GetGame().GetWorld();
703 float respawnCooldown = Math.Ceil(m_Base.GetRespawnTimestamp().DiffMilliseconds(world.GetServerTimestamp()) * 0.001);
704 string shownRespawnCooldown;
705 int d, h, m, s;
706 string sStr;
707
708 TextWidget respawn = TextWidget.Cast(m_wInfoText.FindAnyWidget("Respawn"));
709 RichTextWidget freq = RichTextWidget.Cast(m_wInfoText.FindAnyWidget("Freq"));
710 TextWidget supplies = TextWidget.Cast(m_wInfoText.FindAnyWidget("Supplies"));
711 ImageWidget respawnImg = ImageWidget.Cast(m_wInfoText.FindAnyWidget("RespawnIMG"));
712 ImageWidget freqImg = ImageWidget.Cast(m_wInfoText.FindAnyWidget("FreqIMG"));
713 ImageWidget suppliesImg = ImageWidget.Cast(m_wInfoText.FindAnyWidget("SuppliesIMG"));
714
715 // Cooldown in progress, update UI timer
716 if (respawnCooldown > 0 && baseFaction && baseFaction == playerFaction && m_Base.GetHQRadioCoverage(baseFaction) == SCR_ERadioCoverageStatus.BOTH_WAYS)
717 {
718 shownRespawnCooldown = "#AR-Campaign_MobileAssemblyCooldown";
719 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(respawnCooldown, d, h, m, s);
720 sStr = string.ToString(s);
721
722 if (s < 10)
723 sStr = "0" + sStr;
724 }
725 else
726 {
727 respawnImg.SetVisible(false);
728 }
729
730 // Compose proper map info based on the base type and ownership
731 LocalizedString suppliesString;
732 string suppliesInfo;
733 int income;
734
735 bool isSupportedBaseType = m_Base.GetType() == SCR_ECampaignBaseType.BASE || m_Base.GetType() == SCR_ECampaignBaseType.SOURCE_BASE;
736 if (isSupportedBaseType)
737 {
738 supplies.SetVisible(true);
739 suppliesImg.SetVisible(true);
740
741 if (baseFaction && baseFaction == playerFaction)
742 {
743 suppliesString = "#AR-Campaign_BaseSuppliesAmount";
744 suppliesInfo = m_Base.GetSupplies().ToString();
745 income = m_Base.GetSuppliesIncome();
746
747 if (!m_Base.IsHQ() && !shownRespawnCooldown.IsEmpty())
748 {
749 respawn.SetVisible(true);
750 respawnImg.SetVisible(true);
751 }
752 }
753 else
754 {
755 suppliesString = "#AR-Campaign_BaseSuppliesUnknown";
756 }
757 }
758
759 ResourceName imageset = m_Base.GetBuildingIconImageset();
760
761 if (!imageset.IsEmpty())
762 {
763 respawnImg.LoadImageFromSet(0, imageset, "RespawnBig");
764 suppliesImg.LoadImageFromSet(0, imageset, "SuppliesBig");
765 }
766
767 if (income > 0)
768 supplies.SetTextFormat(suppliesString + " (+%3)", suppliesInfo, m_Base.GetSuppliesMax(), income);
769 else
770 supplies.SetTextFormat(suppliesString, suppliesInfo, m_Base.GetSuppliesMax());
771
772 respawn.SetTextFormat(shownRespawnCooldown, m, sStr);
773
774 if (suppliesImg)
775 suppliesImg.LoadImageTexture(0, m_sSupplyIcon);
776 }
777
778 //------------------------------------------------------------------------------------------------
781 {
782 Widget w = m_wServices.FindAnyWidget("ServicesSizeOverlay"); //GetGame().GetWorkspace().CreateWidgets(m_sServiceElement, m_wServices);
783 if (!w)
784 return;
785
786 m_wServices.SetVisible(false);
787 m_wServices.SetOpacity(0);
788
789 int cnt = m_mServices.Count();
790 for (int serviceId = 0; serviceId < 8; ++serviceId)
791 {
792 string btnName = "Service" + serviceId.ToString();
793 Widget serviceBtn = w.FindAnyWidget(btnName);
794
795 if (serviceId >= cnt)
796 {
797 serviceBtn.SetVisible(false);
798 continue;
799 }
800
801 SCR_CampaignMapUIService handler = SCR_CampaignMapUIService.Cast(serviceBtn.FindHandler(SCR_CampaignMapUIService));
802 if (handler)
803 {
804 handler.SetParent(this);
805 handler.SetService(m_mServices.GetKey(serviceId), m_mServices.GetElement(serviceId));
806 }
807 }
808 }
809
810 //------------------------------------------------------------------------------------------------
811 protected void InitBaseIcon()
812 {
813 if (!m_Base)
814 return;
815
816 SCR_Faction f;
817 if (m_bIsEditor || m_Base.IsHQ() || (m_PlayerFaction && m_Base.IsHQRadioTrafficPossible(m_PlayerFaction)))
818 {
819 f = m_Base.GetCampaignFaction();
820 }
821
822 Widget w = m_wRoot.FindAnyWidget("rootWidget");
823 if (w)
824 FrameSlot.SetAlignment(w, 0.5, m_fNameOffset);
825
827 SetIconName(m_Base.GetBaseName());
828 SetBaseType(m_Base.GetType());
829 SetBaseImage();
831 }
832
833 //------------------------------------------------------------------------------------------------
834 protected void UpdateResources()
835 {
837 return;
838
839 m_wSuppliesText.SetText(string.ToString(m_ResourceConsumer.GetAggregatedResourceValue()));
840 }
841
842 //------------------------------------------------------------------------------------------------
845 void UpdateBaseIcon(int id)
846 {
847 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
848
849 if (!campaign)
850 return;
851
852 string f = m_sFactionNeutral;
853
854 if (id == 1)
855 f = campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.OPFOR);
856 else if (id == 2)
857 f = campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.BLUFOR);
858 else if (id == 3)
859 f = campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.INDFOR);
860
861 m_sFactionKey = f;
862 SetBaseImage();
863 }
864
865 //------------------------------------------------------------------------------------------------
866 protected void UpdateAssemblyIcon()
867 {
868 if (!m_MobileAssembly)
869 return;
870
872 SetIconFaction(m_MobileAssembly.GetParentFaction());
873
874 string img = string.Format("%1_%2", m_sFactionKey, m_sMobileAssembly);
875 string selectionImg = string.Format("%1_%2_%3", m_sFactionKey, m_sRelay, m_sSelection);
876 SetImage(img);
877 }
878
879 //------------------------------------------------------------------------------------------------
880 protected void SetIconFaction(Faction faction)
881 {
882 if (faction)
883 m_sFactionKey = faction.GetFactionKey();
884 else
886 }
887
888 //------------------------------------------------------------------------------------------------
889 protected void SetBaseImage()
890 {
891 string img;
892
893 if (m_Base.GetType() == SCR_ECampaignBaseType.RELAY)
894 {
895 img = string.Format("%1_%2", m_sFactionKey, m_sRelay);
896 m_fNameOffset = 0.9;
897 }
898 else if (m_Base.IsHQ())
899 {
900 img = string.Format("%1_%2_%3", m_sFactionKey, m_sBase, "Main");
901 m_iServicesPadding = -10;
902 m_fNameOffset = 0.8;
903 }
904 else if (m_Base.IsControlPoint())
905 {
906 img = string.Format("%1_%2_%3", m_sFactionKey, m_sBase, "Major");
908 m_fNameOffset = 0.8;
909 }
910 else if (SCR_CampaignSourceBaseComponent.Cast(m_Base))
911 {
912 img = string.Format("%1_%2", m_sFactionKey, m_sSourceBase);
913 m_fNameOffset = 0.3;
914 }
915 else
916 {
917 img = string.Format("%1_%2_%3", m_sFactionKey, m_sBase, "Small");
918 m_fNameOffset = 0.3;
919 }
920
921 if (img != string.Empty)
922 SetImage(img);
923 }
924
925 //------------------------------------------------------------------------------------------------
929 {
930 m_Base = base;
931
933 InitBaseIcon();
935 InitServices();
937
938 if (m_Base.GetType() != SCR_ECampaignBaseType.RELAY && !m_Base.IsHQ() && !m_Base.IsControlPoint())
939 m_wCallsignName.SetExactFontSize(18);
940
941 if (m_Base.GetType() == SCR_ECampaignBaseType.SOURCE_BASE)
942 m_w_ServicesOverlay.SetVisible(false);
943
944 SCR_CampaignMilitaryBaseMapDescriptorComponent descr = m_Base.GetMapDescriptor();
945
946 if (!descr)
947 return;
948
949 m_MapItem = descr.Item();
950 MapDescriptorProps props = m_MapItem.GetProps();
951 props.SetIconVisible(false);
952 props.SetTextVisible(false);
953 props.Activate(true);
954 props.SetGroupType(EMapDescriptorGroup.MDG_SEPARATE);
955
956 if (!m_wSuppliesText)
957 return;
958
959 IEntity owner = m_Base.GetOwner();
960
961 if (!owner)
962 return;
963
965
966 m_ResourceComponent = SCR_ResourceComponent.FindResourceComponent(owner);
967
969 return;
970
972
974 return;
975
977 m_ResourceSubscriptionHandleConsumer = GetGame().GetResourceSystemSubscriptionManager().RequestSubscriptionListenerHandle(m_ResourceConsumer, m_ResourceInventoryPlayerComponentRplId);
978
979 m_ResourceComponent.TEMP_GetOnInteractorReplicated().Insert(UpdateIconAndText);
980 }
981
982 //------------------------------------------------------------------------------------------------
985 void InitMobile(SCR_CampaignMobileAssemblyStandaloneComponent assembly)
986 {
987 m_MobileAssembly = assembly;
991
993 SCR_SpawnPoint spawnpoint = SCR_SpawnPoint.Cast(m_MobileAssembly.GetOwner());
994 m_w_ServicesOverlay.SetVisible(false);
995 m_wServices.SetVisible(false);
996
997 if (!spawnpoint)
998 {
999 m_w_ServicesOverlay.SetVisible(false);
1000 return;
1001 }
1002
1003 SCR_MapDescriptorComponent descr = SCR_MapDescriptorComponent.Cast(spawnpoint.FindComponent(SCR_MapDescriptorComponent));
1004 if (descr)
1005 {
1006 m_MapItem = descr.Item();
1007 MapDescriptorProps props = m_MapItem.GetProps();
1008 props.SetIconVisible(false);
1009 props.SetTextVisible(false);
1010 props.Activate(true);
1011 props.SetGroupType(EMapDescriptorGroup.MDG_SEPARATE);
1012 m_w_ServicesOverlay.SetVisible(false);
1013 m_wServices.SetVisible(false);
1014 }
1015
1016 IEntity owner = m_MobileAssembly.GetOwner();
1017
1018 if (!owner)
1019 return;
1020
1022
1023 m_ResourceComponent = SCR_ResourceComponent.FindResourceComponent(owner);
1024
1026 return;
1027
1029
1030 if (!m_ResourceConsumer)
1031 return;
1032
1034 m_ResourceSubscriptionHandleConsumer = GetGame().GetResourceSystemSubscriptionManager().RequestSubscriptionListenerHandle(m_ResourceConsumer, m_ResourceInventoryPlayerComponentRplId);
1035
1036 m_ResourceComponent.TEMP_GetOnInteractorReplicated().Insert(SetIconInfoText);
1037 }
1038
1039 //------------------------------------------------------------------------------------------------
1040 protected void OnMapClose(MapConfiguration config)
1041 {
1042 if (m_Base)
1043 m_Base.GetMapDescriptor().OnIconHovered(false);
1044 }
1045
1046 //------------------------------------------------------------------------------------------------
1047 protected void SetIconName(string name)
1048 {
1049 if (m_wBaseName)
1050 {
1051 m_wBaseName.SetText(name);
1052 m_wBaseNameDialog.SetText(name);
1053 m_sName = name;
1054 }
1055 if (m_wCallsignName)
1056 {
1057 string callsign;
1058 if (m_Base)
1059 callsign = m_Base.GetCallsignDisplayNameOnlyUC();
1060
1061 m_wCallsignName.SetText(callsign);
1062 m_wCallsignNameDialog.SetText(callsign);
1063
1064 if (m_Base && m_Base.IsControlPoint())
1065 {
1066 m_wCallsignName.SetColorInt(Color.DARK_MAGENTA);
1067 m_wCallsignNameDialog.SetColorInt(Color.DARK_MAGENTA);
1068 }
1069 }
1070 }
1071
1072 //------------------------------------------------------------------------------------------------
1073 protected void CheckIfCanRespawn()
1074 {
1075 SCR_SpawnPoint spawnPoint;
1076
1077 if (m_Base)
1078 spawnPoint = m_Base.GetSpawnPoint();
1079 if (m_MobileAssembly)
1080 spawnPoint = SCR_SpawnPoint.Cast(m_MobileAssembly.GetOwner());
1081
1082 if (!spawnPoint)
1083 return;
1084
1085 bool enoughSupplies = true;
1086
1087 if (m_Base && !m_Base.IsHQ())
1088 {
1089 if (!m_PlayerFaction)
1090 return;
1091
1092 PlayerController pc = GetGame().GetPlayerController();
1093
1094 if (!pc)
1095 return;
1096
1098
1099 if (!comp)
1100 return;
1101
1103
1104 if (loadout)
1105 {
1106 float loadoutCost = SCR_ArsenalManagerComponent.GetLoadoutCalculatedSupplyCost(loadout, true, -1, m_PlayerFaction, spawnPoint);
1107 enoughSupplies = (m_Base.GetSupplies() >= loadoutCost);
1108 }
1109 }
1110
1111 m_bCanRespawn = (m_PlayerFaction && m_PlayerFaction.GetFactionKey() == spawnPoint.GetFactionKey() && enoughSupplies);
1112 }
1113
1114 //------------------------------------------------------------------------------------------------
1116 {
1118 int curLayer;
1119 if (mapEnt)
1120 curLayer = mapEnt.GetLayerIndex();
1123
1124 if (type == SCR_ECampaignBaseType.RELAY)
1125 m_eIconType = SCR_EIconType.RELAY;
1126 else
1127 {
1128 if (m_PlayerFaction && m_PlayerFaction.GetFactionKey() != m_sFactionKey)
1129 m_eIconType = SCR_EIconType.ENEMY_BASE;
1130 else
1132 }
1133 }
1134
1135 //------------------------------------------------------------------------------------------------
1137 {
1138 array<SCR_ServicePointComponent> available = {};
1139 array<SCR_ServicePointDelegateComponent> built = {};
1140 array<int> allServices = {};
1141
1142 SCR_Enum.GetEnumValues(SCR_EServicePointType, allServices);
1143
1144 if (base)
1145 base.GetServiceDelegates(built);
1146
1147 foreach (SCR_EServicePointType type : allServices)
1148 {
1149 m_mServices.Set(type, null);
1150 }
1151
1152 foreach (SCR_ServicePointDelegateComponent delegate : built)
1153 {
1154 m_mServices.Set(delegate.GetType(), delegate);
1155 }
1156 }
1157
1158 //------------------------------------------------------------------------------------------------
1160 void ChangeBaseIconSize() // Function for getting base services count and setting base size according to the value
1161 {
1162 const int m_iServicesLimit = 8; // Maximum amount of services - used as a max size for base icon resize.
1163 int m_iServicesCount = 1; // Amount of services - it cannot be 0
1164
1165 array<SCR_EServicePointType> checkedTypes =
1166 {
1167 SCR_EServicePointType.ARMORY,
1168 SCR_EServicePointType.HELIPAD,
1169 SCR_EServicePointType.BARRACKS,
1170 SCR_EServicePointType.FUEL_DEPOT,
1171 SCR_EServicePointType.RADIO_ANTENNA,
1172 SCR_EServicePointType.FIELD_HOSPITAL,
1173 SCR_EServicePointType.LIGHT_VEHICLE_DEPOT,
1174 SCR_EServicePointType.HEAVY_VEHICLE_DEPOT
1175 };
1176
1177 foreach (SCR_EServicePointType type : checkedTypes)
1178 {
1179 if (m_Base.GetServiceDelegateByType(type))
1180 m_iServicesCount++;
1181 }
1182
1183 if (m_iServicesCount > m_iServicesLimit)
1184 return;
1185
1186 if (m_Base.GetFaction() == m_PlayerFaction || m_wServices && m_Base.GetType() == SCR_ECampaignBaseType.BASE && m_Base.IsHQRadioTrafficPossible(SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction())))
1187 {
1188 if (m_Base.IsHQ())
1189 {
1191 m_wImageOverlay.SetWidthOverride(m_iBaseSize);
1192 m_wImageOverlay.SetHeightOverride(m_iBaseSize);
1193 return;
1194 }
1195
1196 if (m_Base.GetType() == SCR_ECampaignBaseType.RELAY)
1197 {
1199 m_wImageOverlay.SetWidthOverride(m_iBaseSize);
1200 m_wImageOverlay.SetHeightOverride(m_iBaseSize);
1201 return;
1202 }
1203
1204 m_iBaseSize = Math.Round(m_iDefBaseSize + ((m_iMaxBaseSize - m_iDefBaseSize) / m_iServicesLimit) * m_iServicesCount); //Calculation of new base size
1205 m_wImageOverlay.SetWidthOverride(m_iBaseSize);
1206 m_wImageOverlay.SetHeightOverride(m_iBaseSize);
1207 }
1208 }
1209
1210 //------------------------------------------------------------------------------------------------
1211 override void ShowName(bool visible)
1212 {
1213 m_wBaseName.SetVisible(visible);
1214 m_wCallsignName.SetVisible(visible);
1215 m_wBaseNameDialog.SetVisible(visible);
1216 // m_wCallsignNameDialog.SetVisible(visible);
1217 }
1218
1219 //------------------------------------------------------------------------------------------------
1220 override vector GetPos()
1221 {
1222 if (m_Base)
1223 return m_Base.GetOwner().GetOrigin();
1224
1225 if (m_MobileAssembly)
1226 return m_MobileAssembly.GetOwner().GetOrigin();
1227
1228 return vector.Zero;
1229 }
1230
1231 //------------------------------------------------------------------------------------------------
1234 void ChangeNameSize(bool visible)
1235 {
1236 Widget w = m_wRoot.FindAnyWidget("BaseNameFrame");
1237
1238 if (visible){
1239 m_wCallsignName.SetExactFontSize(24);
1240 if (m_Base.GetType() != SCR_ECampaignBaseType.RELAY && !m_Base.IsHQ() && !m_Base.IsControlPoint())
1241 {
1242 m_fNameOffset = 0.3;
1243 m_wBaseName.SetVisible(true);
1244 m_wCallsignName.SetExactFontSize(18);
1245 }
1246
1247 }
1248 else
1249 {
1250 m_wCallsignName.SetExactFontSize(18);
1251 if (m_Base.GetType() != SCR_ECampaignBaseType.RELAY && !m_Base.IsHQ() && !m_Base.IsControlPoint())
1252 {
1253 m_fNameOffset = 0.7;
1254 m_wBaseName.SetVisible(false);
1255 m_wCallsignName.SetExactFontSize(12);
1256 }
1257 }
1258 }
1259
1260 //------------------------------------------------------------------------------------------------
1264 {
1265 ChangeNameSize(layer <= 3);
1266 }
1267
1268 //------------------------------------------------------------------------------------------------
1272 {
1273 return m_sFactionKey;
1274 }
1275 //------------------------------------------------------------------------------------------------
1282 //------------------------------------------------------------------------------------------------
1289
1290 //------------------------------------------------------------------------------------------------
1294 {
1295 if (!m_wBaseIcon)
1296 return;
1297
1298 Color color;
1299
1300 if (faction)
1301 color = faction.GetFactionColor();
1302 else
1303 color = GetColorForFaction("");
1304
1305 if (!m_wBaseIcon)
1306 return;
1307
1308 m_wBaseIcon.SetColor(color);
1309 if (m_wGradient)
1310 m_wGradient.SetColor(color);
1311 }
1312
1313 //------------------------------------------------------------------------------------------------
1314 override void SetImage(string image)
1315 {
1316 if (!m_wImage)
1317 return;
1318
1319 if (!m_wBaseIcon)
1320 return;
1321
1322 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
1323
1324 if (!campaign)
1325 return;
1326
1327 TStringArray strs = new TStringArray;
1328
1329 image.Split("_", strs, true);
1330
1331 Color factionColor = GetColorForFaction(m_sFactionKey);
1332 m_wBaseIcon.SetColor(factionColor);
1333 if (m_wGradient)
1334 m_wGradient.SetColor(factionColor);
1335
1337 SCR_MilitarySymbol baseIcon = new SCR_MilitarySymbol();
1338 string selection;
1339 string highlight;
1340 SCR_SpawnPoint spawnPoint;
1341
1342 switch (strs.Get(0))
1343 {
1344 case campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.INDFOR):
1345 {
1346 baseIcon.SetIdentity(EMilitarySymbolIdentity.INDFOR);
1347 selection = "Neutral_Select";
1348 highlight = "Neutral_Installation_Focus_Land";
1349 m_wAntennaImg.SetVisible(false);
1350 m_w_NameDialog = TextWidget.Cast(m_wRoot.FindAnyWidget("m_w_NameDialog"));
1351 m_w_NameDialog.SetColor(Color.FromRGBA(0,177,79,255));
1352 break;
1353 }
1354 case campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.OPFOR):
1355 {
1356 baseIcon.SetIdentity(EMilitarySymbolIdentity.OPFOR);
1357 selection = "Hostile_Select";
1358 highlight = "Hostile_Installation_Focus_Land";
1359 m_w_NameDialog = TextWidget.Cast(m_wRoot.FindAnyWidget("m_w_NameDialog"));
1360 m_w_NameDialog.SetColor(Color.FromRGBA(238,49,47,255));
1361 break;
1362 }
1363 case campaign.GetFactionKeyByEnum(SCR_ECampaignFaction.BLUFOR):
1364 {
1365 baseIcon.SetIdentity(EMilitarySymbolIdentity.BLUFOR);
1366 selection = "Friend_Select";
1367 highlight = "Friend_Installation_Focus_Land";
1368 image.Replace("US", "USSR");
1369 m_w_NameDialog = TextWidget.Cast(m_wRoot.FindAnyWidget("m_w_NameDialog"));
1370 m_w_NameDialog.SetColor(Color.FromRGBA(31,195,243,255));
1371 break;
1372 }
1373 case "Unknown":
1374 {
1375 baseIcon.SetIdentity(EMilitarySymbolIdentity.UNKNOWN);
1376 selection = "Unknown_Select";
1377 highlight = "Unknown_Installation_Focus_Land";
1378 m_wAntennaImg.SetVisible(false);
1379 m_w_NameDialog = TextWidget.Cast(m_wRoot.FindAnyWidget("m_w_NameDialog"));
1380 m_w_NameDialog.SetColor(Color.FromRGBA(249,210,103,255));
1381 break;
1382 }
1383 }
1384
1385 switch (strs.Get(1))
1386 {
1387 case "Relay":
1388 {
1389 baseIcon.SetIcons(EMilitarySymbolIcon.RELAY);
1390 m_wImageOverlay.SetWidthOverride(m_iDefRelaySize);
1391 m_wImageOverlay.SetHeightOverride(m_iDefRelaySize);
1392 m_wAntennaImg.SetVisible(false);
1393 break;
1394 }
1395 case "Mobile":
1396 {
1397 baseIcon.SetIcons(EMilitarySymbolIcon.MOBILEHQ | EMilitarySymbolIcon.RELAY);
1398 spawnPoint = SCR_SpawnPoint.Cast(m_MobileAssembly.GetOwner());
1399 m_wAntennaImg.SetVisible(false);
1400 m_wImageOverlay.SetWidthOverride(m_iDefRelaySize);
1401 m_wImageOverlay.SetHeightOverride(m_iDefRelaySize);
1402 break;
1403 }
1404 case "SourceBase":
1405 {
1406 TStringArray highlightSplit = new TStringArray;
1407 spawnPoint = m_Base.GetSpawnPoint();
1408 highlight.Split("_", highlightSplit, true);
1409 if (highlightSplit.Count() >= 2)
1410 highlight = string.Format("%1_%2", highlightSplit.Get(0), highlightSplit.Get(1));
1411
1412 baseIcon.SetIcons(EMilitarySymbolIcon.SUPPLY);
1413 m_wAntennaImg.SetVisible(false);
1414 break;
1415 }
1416 default:
1417 {
1418 spawnPoint = m_Base.GetSpawnPoint();
1419 if (strs.Get(0) != "Unknown")
1420 {
1421 if (m_Base.GetType() != SCR_ECampaignBaseType.SOURCE_BASE && !m_Base.IsHQRadioTrafficPossible(m_Base.GetCampaignFaction(), SCR_ERadioCoverageStatus.BOTH_WAYS) && m_Base.GetFaction() == m_PlayerFaction)
1422 {
1423 m_wAntennaImg.SetVisible(true);
1424 }
1425 else
1426 {
1427 m_wAntennaImg.SetVisible(false);
1428 }
1429 }
1430 if (strs.Get(2) == "Small")
1431 {
1432 m_wImageOverlay.SetWidthOverride(38);
1433 m_wImageOverlay.SetHeightOverride(38);
1434 }
1435 }
1436 }
1437
1438 baseIcon.SetDimension(2);
1439 m_SymbolUI.Update(baseIcon);
1440
1441 m_wHighlightImg.LoadImageFromSet(0, m_sImageSetARO, highlight);
1442 m_wSelectImg.LoadImageFromSet(0, m_sImageSetARO, selection);
1443
1444 if (!spawnPoint)
1445 return;
1446
1447 m_SpawnPoint = spawnPoint;
1449
1450 if (m_bCanRespawn)
1451 {
1452 if (strs.Get(1) == "Mobile")
1453 baseIcon.SetIcons(EMilitarySymbolIcon.RESPAWN | EMilitarySymbolIcon.MOBILEHQ);
1454 else
1455 baseIcon.SetIcons(EMilitarySymbolIcon.RESPAWN);
1456 }
1457
1458 m_SymbolUI.Update(baseIcon);
1459 }
1460
1461 //------------------------------------------------------------------------------------------------
1463 {
1464 if (m_SpawnPoint)
1465 return m_SpawnPoint.GetRplId();
1466 return RplId.Invalid();
1467 }
1468
1469 //------------------------------------------------------------------------------------------------
1472 //------------------------------------------------------------------------------
1473 void SetAntennaIconVisible(bool visible)
1474 {
1475 m_wAntennaImg.SetVisible(visible);
1476 }
1477
1478 //------------------------------------------------------------------------------------------------
1479 protected void SetNextShipmentTextVisible(bool visible)
1480 {
1482 return;
1483
1484 if (visible && m_fNextShipmentTextUpdatePeriod > 0)
1485 {
1486 m_wNextSupplyShipmentWrapper.SetVisible(true);
1488 GetGame().GetCallqueue().CallLater(SetNextShipmentText, m_fNextShipmentTextUpdatePeriod * 1000, true);
1489 }
1490 else
1491 {
1492 m_wNextSupplyShipmentWrapper.SetVisible(false);
1493 GetGame().GetCallqueue().Remove(SetNextShipmentText);
1494 }
1495 }
1496
1497 //------------------------------------------------------------------------------------------------
1498 protected void SetNextShipmentText()
1499 {
1501 return;
1502
1503 ChimeraWorld world = GetGame().GetWorld();
1504 if (!world)
1505 return;
1506
1507 m_wNextSupplyShipmentText.SetTextFormat(NEXT_SHIPMENT_ETA, Math.Ceil(m_Base.GetSuppliesArrivalTime().DiffSeconds(world.GetServerTimestamp()) / 60));
1508 }
1509
1510 //------------------------------------------------------------------------------------------------
1512 {
1513 int playerId = SCR_PlayerController.GetLocalPlayerId();
1514
1515 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1516 if (!groupsManager)
1517 return;
1518
1519 SCR_AIGroup playerGroup = groupsManager.GetPlayerGroup(playerId);
1520 if (!playerGroup || playerGroup != group)
1521 return;
1522
1524 }
1525
1526 //------------------------------------------------------------------------------------------------
1527 protected void OnPlayerAddedToGroup(SCR_AIGroup group, int playerId)
1528 {
1529 if (playerId != SCR_PlayerController.GetLocalPlayerId())
1530 return;
1531
1533 }
1534
1535 //------------------------------------------------------------------------------------------------
1536 protected void SetRallyPointVisibility(SCR_AIGroup playerGroup = null)
1537 {
1538 if (!m_Base)
1539 {
1540 SetRallyPointVisible(false);
1541 return;
1542 }
1543
1545 if (!mapConfig || (mapConfig.MapEntityMode != EMapEntityMode.FULLSCREEN && mapConfig.MapEntityMode != EMapEntityMode.SPAWNSCREEN))
1546 {
1547 SetRallyPointVisible(false);
1548 return;
1549 }
1550
1551 if (!playerGroup)
1552 {
1553 int playerId = SCR_PlayerController.GetLocalPlayerId();
1554
1555 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1556 if (!groupsManager)
1557 {
1558 SetRallyPointVisible(false);
1559 return;
1560 }
1561
1562 playerGroup = groupsManager.GetPlayerGroup(playerId);
1563 if (!playerGroup)
1564 {
1565 SetRallyPointVisible(false);
1566 return;
1567 }
1568 }
1569
1570 SetRallyPointVisible(playerGroup.GetRallyPointId() == m_Base.GetCallsign());
1571 }
1572
1573 //------------------------------------------------------------------------------------------------
1574 protected void SetRallyPointVisible(bool visible)
1575 {
1577 m_wRallyPointIconTop.SetVisible(visible);
1578
1580 m_wRallyPointIconBottom.SetVisible(visible);
1581
1583 {
1584 bool hasCallsign = m_wCallsignName && m_wCallsignName.GetText() != string.Empty;
1585 m_wRallyPointIconBalancer.SetVisible(visible && hasCallsign);
1586 }
1587
1589 m_wRallyPointText.SetVisible(visible);
1590 }
1591
1592 //------------------------------------------------------------------------------------------------
1593 // destructor
1595 {
1596 s_SelectedElement = null;
1598 }
1599};
EMilitarySymbolIdentity
EMilitarySymbolIcon
ArmaReforgerScripted GetGame()
Definition game.c:1398
LayerPresets layer
EDamageType type
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
bool GetSuppliesAutoRegenerationEnabled()
SCR_MilitarySymbolUIComponent m_SymbolUI
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
EMapEntityMode
Mode of the map.
SCR_EIconType
EResourceGeneratorID
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
Definition Color.c:13
proto external Managed FindComponent(typename typeName)
Definition Math.c:13
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14
static ScriptInvoker GetOnPlayerAdded()
static ScriptInvokerBase< ScriptInvokerAIGroup > GetOnGroupRallyPointChanged()
void SetRallyPointVisible(bool visible)
ref map< EEditableEntityLabel, SCR_ServicePointDelegateComponent > m_mServices
ref ScriptInvoker m_OnMapIconEnter
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override void ShowName(bool visible)
void InitMobile(SCR_CampaignMobileAssemblyStandaloneComponent assembly)
override void HandlerAttached(Widget w)
void OnSelected(SCR_SpawnPoint sp)
void InitBase(SCR_CampaignMilitaryBaseComponent base)
static ref ScriptInvoker Event_OnIconUpdated
void FlashBaseIcon(Faction faction=null, bool changeToDefault=false)
void SetBaseServices(SCR_CampaignMilitaryBaseComponent base)
override void HandlerDeattached(Widget w)
SCR_InputButtonComponent m_OpenInputButtonComponent
void OnMapCloseInvoker(MapConfiguration config)
void ChangeNameSize(bool visible)
SCR_CampaignMilitaryBaseComponent GetBase()
override bool OnClick(Widget w, int x, int y, int button)
ref SCR_ResourceSystemSubscriptionHandleBase m_ResourceSubscriptionHandleConsumer
SCR_CampaignMobileAssemblyStandaloneComponent m_MobileAssembly
SCR_ResourceComponent m_ResourceComponent
static const LocalizedString NEXT_SHIPMENT_ETA
void OnPlayerAddedToGroup(SCR_AIGroup group, int playerId)
void SetCaptureWarning(bool isEnabled)
SizeLayoutWidget m_wImageOverlay
LocalizedString m_sRallyPointText
void ShowServiceHint(string name, string text, bool show, int suppliesAmount=-1, int suppliesMax=-1)
void OnMapClose(MapConfiguration config)
void SetBaseType(SCR_ECampaignBaseType type)
void ChangeNameSizeOnLayerChange(int layer)
void SetNextShipmentTextVisible(bool visible)
void FocusOnBase(SCR_SpawnPoint sp)
void OnOpenButtonActivated(SCR_InputButtonComponent button, string action)
static const float OPACITY_DISABLED
override bool OnMouseEnter(Widget w, int x, int y)
SCR_CampaignFaction m_PlayerFaction
override void SelectIcon(bool invoke=true)
SCR_CampaignMilitaryBaseComponent m_Base
override void SetImage(string image)
void SetBaseIconFactionColor(Faction faction)
ref ScriptInvoker m_OnBaseSelected
static const float OPACITY_UNSELECTED
void SetRallyPointVisibility(SCR_AIGroup playerGroup=null)
ref ScriptInvoker m_OnMapIconClick
void SetAntennaIconVisible(bool visible)
void SetIconFaction(Faction faction)
void OnGroupRallyPointChanged(SCR_AIGroup group)
SCR_ResourceConsumer m_ResourceConsumer
void SetService(EEditableEntityLabel type, SCR_ServicePointDelegateComponent service)
void SetParent(SCR_CampaignMapUIBase parent)
static bool IsEditMode()
Definition Functions.c:1566
void SetHoveredBase(SCR_CampaignMilitaryBaseComponent base)
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapClose()
Get on map close invoker.
Widget GetMapMenuRoot()
Get map menu root widget.
MapConfiguration GetMapConfig()
Get map config.
static ScriptInvokerInt GetOnLayerChanged()
Get on layer changed invoker.
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Color GetColorForFaction(string factionKey)
SCR_EIconType m_eIconType
ResourceName m_sImageSetARO
static SCR_MapUIElement s_SelectedElement
const float ANIM_SPEED
void PlayHoverSound(string sound)
ImageWidget m_wSelectImg
SCR_MapUIElementContainer m_Parent
ImageWidget m_wGradient
ImageWidget m_wHighlightImg
void Select(bool select=true)
void SetDimension(EMilitarySymbolDimension dimension)
void SetIcons(EMilitarySymbolIcon icons)
void SetIdentity(EMilitarySymbolIdentity identity)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Spawn point entity defines positions on which players can possibly spawn.
string GetFactionKey()
static SCR_TaskManagerUIComponent GetInstance()
Definition Types.c:486
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()
EMapDescriptorGroup
array< string > TStringArray
Definition Types.c:385
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134