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_DownloadManager_ProgressIndicatorComponent.c
Go to the documentation of this file.
1
4
class
SCR_DownloadManager_ProgressIndicatorComponent
:
ScriptedWidgetComponent
5
{
6
ref
SCR_DownloadManager_ProgressIndicatorWidgets
m_Widgets =
new
SCR_DownloadManager_ProgressIndicatorWidgets
();
7
8
//------------------------------------------------------------------------------------------
9
override
void
HandlerAttached(
Widget
w)
10
{
11
m_Widgets.Init(w);
12
13
Update
();
14
15
GetGame
().GetCallqueue().CallLater(Update, 50,
true
);
16
}
17
18
19
20
//------------------------------------------------------------------------------------------
21
override
void
HandlerDeattached(
Widget
w)
22
{
23
if
(
GetGame
().
GetCallqueue
())
24
GetGame
().GetCallqueue().Remove(Update);
25
}
26
27
28
29
//------------------------------------------------------------------------------------------
30
void
Update
()
31
{
32
// Download state text
33
SCR_DownloadManager
mgr =
SCR_DownloadManager
.
GetInstance
();
34
if
(mgr && !
SCR_Global
.
IsEditMode
())
35
{
36
UpdateAllWidgets
();
37
}
38
}
39
40
41
42
//------------------------------------------------------------------------------------------
43
protected
void
UpdateAllWidgets
()
44
{
45
SCR_DownloadManager
mgr =
SCR_DownloadManager
.
GetInstance
();
46
string
downloadStateText;
47
int
nCompleted, nTotal;
48
mgr.
GetDownloadQueueState
(nCompleted, nTotal);
49
50
if
(nTotal > 0 && !mgr.
GetDownloadsPaused
())
51
downloadStateText =
string
.Format(
"%1 %2 / %3"
,
WidgetManager
.Translate(
SCR_WorkshopUiCommon
.DOWNLOAD_STATE_DOWNLOADING), nCompleted, nTotal);
52
else
if
(nTotal > 0 && mgr.
GetDownloadsPaused
())
53
downloadStateText =
string
.Format(
"%1 %2 / %3"
,
WidgetManager
.Translate(
"#AR-DownloadManager_State_AllDownloadsPaused"
), nCompleted, nTotal);
54
else
if
(mgr.
GetDownloadsPaused
())
55
downloadStateText =
"#AR-DownloadManager_State_AllDownloadsPaused"
;
56
else
57
downloadStateText =
"#AR-DownloadManager_State_NoActiveDownloads"
;
58
59
m_Widgets.m_StateText.SetText(downloadStateText);
60
61
// Progress bar, progress text
62
if
(nTotal > 0)
63
{
64
// Get total progress of all downloads
65
array<ref SCR_WorkshopItemActionDownload> downloadQueue = mgr.
GetDownloadQueue
();
66
float
progress =
SCR_DownloadManager
.
GetDownloadActionsProgress
(downloadQueue);
67
68
// Progress bar
69
m_Widgets.m_ProgressBar.SetCurrent(progress);
70
71
// Progress percent text
72
string
progressText =
string
.Format(
"%1 %%"
,
Math
.Floor(progress * 100.0));
73
m_Widgets.m_ProgressText.SetText(progressText);
74
}
75
else
76
{
77
m_Widgets.m_ProgressBar.SetCurrent(0);
78
}
79
80
//m_Widgets.m_ProgressBar.SetVisible(nTotal > 0);
81
m_Widgets.m_ProgressOverlay.SetVisible(nTotal > 0);
82
}
83
84
85
86
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetCallqueue
ScriptCallQueue GetCallqueue()
Returns CallQueue of this AI. It gets updated from EvaluateBehavior, so that it's synchronous with ot...
Definition
SCR_AIUtilityComponent.c:478
Math
Definition
Math.c:13
SCR_DownloadManager_ProgressIndicatorComponent
Definition
SCR_DownloadManager_ProgressIndicatorComponent.c:5
SCR_DownloadManager_ProgressIndicatorComponent::UpdateAllWidgets
void UpdateAllWidgets()
Definition
SCR_DownloadManager_ProgressIndicatorComponent.c:43
SCR_DownloadManager_ProgressIndicatorWidgets
Definition
SCR_DownloadManager_ProgressIndicatorWidgets.c:5
SCR_DownloadManager
Definition
SCR_DownloadManager.c:21
SCR_DownloadManager::GetDownloadQueueState
void GetDownloadQueueState(out int nCompleted, out int nTotal)
Might get delayed by a frame! Just use it for UI.
Definition
SCR_DownloadManager.c:109
SCR_DownloadManager::GetDownloadActionsProgress
static float GetDownloadActionsProgress(array< ref SCR_WorkshopItemActionDownload > actions)
Returns overall progress of all download actions, from 0 to 1.
Definition
SCR_DownloadManager.c:425
SCR_DownloadManager::GetInstance
static SCR_DownloadManager GetInstance()
Definition
SCR_DownloadManager.c:91
SCR_DownloadManager::GetDownloadQueue
array< ref SCR_WorkshopItemActionDownload > GetDownloadQueue()
Definition
SCR_DownloadManager.c:138
SCR_DownloadManager::GetDownloadsPaused
bool GetDownloadsPaused()
Definition
SCR_DownloadManager.c:209
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_WorkshopUiCommon
Definition
SCR_WorkshopUiCommon.c:6
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
Widget
Definition
Widget.c:13
WidgetManager
Definition
WidgetManager.c:16
Update
@ Update
Definition
SndComponentCallbacks.c:14
scripts
Game
UI
Menu
DownloadManager
SCR_DownloadManager_ProgressIndicatorComponent.c
Generated by
1.17.0