8 protected string m_sList;
11 protected string m_sFallbackTextWrapWidget;
14 protected ref array<ref SCR_DownloadManagerListCategory> m_aCategories;
16 protected ScrollLayoutWidget m_ScrollLayout;
17 protected Widget m_wList;
18 protected Widget m_wFallbackTextWrap;
25 protected ref array<ref SCR_DownloadManagerEntry> m_aAddonLines = {};
27 protected bool m_bAllPaused =
false;
32 override void HandlerAttached(Widget w)
34 super.HandlerAttached(w);
42 override void OnTabShow()
49 ShowFallbackText(
m_wList.GetChildren() ==
null);
51 GetGame().GetWorkspace().SetFocusedWidget(
null);
55 override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout,
int index)
57 super.OnTabCreate(menuRoot, buttonsLayout,
index);
59 m_NavPauseResume = CreateNavigationButton(
"WorkshopPauseDownload",
"#AR-Workshop_ButtonResume",
true,
false);
62 m_NavCancel = CreateNavigationButton(
"WorkshopCancelDownload",
"#AR-Keybind_Cancel",
true,
false);
65 m_NavRetry = CreateNavigationButton(
"WorkshopPauseDownload",
"#AR-Workshop_ButtonTryAgain",
true,
false);
68 m_NavPauseResumeAll = CreateNavigationButton(
"WorkshopPauseAllDownloads",
"#AR-DownloadManager_ButtonPauseAll",
false);
78 Print(
"List widget or widgte resource wasn't set properly!", LogLevel.WARNING);
83 Widget entry =
GetGame().GetWorkspace().CreateWidgets(entryPath, m_wList);
84 LayoutSlot.SetHorizontalAlign(entry, LayoutHorizontalAlign.Stretch);
88 btn.m_OnFocus.Insert(OnEntryFocus);
89 btn.m_OnFocusLost.Insert(OnEntryFocusLost);
92 entryComp.InitForDownloadAction(action.GetWorkshopItem(), action);
95 ShowFallbackText(
false);
100 for (
int i = 0, count =
m_aCategories.Count(); i < count; i++)
102 if (m_aCategories[i].m_iType ==
type)
104 entry.SetZOrder(m_aCategories[i].m_iZOrder);
119 if (entry.GetParent() !=
m_wList)
121 Print(
"Selected entry is not part of list!", LogLevel.WARNING);
125 int categoryZOrder = -1;
128 for (
int i = 0, count =
m_aCategories.Count(); i < count; i++)
130 if (m_aCategories[i].m_iType ==
type)
138 if (categoryZOrder != -1)
139 entry.SetZOrder(categoryZOrder);
145 m_wList.RemoveChild(entry.GetRootWidget());
153 for (
int i = 0, count =
m_aAddonLines.Count(); i < count; i++)
166 for (
int i = 0, count =
m_aAddonLines.Count(); i < count; i++)
179 Widget focused =
GetGame().GetWorkspace().GetFocusedWidget();
194 void ShowPauseResumeAllButton(
bool show)
196 if (m_NavPauseResumeAll)
197 SetNavigationButtonVisibile(m_NavPauseResumeAll, show);
201 void ShowFallbackText(
bool show)
203 if (m_wFallbackTextWrap)
211 return m_wList.GetChildren() !=
null;
218 protected void OnEntryFocus()
226 UpdateNavButtons(m_FocusedEntry);
230 protected void OnEntryFocusLost()
241 SetNavigationButtonVisibile(
m_NavCancel, entry !=
null);
242 SetNavigationButtonVisibile(
m_NavRetry, entry !=
null);
248 bool pause, resume, cancel, retry;
249 entry.CanDoActions(pause, resume, cancel, retry);
264 SetNavigationButtonVisibile(m_NavRetry, retry);
268 protected void OnClickPauseResume()
274 if (entry.GetDownloadAction().IsPaused())
275 entry.OnClickResume();
277 entry.OnClickPause();
281 protected void OnClickCancel()
285 entry.OnClickCancel();
289 protected void OnClickRetry()
295 entry.OnClickRetry();
299 protected void OnClickPauseResumeAll()
301 for (
int i = 0, count =
m_aAddonLines.Count(); i < count; i++)
330 protected void EnablePauseResumeAll()
338 class SCR_DownloadManagerListCategory