Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BudgetProgressEditorUIComponent.c
Go to the documentation of this file.
2 {
3  [Attribute("")]
4  protected string m_sProgressBar;
5 
6  [Attribute("")]
7  protected string m_sProgressText;
8 
9  [Attribute("")]
10  protected string m_sProgressAddText;
11 
12  [Attribute("")]
13  protected string m_sIcon;
14 
15  protected SCR_WLibProgressBarComponent m_wProgressBar;
16  protected TextWidget m_wProgressText;
17  protected TextWidget m_wProgressAddText;
18  protected ImageWidget m_wIcon;
19 
20  //------------------------------------------------------------------------------------------------
21  // Override
22  //------------------------------------------------------------------------------------------------
23 
24  //------------------------------------------------------------------------------------------------
25  override void HandlerAttached(Widget w)
26  {
27  super.HandlerAttached(w);
28 
29  m_wProgressBar = SCR_WLibProgressBarComponent.Cast(SCR_WLibProgressBarComponent.GetProgressBar(m_sProgressBar, w));
30  m_wProgressText = TextWidget.Cast(w.FindAnyWidget(m_sProgressText));
31  m_wProgressAddText = TextWidget.Cast(w.FindAnyWidget(m_sProgressAddText));
32  m_wIcon = ImageWidget.Cast(w.FindAnyWidget(m_sIcon));
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  // Public
37  //------------------------------------------------------------------------------------------------
38 
39  //------------------------------------------------------------------------------------------------
42  void ShowBudget(float value)
43  {
44  m_wProgressBar.SetValue(value);
45 
46  float perc = Math.Floor(value * 100);
47  m_wProgressText.SetText(perc.ToString() + "%");
48  }
49 
50  //------------------------------------------------------------------------------------------------
54  void ShowBudgetChange(float value, int currentBudget)
55  {
56  m_wProgressAddText.SetVisible(true);
57  m_wProgressBar.SetChange(value * 0.01);
58 
59  float perc = Math.Floor(value);
60 
61  if (value < 0)
62  m_wProgressAddText.SetText(perc.ToString() + "%");
63  else if (value > 1)
64  m_wProgressAddText.SetText("+" + perc.ToString() + "%");
65  else
66  m_wProgressAddText.SetText("+<1%");
67 
68  // Colorize progress change
69  if (currentBudget > 100)
70  {
71  m_wProgressAddText.SetColor(Color.FromInt(UIColors.WARNING.PackToInt()));
72  m_wProgressBar.SetSliderChangeColor(Color.FromInt(UIColors.WARNING.PackToInt()));
73  }
74  else
75  {
76  m_wProgressAddText.SetColor(Color.FromInt(UIColors.CONFIRM.PackToInt()));
77  m_wProgressBar.SetSliderChangeColor(Color.FromInt(UIColors.CONFIRM.PackToInt()));
78  }
79  }
80 
81  //------------------------------------------------------------------------------------------------
83  void HideBudgetChange()
84  {
85  m_wProgressAddText.SetVisible(false);
86  m_wProgressBar.SetChange(0);
87  }
88 
89  //------------------------------------------------------------------------------------------------
90  void SetIconTexture(ResourceName resource, string image = "")
91  {
92  if (resource.EndsWith("imageset"))
93  m_wIcon.LoadImageFromSet(0, resource, image);
94  else
95  m_wIcon.LoadImageTexture(0, resource);
96  }
97 
98  //------------------------------------------------------------------------------------------------
100  ImageWidget GetIconWidhget()
101  {
102  return m_wIcon;
103  }
104 }
m_wIcon
protected ImageWidget m_wIcon
Definition: SCR_InventoryHitZonePointUI.c:374
SCR_BudgetProgressEditorUIComponent
Definition: SCR_BudgetProgressEditorUIComponent.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
UIColors
Definition: Constants.c:16
SCR_WLibProgressBarComponent
Minimalist progress bar.
Definition: SCR_WLibProgressBar.c:3
SCR_ScriptedWidgetComponent
Definition: SCR_ScriptedWidgetComponent.c:7
m_sIcon
protected string m_sIcon
Definition: SCR_InventoryHitZonePointUI.c:373