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_ProgressDialog.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
class
SCR_ProgressDialog
:
ScriptedWidgetComponent
3
{
4
// Widget Names
5
const
string
WIDGET_TEXT_PROGRESS =
"TxtProgress"
;
6
const
string
WIDGET_PROGRESS_BAR =
"ProgressDownload"
;
7
8
// Widgets
9
protected
TextWidget
m_wTxtProgress
;
10
protected
SCR_WLibProgressBarComponent
m_ProgressBar
;
11
12
//------------------------------------------------------------------------------------------------
13
// Dialog override functions
14
//------------------------------------------------------------------------------------------------
15
16
//------------------------------------------------------------------------------------------------
17
override
void
HandlerAttached
(
Widget
w)
18
{
19
super.HandlerAttached(w);
20
21
// Get widgets
22
m_wTxtProgress
=
TextWidget
.Cast(w.FindAnyWidget(WIDGET_TEXT_PROGRESS));
23
24
Widget
wProgressBar = w.FindAnyWidget(WIDGET_PROGRESS_BAR);
25
if
(wProgressBar)
26
m_ProgressBar
=
SCR_WLibProgressBarComponent
.Cast(wProgressBar.FindHandler(
SCR_WLibProgressBarComponent
));
27
}
28
29
//------------------------------------------------------------------------------------------------
30
// Public API
31
//------------------------------------------------------------------------------------------------
32
33
//------------------------------------------------------------------------------------------------
34
void
SetProgress
(
float
progress)
35
{
36
// Progress bar
37
if
(
m_ProgressBar
)
38
{
39
m_ProgressBar
.SetValue(progress);
40
41
// Get proper value in percent
42
float
progValue =
m_ProgressBar
.GetValue() -
m_ProgressBar
.GetMin();
43
progValue /=
m_ProgressBar
.GetMax() -
m_ProgressBar
.GetMin();
44
progValue *= 100;
45
progValue =
Math
.Floor(progValue);
46
47
// Progress text
48
if
(
m_wTxtProgress
)
49
m_wTxtProgress
.SetText(progValue.ToString() +
"%"
);
50
}
51
}
52
53
};
54
55
56
Math
Definition
Math.c:13
SCR_ProgressDialog
Definition
SCR_ProgressDialog.c:3
SCR_ProgressDialog::m_wTxtProgress
TextWidget m_wTxtProgress
Definition
SCR_ProgressDialog.c:9
SCR_ProgressDialog::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ProgressDialog.c:17
SCR_ProgressDialog::SetProgress
void SetProgress(float progress)
Definition
SCR_ProgressDialog.c:34
SCR_ProgressDialog::m_ProgressBar
SCR_WLibProgressBarComponent m_ProgressBar
Definition
SCR_ProgressDialog.c:10
SCR_WLibProgressBarComponent
Minimalist progress bar.
Definition
SCR_WLibProgressBar.c:7
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
TextWidget
Definition
TextWidget.c:16
Widget
Definition
Widget.c:13
scripts
Game
UI
Menu
SCR_ProgressDialog.c
Generated by
1.17.0