Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ProgressBarWithSegments.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute(defvalue: "0.761 0.386 0.08 0.059", desc: "Progressed Bar Color")]
6
7 [Attribute(defvalue: "0.761 0.484 0.199 1", desc: "Minus Bar Color")]
8 protected ref Color m_iMinusBarColor;
9
10 [Attribute("0.0")]
11 protected float m_fProgressed;
12
13 [Attribute("0.0")]
14 protected float m_fMinus;
15
16
19
20 //------------------------------------------------------------------------------------------------
21 override void HandlerAttached(Widget w)
22 {
23 super.HandlerAttached(w);
24 m_wRoot.SetVisible(false);
25
26 m_wProgressedBar = w.FindAnyWidget("ProgressedBar");
27 m_wMinusBar = w.FindAnyWidget("MinusBar");
28
30 {
33 m_wBar.SetZOrder(1);
34 }
35
36 if (m_wMinusBar)
37 {
40 m_wBar.SetZOrder(1);
41 }
42 }
43
44 //------------------------------------------------------------------------------------------------
45 protected override void UpdateVisuals(bool animate = true)
46 {
48 return;
49
50 float original, progressed, minus;
51
52 float range = m_fMax - m_fMin;
53 if (range <= 0)
54 return;
55
56 original = m_fValue / range;
57 progressed = m_fProgressed / range;
58 minus = m_fMinus / range;
59
60 original = Math.Clamp(original, 0, 1);
61 progressed = Math.Clamp(progressed, 0, 1);
62 minus = Math.Clamp(minus, 0, 1);
63
64 HorizontalLayoutSlot.SetFillWeight(m_wBar, original);
65 HorizontalLayoutSlot.SetFillWeight(m_wSpacer, 1 - original - progressed - minus);
66
67 if (progressed < original/1000)
68 {
69 m_wProgressedBar.SetVisible(false);
70 m_wProgressedBar.SetEnabled(false);
71 }
72 else
73 {
74 m_wProgressedBar.SetVisible(true);
75 m_wProgressedBar.SetEnabled(true);
76 HorizontalLayoutSlot.SetFillWeight(m_wProgressedBar, progressed);
77 }
78
79 if (minus < original/1000)
80 {
81 m_wMinusBar.SetVisible(false);
82 m_wMinusBar.SetEnabled(false);
83 }
84 else
85 {
86 m_wMinusBar.SetVisible(true);
87 m_wMinusBar.SetEnabled(true);
88 HorizontalLayoutSlot.SetFillWeight(m_wMinusBar, minus);
89 }
90
91 m_wRoot.SetVisible(true);
92 }
93
94 //------------------------------------------------------------------------------------------------
95 void SetProgressBarValues (float value, float progressed, float minus)
96 {
97 m_fValue = value;
98 m_fProgressed = progressed;
99 m_fMinus = minus;
101 }
102
103 //------------------------------------------------------------------------------------------------
104 override void SetValue(float value, bool animate = true)
105 {
106 super.SetValue(value, animate);
107
108 if (m_wProgressedBar){
109 m_wProgressedBar.SetVisible(false);
110 m_wProgressedBar.SetEnabled(false);
111 }
112
113 if (m_wMinusBar){
114 m_wMinusBar.SetVisible(false);
115 m_wMinusBar.SetEnabled(false);
116 }
117 }
118};
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Color.c:13
Definition Math.c:13
override void UpdateVisuals(bool animate=true)
void SetProgressBarValues(float value, float progressed, float minus)
override void SetValue(float value, bool animate=true)
Minimalist progress bar.
SCR_FieldOfViewSettings Attribute