Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MapDotCircleHandler.c
Go to the documentation of this file.
2{
3 [Attribute(defvalue: "", desc: "Dot layout resource", uiwidget: UIWidgets.ResourcePickerThumbnail, params: "layout")]
5
6 protected float m_fActualRadius;
7 protected Widget m_wFrame;
9 protected ref array<Widget> m_aDots = {};
10 protected SCR_MapMarkerDotCircle m_DotMarkerEnt;
11
12 protected float m_fEnlargement;
13
14 //------------------------------------------------------------------------------------------------
15 void OnMapZoom(float ppu)
16 {
17 if (!m_DotMarkerEnt)
18 return;
19
20 m_fActualRadius = m_DotMarkerEnt.m_fRadius * ppu;
21
22 CreateDots();
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override void SetImage(ResourceName icon, string quad, float aspectRatio = 1, int sizeFlag = 64)
27 {
28 if (!m_wMarkerIcon)
29 return;
30
31 super.SetImage(icon, quad, aspectRatio, sizeFlag);
32 }
33
34 //------------------------------------------------------------------------------------------------
36 override void SetText(string text)
37 {
38 if (!m_wMarkerText)
39 return;
40
41 super.SetText(text);
42 }
43
44 //------------------------------------------------------------------------------------------------
46 override void SetMarkerEntity(notnull SCR_MapMarkerEntity marker)
47 {
48 m_DotMarkerEnt = SCR_MapMarkerDotCircle.Cast(marker);
49 if (!m_DotMarkerEnt)
50 return;
51
52 OnMapZoom(m_MapEnt.GetCurrentZoom());
53 m_MapEnt.GetOnMapZoom().Insert(OnMapZoom);
54
55 CreateDots();
56 }
57
58 //------------------------------------------------------------------------------------------------
59 override void HandlerAttached(Widget w)
60 {
61 super.HandlerAttached(w);
62 m_wFrame = w.FindAnyWidget("DotFrame");
63
65 if (!m_MapEnt)
66 return;
67 }
68
69 //------------------------------------------------------------------------------------------------
71 {
72 if (!m_wFrame || !m_DotMarkerEnt)
73 return;
74
75 foreach (Widget dot : m_aDots)
76 {
77 dot.RemoveFromHierarchy();
78 }
79
80 m_aDots.Clear();
81
82 int dots = m_DotMarkerEnt.m_fRadius * m_DotMarkerEnt.m_fDotDensity;
83 if (dots < 1)
84 return;
85
86 float angleIncrement = 2 * Math.PI / dots;
87 float angle, x, y;
88
89 ImageWidget dot;
90 for (int i = 0; i < dots; i++)
91 {
92 angle = i * angleIncrement;
93 x = m_fActualRadius * Math.Cos(angle);
94 y = m_fActualRadius * Math.Sin(angle);
95
96 dot = ImageWidget.Cast(GetGame().GetWorkspace().CreateWidgets(m_sDotResource, m_wFrame));
97
98 dot.SetColor(m_DotMarkerEnt.m_DotColor);
99
100 FrameSlot.SetPos(dot, x, y);
101
102 m_aDots.Insert(dot);
103 }
104 }
105}
ArmaReforgerScripted GetGame()
Definition game.c:1398
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
override void HandlerAttached(Widget w)
override void SetImage(ResourceName icon, string quad, float aspectRatio=1, int sizeFlag=64)
SCR_MapMarkerDotCircle m_DotMarkerEnt
override void SetText(string text)
override void SetMarkerEntity(notnull SCR_MapMarkerEntity marker)
static SCR_MapEntity GetMapInstance()
Get map entity instance.
Attached to root of marker dynamic base layout.
SCR_FieldOfViewSettings Attribute