Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_InventoryProgressBar.c
Go to the documentation of this file.
2{
3 [Attribute("0 0 0 1")]
4 protected ref Color m_ColorLow;
5
6 [Attribute("0.5 0.5 0.5 1")]
7 protected ref Color m_ColorMiddle;
8
9 [Attribute("1 1 1 1")]
10 protected ref Color m_ColorHigh;
11
12 [Attribute("0 1 0 1")]
14
15 [Attribute("1 0 0 1")]
17
18 [Attribute("1")]
19 protected bool m_bFlipColors;
20
21 [Attribute("ProgressBar")]
22 protected string m_sProgressBarName;
23
24 [Attribute("ProgressBarTemp")]
25 protected string m_sProgressBarNamePreview;
26
29 protected bool m_bColorsFlipped;
30
31 protected const float LOW_TRESHOLD = 0.3;
32 protected const float MID_DIFF = 0.05;
33 protected const float HIGH_TRESHOLD = 0.8;
34
35 //------------------------------------------------------------------------------------------------
36 override void HandlerAttached(Widget w)
37 {
39 if (!m_wProgressBar)
40 {
42 if (!m_wProgressBar)
43 {
44 Print("Cannot find ProgressBarWidget in the hierarchy.", LogLevel.ERROR);
45 return;
46 }
47 }
48
51 {
54 {
55 Print("Cannot find ProgressBarWidget in the hierarchy.", LogLevel.ERROR);
56 return;
57 }
58 }
59
60 if (m_bFlipColors)
61 {
62 Color temp = m_ColorHigh;
64 m_ColorLow = temp;
65 }
66
68
70 }
71
72 void SetProgressRange(float min, float max)
73 {
74 if (!m_wProgressBar || !m_wProgressBarPreview || max <= 0)
75 return;
76
77 m_wProgressBar.SetMin(min);
78 m_wProgressBar.SetMax(max);
79
80 m_wProgressBarPreview.SetMin(min);
81 m_wProgressBarPreview.SetMax(max);
82
84 }
85
86 void SetCurrentProgress(float progress)
87 {
88 if (!m_wProgressBar)
89 return;
90
91 m_wProgressBar.SetCurrent(progress);
93 }
94
95 void SetCurrentProgressPreview(float progress)
96 {
98 return;
99
100 m_wProgressBarPreview.SetCurrent(progress);
101 }
102
103 void SetPreviewColor(bool enabled)
104 {
105 if (enabled)
107 else
109 }
110
112 {
114 return;
115
116 Color temp = m_ColorHigh;
118 m_ColorLow = temp;
119 m_bColorsFlipped = true;
120
122 }
123
124 protected void UpdateProgressBar()
125 {
126 float progress01 = Math.InverseLerp(m_wProgressBar.GetMin(), m_wProgressBar.GetMax(), m_wProgressBar.GetCurrent());
127 if (progress01 < 0.5)
128 {
129 m_wProgressBar.SetColor(m_ColorLow.LerpNew(m_ColorMiddle, Math.InverseLerp(LOW_TRESHOLD, 0.5 - MID_DIFF, Math.Clamp(progress01, LOW_TRESHOLD, 0.5 - MID_DIFF))));
130 }
131 else
132 {
133 m_wProgressBar.SetColor(m_ColorMiddle.LerpNew(m_ColorHigh, Math.InverseLerp(0.5 + MID_DIFF, HIGH_TRESHOLD, Math.Clamp(progress01, 0.5 + MID_DIFF, HIGH_TRESHOLD))));
134 }
135 }
136}
Definition Color.c:13
Definition Math.c:13
void SetCurrentProgressPreview(float progress)
void SetProgressRange(float min, float max)
override void HandlerAttached(Widget w)
void SetCurrentProgress(float progress)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute