4 [
Attribute(defvalue:
"0.761 0.386 0.08 0.059",
desc:
"Progressed Bar Color")]
5 protected ref Color m_iProgressedBarColor;
7 [
Attribute(defvalue:
"0.761 0.484 0.199 1",
desc:
"Minus Bar Color")]
8 protected ref Color m_iMinusBarColor;
11 protected float m_fProgressed;
14 protected float m_fMinus;
17 protected Widget m_wProgressedBar;
18 protected Widget m_wMinusBar;
21 override void HandlerAttached(Widget w)
23 super.HandlerAttached(w);
26 m_wProgressedBar = w.FindAnyWidget(
"ProgressedBar");
27 m_wMinusBar = w.FindAnyWidget(
"MinusBar");
31 m_wProgressedBar.SetColor(m_iProgressedBarColor);
32 if (m_bReverseDirection)
38 m_wMinusBar.SetColor(m_iMinusBarColor);
39 if (m_bReverseDirection)
45 protected override void UpdateVisuals(
bool animate =
true)
47 if (!m_wSpacer || !m_wBar || !m_wProgressedBar || !m_wMinusBar)
50 float original, progressed, minus;
56 original = m_fValue / range;
57 progressed = m_fProgressed / range;
58 minus = m_fMinus / range;
60 original = Math.Clamp(original, 0, 1);
61 progressed = Math.Clamp(progressed, 0, 1);
62 minus = Math.Clamp(minus, 0, 1);
64 HorizontalLayoutSlot.SetFillWeight(m_wBar, original);
65 HorizontalLayoutSlot.SetFillWeight(m_wSpacer, 1 - original - progressed - minus);
67 if (progressed < original/1000)
69 m_wProgressedBar.SetVisible(
false);
70 m_wProgressedBar.SetEnabled(
false);
74 m_wProgressedBar.SetVisible(
true);
75 m_wProgressedBar.SetEnabled(
true);
76 HorizontalLayoutSlot.SetFillWeight(m_wProgressedBar, progressed);
79 if (minus < original/1000)
81 m_wMinusBar.SetVisible(
false);
82 m_wMinusBar.SetEnabled(
false);
86 m_wMinusBar.SetVisible(
true);
87 m_wMinusBar.SetEnabled(
true);
88 HorizontalLayoutSlot.SetFillWeight(m_wMinusBar, minus);
95 void SetProgressBarValues (
float value,
float progressed,
float minus)
98 m_fProgressed = progressed;
104 override void SetValue(
float value,
bool animate =
true)
106 super.SetValue(value, animate);
108 if (m_wProgressedBar){
109 m_wProgressedBar.SetVisible(
false);
110 m_wProgressedBar.SetEnabled(
false);
114 m_wMinusBar.SetVisible(
false);
115 m_wMinusBar.SetEnabled(
false);