4 protected const string MSG_SELECT =
"#AR-Workshop_SelectMsg";
5 protected const string LINE_DOWNLOADED =
"#AR-Workshop_Details_Downloaded";
6 protected const string TAG_AUTHOR_UNBLOCK =
"unblock_author_simple";
8 protected const int AUTHOR_MOD_LIMIT = 50;
11 [
Attribute(
"{ADEA32EB841E8629}Configs/ContentBrowser/ContentBrowserReportDialogs.conf", UIWidgets.ResourceNamePicker,
"Layout of the navigation button",
params:
"layout")]
12 protected ResourceName m_sDialogsConfig;
15 protected string m_sTagSelectReport;
18 protected string m_sTagReportAuthor;
25 protected WorkshopAuthor m_Author;
30 protected ref array<ref SCR_ConfigurableDialogUi> m_aDialogs = {};
33 protected ref array <ref SCR_WorkshopItem> m_aAuthorModsList = {};
47 m_aDialogs.Insert(m_CurrentDialog);
50 m_Author = item.GetWorkshopItem().Author();
53 string author =
m_Item.GetAuthorName();
54 m_CurrentDialog.GetMessageWidget().SetTextFormat(MSG_SELECT, author);
55 m_CurrentDialog.GetMessageWidget().SetVisible(
true);
58 m_CurrentDialog.m_OnConfirm.Insert(OnSelectReportConfirm);
59 m_CurrentDialog.m_OnCancel.Insert(OnSelectReportCancel);
64 butAuthor.m_OnActivated.Insert(OnSelectReportAuthor);
71 m_CurrentDialog.ClearButtons();
77 m_CurrentDialog.ClearButtons();
81 void OnSelectReportAuthor()
84 m_CurrentDialog.ClearButtons();
86 if (!m_Author.IsBlocked())
90 OpenReportAuthorModList();
95 OpenRemoveAuthorBlockModList();
101 void OpenReportThis()
108 m_ReportDialog.GetOnReportSuccess().Insert(OnItemReportedSuccessfully);
109 m_ReportDialog.m_OnCancel.Insert(OnCancelThisReport);
113 protected void OnItemReportedSuccessfully(
bool isAuthorBlocked)
116 dlg.m_OnClose.Insert(OnItemReportSuccessDialogClose);
121 if (!isAuthorBlocked)
122 msg = dlg.GetMessageStr() +
"\n\n" ;
124 msg +=
"#AR-Workshop_ReportModReverse";
125 dlg.GetMessageWidget().SetTextFormat(msg,
"#AR-Workshop_Filter_Reported",
"#AR-Workshop_CancelReport");
129 protected void OnItemReportSuccessDialogClose()
131 if (m_OnItemReportSuccessDialogClose)
132 m_OnItemReportSuccessDialogClose.Invoke();
136 protected void OnCancelThisReport()
139 m_ReportDialog.m_OnCancel.Remove(OnCancelThisReport);
146 protected void OpenReportAuthorModList()
148 string author =
m_Item.GetAuthorName();
150 OpenAuthorModsDialog();
153 string msg =
"#AR-Workshop_ReportAuthorMsg";
157 if (addonDialog && !addonDialog.GetDonwloadLines().IsEmpty())
158 msg +=
"\n\n#AR-Workshop_AffectedMods";
160 m_CurrentDialog.GetMessageWidget().SetTextFormat(msg, author);
163 m_CurrentDialog.m_OnConfirm.Insert(OnConfirmReportAuthorModList);
164 m_CurrentDialog.m_OnCancel.Insert(OnCancelReportAuthorModList);
165 m_LoadingOverlayDlg.Close();
170 protected void OpenRemoveAuthorBlockModList()
175 string msg = m_CurrentDialog.GetMessageStr();
176 string author =
m_Item.GetAuthorName();
177 m_CurrentDialog.GetMessageWidget().SetTextFormat(msg, author);
180 m_CurrentDialog.m_OnConfirm.Insert(OnConfirmRemoveAuthorBlock);
181 m_CurrentDialog.m_OnCancel.Insert(OnCancelRemoveAuthorReport);
185 protected void OpenAuthorModsDialog(
bool showReported =
true)
188 array<WorkshopItem> toReport = {};
189 if (m_Author.IsBlocked())
190 m_Author.GetPageItems(toReport);
192 m_Author.GetOfflineItems(toReport);
194 m_aAuthorModsList.Clear();
197 foreach (WorkshopItem item : toReport)
200 m_aAuthorModsList.Insert(scrItem);
204 m_CurrentDialog = dialog;
208 m_aDialogs.Insert(m_CurrentDialog);
211 m_CurrentDialog.GetMessageWidget().SetVisible(
true);
214 array<SCR_DownloadManager_AddonDownloadLine> lines = dialog.GetDonwloadLines();
219 item = line.GetItem();
222 if (item.GetOffline())
224 line.DisplayError(LINE_DOWNLOADED);
231 protected void OnConfirmReportAuthorModList()
234 m_ActionAddAuthorBlock =
m_Item.AddAuthorBlock();
236 m_ActionAddAuthorBlock.m_OnCompleted.Insert(OnAuthorReportSuccess);
237 m_ActionAddAuthorBlock.m_OnFailed.Insert(OnAuthorReportFail);
239 if (!m_ActionAddAuthorBlock.Activate() && !m_ActionAddAuthorBlock.Reactivate())
243 OnCancelReportAuthorModList();
248 protected void OnConfirmRemoveAuthorBlock()
250 m_ActionRemoveAuthorBlock =
m_Item.RemoveAuthorBlock();
252 m_ActionRemoveAuthorBlock.m_OnCompleted.Insert(OnRemoveAuthorBlockSuccess);
253 m_ActionRemoveAuthorBlock.m_OnFailed.Insert(OnAuthorReportFail);
255 if (!m_ActionRemoveAuthorBlock.Activate() && !m_ActionRemoveAuthorBlock.Reactivate())
258 OnCancelReportAuthorModList();
263 protected void OnAuthorReportFail()
266 m_LoadingOverlayDlg.Close();
270 protected void OnAuthorReportSuccess()
272 OnItemReportedSuccessfully(
true);
279 item.DeleteLocally();
280 item.SetSubscribed(
false);
292 m_LoadingOverlayDlg.Close();
296 protected void CloseDialogs()
307 protected void OnCancelReportAuthorModList()
309 m_CurrentDialog.m_OnConfirm.Remove(OnConfirmReportAuthorModList);
310 m_CurrentDialog.m_OnCancel.Remove(OnCancelReportAuthorModList);
314 protected void OnRemoveAuthorBlockSuccess()
317 m_LoadingOverlayDlg.Close();
321 protected void OnCancelRemoveAuthorReport()
323 m_CurrentDialog.m_OnConfirm.Remove(OnRemoveAuthorBlockSuccess);
324 m_CurrentDialog.m_OnCancel.Remove(OnCancelRemoveAuthorReport);
328 protected void OnCancelAuthorReport()
330 m_ReportDialog.m_OnCancel.Remove(OnCancelAuthorReport);
337 m_Author = item.GetWorkshopItem().Author();
343 if (!m_OnItemReportSuccessDialogClose)
346 return m_OnItemReportSuccessDialogClose;