Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AddonListDialog.c
Go to the documentation of this file.
1
2// TODO: Cleanup and update looks
4{
5 protected ref array<ref SCR_WorkshopItem> m_aItems = {};
6 protected ref array<SCR_DownloadManager_AddonDownloadLine> m_aDownloadLines = {};
7
8 protected const ResourceName ADDON_LINE_LAYOUT = "{BB5AEDDA3C4134FD}UI/layouts/Menus/ContentBrowser/DownloadManager/DownloadManager_AddonDownloadLineConfirmation.layout";
9
10 //------------------------------------------------------------------------------------------------
11 void SCR_AddonListDialog(array<ref SCR_WorkshopItem> items, string preset)
12 {
13 m_aItems = items;
14
15 if (!preset.IsEmpty())
17 }
18
19 //------------------------------------------------------------------------------------------------
21 {
23
24 // Create widgets
25 foreach (SCR_WorkshopItem item : m_aItems)
26 {
27 Widget w = GetGame().GetWorkspace().CreateWidgets(ADDON_LINE_LAYOUT, layout);
28
30 comp.InitForWorkshopItem(item, null, false);
31
32 m_aDownloadLines.Insert(comp);
33 }
34
35 super.OnMenuOpen(preset);
36 }
37
38 //------------------------------------------------------------------------------------------------
39 static SCR_AddonListDialog CreateItemsList(array<ref SCR_WorkshopItem> items, string preset, ResourceName dialogsConfig = string.Empty)
40 {
41 if (dialogsConfig == string.Empty)
42 dialogsConfig = SCR_WorkshopDialogs.DIALOGS_CONFIG;
43
44 SCR_AddonListDialog addonListDialog = new SCR_AddonListDialog(items, "");
45 SCR_ConfigurableDialogUi.CreateFromPreset(dialogsConfig, preset, addonListDialog);
46 return addonListDialog;
47 }
48
49 //------------------------------------------------------------------------------------------------
51 static SCR_AddonListDialog CreateRestrictedAddonsDownload(array<ref SCR_WorkshopItem> items)
52 {
53 return DisplayRestrictedAddonsList(items, "error_restricted_dependencies_download", "error_reported_dependencies_download");
54 }
55
56 //------------------------------------------------------------------------------------------------
58 static SCR_AddonListDialog CreateRestrictedAddonsJoinServer(array<ref SCR_WorkshopItem> items)
59 {
60 return DisplayRestrictedAddonsList(items, "error_restricted_addons_join_server", "error_reported_addons_join_server");
61 }
62
63 //------------------------------------------------------------------------------------------------
65 static SCR_AddonListDialog DisplayRestrictedAddonsList(array<ref SCR_WorkshopItem> items, string tagBlocked, string tagReported)
66 {
67 // Banned specific
68 array<ref SCR_WorkshopItem> banned = SCR_AddonManager.SelectItemsOr(items, EWorkshopItemQuery.BLOCKED);
69
70 if (!banned.IsEmpty())
71 return new SCR_AddonListDialog(banned, tagBlocked);
72
73 // Reported
74 array<ref SCR_WorkshopItem> reported = SCR_AddonManager.SelectItemsOr(items, EWorkshopItemQuery.REPORTED_BY_ME | EWorkshopItemQuery.AUTHOR_BLOCKED);
75 return new SCR_ReportedAddonsDialog(reported, tagReported);
76 }
77
78 //------------------------------------------------------------------------------------------------
80 static SCR_AddonListDialog CreateFailedToStartWithMods(array<ref SCR_WorkshopItem> items)
81 {
82 return new SCR_AddonListDialog(items, "error_failed_to_start_with_mods");
83 }
84
85 //------------------------------------------------------------------------------------------------
86 array<SCR_DownloadManager_AddonDownloadLine> GetDonwloadLines()
87 {
88 return m_aDownloadLines;
89 }
90}
91
94{
96
97 //------------------------------------------------------------------------------------------------
98 void SCR_DisableDependentAddonsDialog(array<ref SCR_WorkshopItem> items, string preset, SCR_WorkshopItem dependency)
99 {
100 m_Dependency = dependency;
101 }
102
103 //------------------------------------------------------------------------------------------------
104 static SCR_DisableDependentAddonsDialog CreateDisableDependentAddons(array<ref SCR_WorkshopItem> items, SCR_WorkshopItem dependency)
105 {
106 return new SCR_DisableDependentAddonsDialog(items, "disable_dependent_addons", dependency);
107 }
108
109 //------------------------------------------------------------------------------------------------
110 override void OnConfirm()
111 {
112 // Disable the dependency too
113 m_Dependency.SetEnabled(false);
114
115 foreach (SCR_WorkshopItem item : m_aItems)
116 {
117 if (item.GetOffline())
118 item.SetEnabled(false);
119 }
120
121 super.OnConfirm();
122 }
123
124 //------------------------------------------------------------------------------------------------
125 override void OnCancel()
126 {
127 // Enable back the dependency
128 m_Dependency.SetEnabled(true);
129
130 super.OnCancel();
131 }
132}
133
136{
138
139 //------------------------------------------------------------------------------------------------
140 static SCR_DeleteAddonDependentAddonsDetected Create(array<ref SCR_WorkshopItem> items, SCR_WorkshopItem item)
141 {
142 return new SCR_DeleteAddonDependentAddonsDetected(items, "delete_dependent_addons_detected", item);
143 }
144
145 //------------------------------------------------------------------------------------------------
146 protected void SCR_DeleteAddonDependentAddonsDetected(array<ref SCR_WorkshopItem> items, string preset, SCR_WorkshopItem item)
147 {
148 m_Item = item;
149 }
150
151 //------------------------------------------------------------------------------------------------
153 override void OnConfirm()
154 {
155 if (m_Item.GetSubscribed())
156 m_Item.SetSubscribed(false);
157
158 m_Item.DeleteLocally();
159
160 foreach (SCR_WorkshopItem item : m_aItems)
161 {
162 if (item.GetEnabled())
163 item.SetEnabled(false);
164 }
165
166 super.OnConfirm();
167 }
168}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AddonListDialog m_Dependency
Dialog which is used when an addon is disabled but some dependent addons depend on it.
void SCR_DisableDependentAddonsDialog(array< ref SCR_WorkshopItem > items, string preset, SCR_WorkshopItem dependency)
EWorkshopItemQuery
UI layouts Menus CleanSweep CleanSweepAreaSelection layout
ref array< ref SCR_MenuNavigationItem > m_aItems
Shows a list of addons and some text.
array< SCR_DownloadManager_AddonDownloadLine > GetDonwloadLines()
static SCR_AddonListDialog CreateRestrictedAddonsJoinServer(array< ref SCR_WorkshopItem > items)
Dialog when trying to connect to a server with restricted addons.
static SCR_AddonListDialog CreateItemsList(array< ref SCR_WorkshopItem > items, string preset, ResourceName dialogsConfig=string.Empty)
static SCR_AddonListDialog CreateRestrictedAddonsDownload(array< ref SCR_WorkshopItem > items)
Dialog when downloading restricted addons.
ref array< ref SCR_WorkshopItem > m_aItems
void SCR_AddonListDialog(array< ref SCR_WorkshopItem > items, string preset)
ref array< SCR_DownloadManager_AddonDownloadLine > m_aDownloadLines
static SCR_AddonListDialog CreateFailedToStartWithMods(array< ref SCR_WorkshopItem > items)
Dialog when failed to load game with selected mods.
static SCR_AddonListDialog DisplayRestrictedAddonsList(array< ref SCR_WorkshopItem > items, string tagBlocked, string tagReported)
Display dialogs for reported and blocked (banned) mods.
const ResourceName ADDON_LINE_LAYOUT
override void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
static array< ref SCR_WorkshopItem > SelectItemsOr(array< ref SCR_WorkshopItem > items, EWorkshopItemQuery query)
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.
void SCR_DeleteAddonDependentAddonsDetected(array< ref SCR_WorkshopItem > items, string preset, SCR_WorkshopItem item)
static SCR_DeleteAddonDependentAddonsDetected Create(array< ref SCR_WorkshopItem > items, SCR_WorkshopItem item)
override void OnConfirm()
Delete the provided addon on confirmation. Disable dependent addons if they are enabled.
void InitForWorkshopItem(SCR_WorkshopItem item, Revision versionTo=null, bool showVersionAndSize=true)
Initializes the line in passive mode. It will just show basic information once.
Show list of reported mods and provide option to cancel reports.