Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_ButtonSpecializationProgressComponent.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
class
SCR_ButtonSpecializationProgressComponent
:
SCR_WLibComponentBase
3
{
4
protected
RichTextWidget
m_wSpecializationTitle
;
5
protected
RichTextWidget
m_wSpecializationValue
;
6
protected
SCR_ProgressBarWithInactiveColor
m_SpecializationBar
;
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)]
20
protected
ref
Color
m_ColorInactiveHovered
;
21
22
[
Attribute
(
"0.898 0.541 0.184 1"
,
UIWidgets
.ColorPicker)]
23
protected
ref
Color
m_ColorActive
;
24
25
// Arguments passed: m_ibuttonId
26
protected
ref
ScriptInvoker
m_OnClicked
=
new
ScriptInvoker
();
27
28
// Arguments passed: m_ibuttonId, bool isHovered
29
protected
ref
ScriptInvoker
m_OnMouseEnter
=
new
ScriptInvoker
();
30
protected
ref
ScriptInvoker
m_OnMouseLeave
=
new
ScriptInvoker
();
31
32
//------------------------------------------------------------------------------------------------
33
protected
override
void
HandlerAttached
(
Widget
w)
34
{
35
super.HandlerAttached(w);
36
37
m_wSpecializationTitle
=
RichTextWidget
.Cast(w.FindAnyWidget(
"SpecializationTitle"
));
38
if
(!
m_wSpecializationTitle
)
39
return
;
40
41
m_wSpecializationValue
=
RichTextWidget
.Cast(w.FindAnyWidget(
"SpecializationValue"
));
42
if
(!
m_wSpecializationValue
)
43
return
;
44
45
m_wSpecializationTitle
.SetText(
""
);
46
m_wSpecializationTitle
.SetColor(
m_ColorInactive
);
47
m_wSpecializationValue
.SetText(
""
);
48
m_wSpecializationValue
.SetColor(
m_ColorInactive
);
49
50
m_SpecializationBar
=
SCR_ProgressBarWithInactiveColor
.Cast(
SCR_WLibProgressBarComponent
.
GetProgressBar
(
"SpecializationProgressBar"
, w,
true
));
51
if
(!
m_SpecializationBar
)
52
return
;
53
54
m_SpecializationBar
.SetMin(
m_fMinValue
);
55
m_SpecializationBar
.SetMax(
m_fMaxValue
);
56
m_SpecializationBar
.SetActive(
false
);
57
}
58
59
//------------------------------------------------------------------------------------------------
60
ScriptInvoker
GetOnClicked
()
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
72
m_OnClicked
.Invoke(
m_ibuttonId
);
73
74
return
false
;
75
}
76
77
//------------------------------------------------------------------------------------------------
78
void
Activate
(
bool
animate =
true
)
79
{
80
if
(
m_bIsActive
)
81
return
;
82
83
m_bIsActive
=
true
;
84
PlaySound
(
m_sSoundClicked
);
85
86
if
(animate)
87
{
88
AnimateWidget
.
Color
(
m_wSpecializationValue
,
m_ColorActive
,
m_fAnimationRate
);
89
AnimateWidget
.
Color
(
m_wSpecializationTitle
,
m_ColorActive
,
m_fAnimationRate
);
90
m_SpecializationBar
.SetActive(
true
);
91
}
92
else
93
{
94
AnimateWidget
.
StopAnimation
(
m_wSpecializationValue
,
WidgetAnimationColor
);
95
m_wSpecializationValue
.SetColor(
m_ColorActive
);
96
97
AnimateWidget
.
StopAnimation
(
m_wSpecializationTitle
,
WidgetAnimationColor
);
98
m_wSpecializationTitle
.SetColor(
m_ColorActive
);
99
100
m_SpecializationBar
.SetActive(
true
);
101
}
102
}
103
104
//------------------------------------------------------------------------------------------------
105
void
Deactivate
(
bool
animate =
true
)
106
{
107
if
(!
m_bIsActive
)
108
return
;
109
110
m_bIsActive
=
false
;
111
PlaySound
(
m_sSoundClicked
);
112
113
if
(animate)
114
{
115
AnimateWidget
.
Color
(
m_wSpecializationValue
,
m_ColorInactive
,
m_fAnimationRate
);
116
AnimateWidget
.
Color
(
m_wSpecializationTitle
,
m_ColorInactive
,
m_fAnimationRate
);
117
m_SpecializationBar
.SetActive(
false
);
118
}
119
else
120
{
121
AnimateWidget
.
StopAnimation
(
m_wSpecializationValue
,
WidgetAnimationColor
);
122
m_wSpecializationValue
.SetColor(
m_ColorInactive
);
123
124
AnimateWidget
.
StopAnimation
(
m_wSpecializationTitle
,
WidgetAnimationColor
);
125
m_wSpecializationValue
.SetColor(
m_ColorInactive
);
126
127
m_SpecializationBar
.SetActive(
false
);
128
}
129
}
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
//------------------------------------------------------------------------------------------------
165
void
SetOnHover
(
bool
OnHover
=
true
)
166
{
167
if
(
m_bIsActive
)
168
return
;
169
170
if
(
OnHover
)
171
{
172
AnimateWidget
.
Color
(
m_wSpecializationValue
,
m_ColorInactiveHovered
,
m_fAnimationRate
);
173
AnimateWidget
.
Color
(
m_wSpecializationTitle
,
m_ColorInactiveHovered
,
m_fAnimationRate
);
174
GetGame
().GetCallqueue().CallLater(
m_SpecializationBar
.SetOnHover,
m_fAnimationRate
,
false
,
true
);
175
return
;
176
}
177
178
AnimateWidget
.
Color
(
m_wSpecializationValue
,
m_ColorInactive
,
m_fAnimationRate
);
179
AnimateWidget
.
Color
(
m_wSpecializationTitle
,
m_ColorInactive
,
m_fAnimationRate
);
180
GetGame
().GetCallqueue().CallLater(
m_SpecializationBar
.SetOnHover,
m_fAnimationRate
,
false
,
false
);
181
}
182
183
//------------------------------------------------------------------------------------------------
184
ScriptInvoker
GetOnMouseEnter
()
185
{
186
return
m_OnMouseEnter
;
187
}
188
189
//------------------------------------------------------------------------------------------------
190
ScriptInvoker
GetOnMouseLeave
()
191
{
192
return
m_OnMouseLeave
;
193
}
194
195
//------------------------------------------------------------------------------------------------
196
void
SetTitle
(
string
text)
197
{
198
if
(!
m_wSpecializationTitle
)
199
return
;
200
201
m_wSpecializationTitle
.SetText(text);
202
}
203
204
//------------------------------------------------------------------------------------------------
205
void
SetValue
(
float
num)
206
{
207
if
(!
m_wSpecializationValue
|| !
m_SpecializationBar
)
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
{
218
if
(n < 0 || n >
SCR_PlayerDataConfigs
.
GetInstance
().
SPECIALIZATIONS_COUNT
)
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
//------------------------------------------------------------------------------------------------
239
int
GetButtonId
()
240
{
241
return
m_ibuttonId
;
242
}
243
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
OnHover
void OnHover(EEditableEntityState state, set< SCR_EditableEntityComponent > entitiesInsert, set< SCR_EditableEntityComponent > entitiesRemove)
Definition
SCR_TooltipManagerEditorUIComponent.c:152
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::StopAnimation
static bool StopAnimation(Widget w, typename typeName)
Definition
AnimateWidget.c:26
AnimateWidget::Color
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition
AnimateWidget.c:200
Color
Definition
Color.c:13
RichTextWidget
Definition
RichTextWidget.c:13
SCR_ButtonSpecializationProgressComponent
Definition
SCR_ButtonSpecializationProgressComponent.c:3
SCR_ButtonSpecializationProgressComponent::m_wSpecializationTitle
RichTextWidget m_wSpecializationTitle
Definition
SCR_ButtonSpecializationProgressComponent.c:4
SCR_ButtonSpecializationProgressComponent::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
SCR_ButtonSpecializationProgressComponent.c:66
SCR_ButtonSpecializationProgressComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ButtonSpecializationProgressComponent.c:33
SCR_ButtonSpecializationProgressComponent::m_fMaxValue
const float m_fMaxValue
Definition
SCR_ButtonSpecializationProgressComponent.c:9
SCR_ButtonSpecializationProgressComponent::GetOnClicked
ScriptInvoker GetOnClicked()
Definition
SCR_ButtonSpecializationProgressComponent.c:60
SCR_ButtonSpecializationProgressComponent::SetOnHover
void SetOnHover(bool OnHover=true)
Definition
SCR_ButtonSpecializationProgressComponent.c:165
SCR_ButtonSpecializationProgressComponent::GetButtonId
int GetButtonId()
Definition
SCR_ButtonSpecializationProgressComponent.c:239
SCR_ButtonSpecializationProgressComponent::SetValue
void SetValue(float num)
Definition
SCR_ButtonSpecializationProgressComponent.c:205
SCR_ButtonSpecializationProgressComponent::m_SpecializationBar
SCR_ProgressBarWithInactiveColor m_SpecializationBar
Definition
SCR_ButtonSpecializationProgressComponent.c:6
SCR_ButtonSpecializationProgressComponent::Hide
void Hide()
Definition
SCR_ButtonSpecializationProgressComponent.c:149
SCR_ButtonSpecializationProgressComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_ButtonSpecializationProgressComponent.c:140
SCR_ButtonSpecializationProgressComponent::m_ColorInactiveHovered
ref Color m_ColorInactiveHovered
Definition
SCR_ButtonSpecializationProgressComponent.c:20
SCR_ButtonSpecializationProgressComponent::GetOnMouseEnter
ScriptInvoker GetOnMouseEnter()
Definition
SCR_ButtonSpecializationProgressComponent.c:184
SCR_ButtonSpecializationProgressComponent::SetTitle
void SetTitle(string text)
Definition
SCR_ButtonSpecializationProgressComponent.c:196
SCR_ButtonSpecializationProgressComponent::m_ibuttonId
int m_ibuttonId
Definition
SCR_ButtonSpecializationProgressComponent.c:11
SCR_ButtonSpecializationProgressComponent::m_OnMouseEnter
ref ScriptInvoker m_OnMouseEnter
Definition
SCR_ButtonSpecializationProgressComponent.c:29
SCR_ButtonSpecializationProgressComponent::m_wSpecializationValue
RichTextWidget m_wSpecializationValue
Definition
SCR_ButtonSpecializationProgressComponent.c:5
SCR_ButtonSpecializationProgressComponent::Activate
void Activate(bool animate=true)
Definition
SCR_ButtonSpecializationProgressComponent.c:78
SCR_ButtonSpecializationProgressComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_ButtonSpecializationProgressComponent.c:132
SCR_ButtonSpecializationProgressComponent::SetFocus
void SetFocus()
Definition
SCR_ButtonSpecializationProgressComponent.c:229
SCR_ButtonSpecializationProgressComponent::m_ColorActive
ref Color m_ColorActive
Definition
SCR_ButtonSpecializationProgressComponent.c:23
SCR_ButtonSpecializationProgressComponent::m_fMinValue
const float m_fMinValue
Definition
SCR_ButtonSpecializationProgressComponent.c:8
SCR_ButtonSpecializationProgressComponent::GetOnMouseLeave
ScriptInvoker GetOnMouseLeave()
Definition
SCR_ButtonSpecializationProgressComponent.c:190
SCR_ButtonSpecializationProgressComponent::m_OnClicked
ref ScriptInvoker m_OnClicked
Definition
SCR_ButtonSpecializationProgressComponent.c:26
SCR_ButtonSpecializationProgressComponent::m_bIsActive
bool m_bIsActive
Definition
SCR_ButtonSpecializationProgressComponent.c:14
SCR_ButtonSpecializationProgressComponent::m_OnMouseLeave
ref ScriptInvoker m_OnMouseLeave
Definition
SCR_ButtonSpecializationProgressComponent.c:30
SCR_ButtonSpecializationProgressComponent::Deactivate
void Deactivate(bool animate=true)
Definition
SCR_ButtonSpecializationProgressComponent.c:105
SCR_ButtonSpecializationProgressComponent::Unhide
void Unhide()
Definition
SCR_ButtonSpecializationProgressComponent.c:157
SCR_ButtonSpecializationProgressComponent::m_ColorInactive
ref Color m_ColorInactive
Definition
SCR_ButtonSpecializationProgressComponent.c:17
SCR_ButtonSpecializationProgressComponent::SetButtonId
void SetButtonId(int n)
Definition
SCR_ButtonSpecializationProgressComponent.c:216
SCR_PlayerDataConfigs
Definition
SCR_PlayerDataConfigs.c:103
SCR_PlayerDataConfigs::GetInstance
static SCR_PlayerDataConfigs GetInstance()
Definition
SCR_PlayerDataConfigs.c:199
SCR_PlayerDataConfigs::SPECIALIZATIONS_COUNT
int SPECIALIZATIONS_COUNT
Definition
SCR_PlayerDataConfigs.c:122
SCR_ProgressBarWithInactiveColor
Definition
SCR_WLibProgressBarWithInactiveColor.c:3
SCR_ScriptedWidgetComponent::m_wRoot
Widget m_wRoot
Definition
SCR_ScriptedWidgetComponent.c:9
SCR_WLibComponentBase
Base class for all final Reforger interactive elements.
Definition
SCR_WLibComponentBase.c:9
SCR_WLibComponentBase::m_fAnimationRate
float m_fAnimationRate
Definition
SCR_WLibComponentBase.c:28
SCR_WLibComponentBase::PlaySound
void PlaySound(string sound)
Definition
SCR_WLibComponentBase.c:123
SCR_WLibComponentBase::m_sSoundClicked
string m_sSoundClicked
Definition
SCR_WLibComponentBase.c:14
SCR_WLibProgressBarComponent
Minimalist progress bar.
Definition
SCR_WLibProgressBar.c:7
SCR_WLibProgressBarComponent::GetProgressBar
static SCR_WLibProgressBarComponent GetProgressBar(string name, Widget parent, bool searchAllChildren=true)
Definition
SCR_WLibProgressBar.c:198
UIWidgets
Definition
attributes.c:40
WidgetAnimationColor
Definition
WidgetAnimations.c:249
Widget
Definition
Widget.c:13
WorkspaceWidget
Definition
WorkspaceWidget.c:16
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
UI
Menu
CareerProfile
SCR_ButtonSpecializationProgressComponent.c
Generated by
1.17.0