Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ServerJoinDownloadsConfirmationDialog.c
Go to the documentation of this file.
1
3{
4 protected static const string TAG_ALL = "server_download_all_cancel";
5 protected static const string TAG_REQUIRED = "server_download_required";
6 protected static const string TAG_UNRELATED = "server_download_unrelated_cancel";
7
8 protected const ResourceName DOWNLOAD_LINE_LAYOUT = "{1C5D2CC10D7A1BC3}UI/layouts/Menus/ContentBrowser/DownloadManager/DownloadManager_AddonDownloadLineNonInteractive.layout";
9
10 protected const string BUTTON_RETRY = "Retry";
11
13
14 protected ref array<ref SCR_WorkshopItemActionDownload> m_aActions = {};
16
17 //------------------------------------------------------------------------------------------------
18 static SCR_ServerJoinDownloadsConfirmationDialog Create(array<ref SCR_WorkshopItemActionDownload> actions, SCR_EJoinDownloadsConfirmationDialogType type)
19 {
20 string tag;
21
22 switch (type)
23 {
25 tag = TAG_ALL;
26 break;
27
29 tag = TAG_REQUIRED;
30 break;
31
33 tag = TAG_UNRELATED;
34 break;
35 }
36
39 dialog.Setup(actions);
40
41 return dialog;
42 }
43
44 //------------------------------------------------------------------------------------------------
46 {
47 m_ListWrapper = GetContentLayoutRoot().FindAnyWidget(SCR_WorkshopDialogs.WIDGET_LIST);
48
49 super.OnMenuOpen(preset);
50
51 // Retry button
53 if (m_Retry)
54 m_Retry.m_OnActivated.Insert(RetryActions);
55 }
56
57 //------------------------------------------------------------------------------------------------
58 void Setup(array<ref SCR_WorkshopItemActionDownload> actions)
59 {
60 if (!m_ListWrapper)
61 return;
62
63 // --- Cleanup ---
64 // Remove old widgets
65 SCR_WidgetHelper.RemoveAllChildren(m_ListWrapper);
66
67 // Release old actions
68 foreach (SCR_WorkshopItemActionDownload action : actions)
69 {
70 action.m_OnActivated.Remove(UpdateRetryButton);
71 action.m_OnFailed.Remove(UpdateRetryButton);
72 action.m_OnCompleted.Remove(UpdateRetryButton);
73 }
74
75 // --- Initialize new ---
76 m_aActions = actions;
77
79 {
80 Widget w = GetGame().GetWorkspace().CreateWidgets(DOWNLOAD_LINE_LAYOUT, m_ListWrapper);
82 comp.InitForServerDownloadAction(action);
83
84 action.m_OnActivated.Insert(UpdateRetryButton);
85 action.m_OnFailed.Insert(UpdateRetryButton);
86 action.m_OnCompleted.Insert(UpdateRetryButton);
87 }
88
90 }
91
92 //------------------------------------------------------------------------------------------------
93 protected void UpdateRetryButton()
94 {
95 if (!m_Retry)
96 return;
97
98 bool visible;
99
101 {
102 visible = action.IsFailed();
103 if (visible)
104 break;
105 }
106
107 m_Retry.SetVisible(visible, false);
108 }
109
110 //------------------------------------------------------------------------------------------------
111 protected void RetryActions()
112 {
113 array<ref SCR_WorkshopItemActionDownload> newActions = {};
114
116 {
117 if (action.IsFailed())
118 newActions.Insert(action.RetryDownload());
119 else
120 newActions.Insert(action);
121 }
122
123 Setup(newActions);
124 }
125}
ArmaReforgerScripted GetGame()
Definition game.c:1398
EDamageType type
SCR_EJoinDownloadsConfirmationDialogType
Enum for confirmation dialogs that guide the player through the download processes required to join t...
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
Widget GetContentLayoutRoot()
Returns the root of the content layout.
SCR_InputButtonComponent FindButton(string tag)
Returns a button with given tag.
void InitForServerDownloadAction(SCR_WorkshopItemActionDownload action)
Initializes the line in non-interactive mode, shows basic data about a download relating to joining s...
Dialog to cancel downloads during to server joining.
override void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
static SCR_ServerJoinDownloadsConfirmationDialog Create(array< ref SCR_WorkshopItemActionDownload > actions, SCR_EJoinDownloadsConfirmationDialogType type)
void Setup(array< ref SCR_WorkshopItemActionDownload > actions)
ref array< ref SCR_WorkshopItemActionDownload > m_aActions
@ Setup
Definition TestStage.c:15