Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ModReportDialogComponent.c
Go to the documentation of this file.
2{
3 // Const localized strings
4 protected const string MSG_SELECT = "#AR-Workshop_SelectMsg";
5 protected const string LINE_DOWNLOADED = "#AR-Workshop_Details_Downloaded";
6 protected const string MSG_REPORT_SUCCESS = "#AR-Workshop_Dialog_Report_SuccessDescription";
7 protected const string MSG_UNBLOCK_AUTHOR_CONFIRM = "#AR-Workshop_CancelAuthorReport";
8 protected const string TAG_AUTHOR_UNBLOCK = "unblock_author_simple";
9
10 protected const int AUTHOR_MOD_LIMIT = 50;
11
12 // Attributes
13 [Attribute("{ADEA32EB841E8629}Configs/ContentBrowser/ContentBrowserReportDialogs.conf", UIWidgets.ResourceNamePicker, "Layout of the navigation button", params: "layout")]
15
16 [Attribute("select_report")]
17 protected string m_sTagSelectReport;
18
19 [Attribute("report_author")]
20 protected string m_sTagReportAuthor;
21
22 // Variables
25
26 protected ref SCR_WorkshopItem m_Item;
28
30
31 protected ref array<ref SCR_ConfigurableDialogUi> m_aDialogs = {};
33
34 protected ref array <ref SCR_WorkshopItem> m_aAuthorModsList = {};
35
38
40
41 //------------------------------------------------------------------------------------------------
43 {
45 if (!m_CurrentDialog)
46 return;
47
49
50 m_Item = item;
51 m_Author = item.GetWorkshopItem().Author();
52
53 // Message
54 string author = m_Item.GetAuthorName();
55 m_CurrentDialog.GetMessageWidget().SetTextFormat(MSG_SELECT, author);
56 m_CurrentDialog.GetMessageWidget().SetVisible(true);
57
58 // Actions
59 m_CurrentDialog.m_OnConfirm.Insert(OnSelectReportConfirm);
60
61 // Author report action
62 SCR_InputButtonComponent butAuthor = m_CurrentDialog.FindButton("report_author");
63 if (butAuthor)
64 butAuthor.m_OnActivated.Insert(OnSelectReportAuthor);
65 }
66
67 //------------------------------------------------------------------------------------------------
69 {
70 m_Item = item;
71 m_Author = item.GetWorkshopItem().Author();
72
73 if (!m_Author.IsBlocked())
74 {
75 // Block author
78
79 return;
80 }
81
82 // Show cancel report block
84 }
85
86 //------------------------------------------------------------------------------------------------
88 {
90 }
91
92 //------------------------------------------------------------------------------------------------
93 protected void OnSelectReportAuthor()
94 {
96 }
97
98 //------------------------------------------------------------------------------------------------
100 protected void OpenReportThis()
101 {
102 m_ReportDialog = ReportDialogUI.Cast(GetGame().GetMenuManager().OpenDialog(ChimeraMenuPreset.ReportItemDialog));
103 if (!m_ReportDialog)
104 return;
105
106 m_ReportDialog.SetWorkshopItem(m_Item);
107
108 // Invoker actions
109 m_ReportDialog.GetOnReportSuccess().Insert(OnItemReportedSuccessfully);
110 m_ReportDialog.m_OnCancel.Insert(OnCancelThisReport);
111 }
112
113 //------------------------------------------------------------------------------------------------
114 protected void OnItemReportedSuccessfully(bool isAuthorBlocked)
115 {
116 SCR_ConfigurableDialogUi dlg = SCR_WorkshopDialogs.CreateDialog("report_success");
118
119 // Message
120 string msg;
121
122 if (!isAuthorBlocked)
123 msg = MSG_REPORT_SUCCESS + "\n\n" ;
124
125 msg += "#AR-Workshop_ReportModReverse";
126 dlg.GetMessageWidget().SetTextFormat(msg, "#AR-Workshop_Filter_Reported", "#AR-Workshop_CancelReport");
127 }
128
129 //------------------------------------------------------------------------------------------------
135
136 //------------------------------------------------------------------------------------------------
137 protected void OnCancelThisReport()
138 {
139 if (m_ReportDialog)
140 m_ReportDialog.m_OnCancel.Remove(OnCancelThisReport);
141
143 }
144
145 //------------------------------------------------------------------------------------------------
147 protected void OpenReportAuthorModList()
148 {
149 string author = m_Item.GetAuthorName();
150
152
153 // Setup message
154 string msg = "#AR-Workshop_ReportAuthorMsg";
156
157 // Show affected mods only if there are any mods to be displayed
158 if (addonDialog && !addonDialog.GetDonwloadLines().IsEmpty())
159 msg += "\n\n#AR-Workshop_AffectedMods";
160
161 m_CurrentDialog.GetMessageWidget().SetTextFormat(msg, author);
162
163 // Actions
166 m_LoadingOverlayDlg.Close();
167 }
168
169 //------------------------------------------------------------------------------------------------
172 {
174
175 // Add author to message
176 string msg = MSG_UNBLOCK_AUTHOR_CONFIRM;
177
178 string author = m_Item.GetAuthorName();
179 m_CurrentDialog.GetMessageWidget().SetTextFormat(msg, author);
180
181 // Actions
184 }
185
186 //------------------------------------------------------------------------------------------------
187 protected void OpenAuthorModsDialog(bool showReported = true)
188 {
189 // Create dialog list
190 array<WorkshopItem> toReport = {};
191 if (m_Author.IsBlocked())
192 m_Author.GetPageItems(toReport);
193 else
194 m_Author.GetOfflineItems(toReport);
195
196 m_aAuthorModsList.Clear();
197
198 SCR_WorkshopItem scrItem;
199 foreach (WorkshopItem item : toReport)
200 {
201 scrItem = SCR_AddonManager.GetInstance().Register(item);
202 m_aAuthorModsList.Insert(scrItem);
203 }
204
206 m_CurrentDialog = dialog;
207 if (!dialog)
208 return;
209
211
212 // Show message
213 m_CurrentDialog.GetMessageWidget().SetVisible(true);
214
215 // Mark mod entries
216 array<SCR_DownloadManager_AddonDownloadLine> lines = dialog.GetDonwloadLines();
217
218 SCR_WorkshopItem item;
219 foreach (SCR_DownloadManager_AddonDownloadLine line : lines)
220 {
221 item = line.GetItem();
222
223 // Owned
224 if (item.GetOffline())
225 line.DisplayError(SCR_WorkshopUiCommon.DOWNLOAD_STATE_COMPLETED);
226 }
227 }
228
229 //------------------------------------------------------------------------------------------------
231 {
232 // Block
233 m_ActionAddAuthorBlock = m_Item.AddAuthorBlock();
234
235 m_ActionAddAuthorBlock.m_OnCompleted.Insert(OnAuthorReportSuccess);
237
238 if (!m_ActionAddAuthorBlock.Activate() && !m_ActionAddAuthorBlock.Reactivate())
239 return;
240
243 }
244
245 //------------------------------------------------------------------------------------------------
247 {
248 m_ActionRemoveAuthorBlock = m_Item.RemoveAuthorBlock();
249
252
253 if (!m_ActionRemoveAuthorBlock.Activate() && !m_ActionRemoveAuthorBlock.Reactivate())
254 return;
255
258 }
259
260 //------------------------------------------------------------------------------------------------
261 protected void OnAuthorReportFail()
262 {
263 CloseDialogs();
264 m_LoadingOverlayDlg.Close();
265 }
266
267 //------------------------------------------------------------------------------------------------
268 protected void OnAuthorReportSuccess()
269 {
271
273
274 // Clear up all author items loading and remove from local storage
275 foreach (SCR_WorkshopItem item : m_aAuthorModsList)
276 {
277 item.DeleteLocally();
278 item.SetSubscribed(false);
279
280 // Cancel download
281 if (!mgr)
282 continue;
283
285 if (action)
286 action.Cancel();
287 }
288
289 CloseDialogs();
290 m_LoadingOverlayDlg.Close();
291 }
292
293 //------------------------------------------------------------------------------------------------
294 protected void CloseDialogs()
295 {
296 foreach (SCR_ConfigurableDialogUi dialog : m_aDialogs)
297 {
298 dialog.Close();
299 }
300
301 m_aDialogs.Clear();
302 }
303
304 //------------------------------------------------------------------------------------------------
306 {
309 }
310
311 //------------------------------------------------------------------------------------------------
313 {
314 //m_CurrentDialog.Close();
315 m_LoadingOverlayDlg.Close();
316 }
317
318 //------------------------------------------------------------------------------------------------
320 {
323 }
324
325 //------------------------------------------------------------------------------------------------
326 protected void OnCancelAuthorReport()
327 {
328 m_ReportDialog.m_OnCancel.Remove(OnCancelAuthorReport);
329 }
330
331 //------------------------------------------------------------------------------------------------
339}
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Shows a list of addons and some text.
array< SCR_DownloadManager_AddonDownloadLine > GetDonwloadLines()
static SCR_AddonListDialog CreateItemsList(array< ref SCR_WorkshopItem > items, string preset, ResourceName dialogsConfig=string.Empty)
SCR_WorkshopItem Register(WorkshopItem item)
Returns a SCR_WorkshopItem. If it's not registered, creates a new one and registers it.
static SCR_AddonManager GetInstance()
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
SCR_WorkshopItemActionDownload GetActionOfItem(SCR_WorkshopItem item)
Return item action for given workshop item.
static SCR_DownloadManager GetInstance()
static SCR_LoadingOverlayDialog Create(string text=string.Empty)
ref SCR_WorkshopItemActionRemoveAuthorBlock m_ActionRemoveAuthorBlock
void OpenReportThis()
Dialog for selecting type, typing message and confirming this mod report.
void OnSelectReportConfirm(SCR_ConfigurableDialogUi dialog)
void OpenRemoveAuthorBlockModList()
Dialog displaying all author mmods and explaing what will happen after report confirm.
SCR_LoadingOverlayDialog m_LoadingOverlayDlg
ref SCR_ConfigurableDialogUi m_CurrentDialog
void OpenSelectReportAuthor(notnull SCR_WorkshopItem item)
ref SCR_WorkshopItemActionAddAuthorBlock m_ActionAddAuthorBlock
ref ScriptInvokerVoid m_OnItemReportSuccessDialogClose
void OpenAuthorModsDialog(bool showReported=true)
ref SCR_ContentBrowser_GetAssetListParams m_Params
void OpenReportAuthorModList()
Dialog displaying all author mmods and explaing what will happen after report confirm.
ref array< ref SCR_ConfigurableDialogUi > m_aDialogs
ref array< ref SCR_WorkshopItem > m_aAuthorModsList
void OpenSelectReport(notnull SCR_WorkshopItem item)
void OnItemReportedSuccessfully(bool isAuthorBlocked)
Action for removing author mod content blocking.
bool GetOffline()
True when we have the item on our local storage.
Workshop Item instance.
SCR_FieldOfViewSettings Attribute