4 protected string m_sProgressBar;
7 protected string m_sProgressText;
10 protected string m_sProgressAddText;
13 protected string m_sIcon;
16 protected TextWidget m_wProgressText;
17 protected TextWidget m_wProgressAddText;
18 protected ImageWidget m_wIcon;
25 override void HandlerAttached(Widget w)
27 super.HandlerAttached(w);
30 m_wProgressText = TextWidget.Cast(w.FindAnyWidget(m_sProgressText));
31 m_wProgressAddText = TextWidget.Cast(w.FindAnyWidget(m_sProgressAddText));
42 void ShowBudget(
float value)
44 m_wProgressBar.SetValue(value);
46 float perc = Math.Floor(value * 100);
47 m_wProgressText.SetText(perc.ToString() +
"%");
54 void ShowBudgetChange(
float value,
int currentBudget)
56 m_wProgressAddText.SetVisible(
true);
57 m_wProgressBar.SetChange(value * 0.01);
59 float perc = Math.Floor(value);
62 m_wProgressAddText.SetText(perc.ToString() +
"%");
64 m_wProgressAddText.SetText(
"+" + perc.ToString() +
"%");
66 m_wProgressAddText.SetText(
"+<1%");
69 if (currentBudget > 100)
71 m_wProgressAddText.SetColor(Color.FromInt(
UIColors.WARNING.PackToInt()));
72 m_wProgressBar.SetSliderChangeColor(Color.FromInt(
UIColors.WARNING.PackToInt()));
76 m_wProgressAddText.SetColor(Color.FromInt(
UIColors.CONFIRM.PackToInt()));
77 m_wProgressBar.SetSliderChangeColor(Color.FromInt(
UIColors.CONFIRM.PackToInt()));
83 void HideBudgetChange()
85 m_wProgressAddText.SetVisible(
false);
86 m_wProgressBar.SetChange(0);
90 void SetIconTexture(ResourceName resource,
string image =
"")
92 if (resource.EndsWith(
"imageset"))
93 m_wIcon.LoadImageFromSet(0, resource, image);
95 m_wIcon.LoadImageTexture(0, resource);
100 ImageWidget GetIconWidhget()