Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ButtonSpecializationProgressComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
7
8 protected const float m_fMinValue = 0;
9 protected const float m_fMaxValue = 100;
10
11 protected int m_ibuttonId;
12
13 [Attribute()]
14 protected bool m_bIsActive;
15
16 [Attribute("1 1 1 1", UIWidgets.ColorPicker)]
17 protected ref Color m_ColorInactive;
18
19 [Attribute("1 1 1 0.3", UIWidgets.ColorPicker)]
21
22 [Attribute("0.898 0.541 0.184 1", UIWidgets.ColorPicker)]
23 protected ref Color m_ColorActive;
24
25 // Arguments passed: m_ibuttonId
27
28 // Arguments passed: m_ibuttonId, bool isHovered
31
32 //------------------------------------------------------------------------------------------------
33 protected override void HandlerAttached(Widget w)
34 {
35 super.HandlerAttached(w);
36
37 m_wSpecializationTitle = RichTextWidget.Cast(w.FindAnyWidget("SpecializationTitle"));
39 return;
40
41 m_wSpecializationValue = RichTextWidget.Cast(w.FindAnyWidget("SpecializationValue"));
43 return;
44
45 m_wSpecializationTitle.SetText("");
47 m_wSpecializationValue.SetText("");
49
52 return;
53
56 m_SpecializationBar.SetActive(false);
57 }
58
59 //------------------------------------------------------------------------------------------------
61 {
62 return m_OnClicked;
63 }
64
65 //------------------------------------------------------------------------------------------------
66 protected override bool OnClick(Widget w, int x, int y, int button)
67 {
68 super.OnClick(w, x, y, button);
69 if (button != 0)
70 return false;
71
73
74 return false;
75 }
76
77 //------------------------------------------------------------------------------------------------
103
104 //------------------------------------------------------------------------------------------------
130
131 //------------------------------------------------------------------------------------------------
132 protected override bool OnMouseEnter(Widget w, int x, int y)
133 {
134 super.OnMouseEnter(w, x, y);
135 m_OnMouseEnter.Invoke(m_ibuttonId, true);
136 return false;
137 }
138
139 //------------------------------------------------------------------------------------------------
140 protected override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
141 {
142 super.OnMouseLeave(w, enterW, x, y);
143
144 m_OnMouseLeave.Invoke(m_ibuttonId, false);
145 return false;
146 }
147
148 //------------------------------------------------------------------------------------------------
149 void Hide()
150 {
151 m_wSpecializationValue.SetOpacity(0);
152 m_wSpecializationTitle.SetOpacity(0);
153 m_SpecializationBar.Hide();
154 }
155
156 //------------------------------------------------------------------------------------------------
157 void Unhide()
158 {
159 m_wSpecializationValue.SetOpacity(255);
160 m_wSpecializationTitle.SetOpacity(255);
161 m_SpecializationBar.Unhide();
162 }
163
164 //------------------------------------------------------------------------------------------------
182
183 //------------------------------------------------------------------------------------------------
188
189 //------------------------------------------------------------------------------------------------
194
195 //------------------------------------------------------------------------------------------------
196 void SetTitle(string text)
197 {
199 return;
200
201 m_wSpecializationTitle.SetText(text);
202 }
203
204 //------------------------------------------------------------------------------------------------
205 void SetValue(float num)
206 {
208 return;
209
210 m_wSpecializationValue.SetText(""+num.ToString(-1, 2)+"%");
211
212 m_SpecializationBar.SetValue(num);
213 }
214
215 //------------------------------------------------------------------------------------------------
216 void SetButtonId(int n)
217 {
219 {
220 Print ("SCR_ButtonSpecializationProgress: Trying to create a Specialization Progress button for a non-valid specialization id", LogLevel.ERROR);
221 return;
222 }
223
224 m_ibuttonId = n;
225 SetTitle(""+(n+1)+". "+"#AR-CareerProfile_Specialization"+(n+1));
226 }
227
228 //------------------------------------------------------------------------------------------------
229 void SetFocus()
230 {
231 WorkspaceWidget workspace = GetGame().GetWorkspace();
232 if (!workspace)
233 return;
234
235 GetGame().GetCallqueue().CallLater(workspace.SetFocusedWidget, 1000, false, m_wRoot, true);
236 }
237
238 //------------------------------------------------------------------------------------------------
240 {
241 return m_ibuttonId;
242 }
243};
ArmaReforgerScripted GetGame()
Definition game.c:1398
void OnHover(EEditableEntityState state, set< SCR_EditableEntityComponent > entitiesInsert, set< SCR_EditableEntityComponent > entitiesRemove)
static bool StopAnimation(Widget w, typename typeName)
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition Color.c:13
override bool OnClick(Widget w, int x, int y, int button)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
static SCR_PlayerDataConfigs GetInstance()
Base class for all final Reforger interactive elements.
Minimalist progress bar.
static SCR_WLibProgressBarComponent GetProgressBar(string name, Widget parent, bool searchAllChildren=true)
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
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134