Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AddonUpdateConfirmationDialog.c
Go to the documentation of this file.
1 
8 //------------------------------------------------------------------------------------------------
10 {
11  //------------------------------------------------------------------------------------------------
13  static SCR_AddonUpdateConfirmationDialog CreateForUpdates(notnull array<ref Tuple2<SCR_WorkshopItem, ref Revision>> addonsAndVersions, bool subscribeToAddons)
14  {
16 
17  SetupDownloadDialogAddons(dlg, addonsAndVersions, subscribeToAddons);
18 
19  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_WorkshopUiCommon.DIALOGS_CONFIG, "download_confirmation", dlg);
20 
21  dlg.SetStyleDownloadAddons();
22 
23  return SCR_AddonUpdateConfirmationDialog.Cast(dlg);
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  protected override void CreateAddonList()
28  {
29  // Create lines for other addons
30  m_Widgets.m_OtherAddonsSection.SetVisible(!m_aDependencies.IsEmpty());
31  if (!m_aDependencies.IsEmpty())
32  {
33  // Not downloaded - not avaiable offline
34  array<ref SCR_WorkshopItem> missingAddons = SCR_AddonManager.SelectItemsBasic(m_aDependencies, EWorkshopItemQuery.NOT_OFFLINE);
35 
36  foreach (SCR_WorkshopItem missing : missingAddons)
37  {
38  CreateAddonWidget(missing, m_Widgets.m_OtherAddonsList);
39  }
40 
41  // Version difference
42  array<ref SCR_WorkshopItem> versionDifferences = SCR_AddonManager.SelectItemsAnd(
44  EWorkshopItemQuery.UPDATE_AVAILABLE | EWorkshopItemQuery.OFFLINE);
45 
46  int vDifCount = versionDifferences.Count();
47  bool hasDifference = vDifCount > 0;
48 
49  // Display version difference widgets
50  m_Widgets.m_UpdateAddonsList.SetVisible(hasDifference);
51  m_Widgets.m_UpdateAddonsMessage.SetVisible(hasDifference);
52  m_Widgets.m_UpdateSpacer.SetVisible(hasDifference && missingAddons.IsEmpty());
53 
54  if (hasDifference)
55  {
56  // Create woidgets
57  foreach (SCR_WorkshopItem addon : versionDifferences)
58  {
59  if (!addon.IsDownloadRunning())
60  CreateAddonWidget(addon, m_Widgets.m_UpdateAddonsList);
61  }
62 
63  // Version change text
64  m_Widgets.m_UpdateAddonsMessage.SetTextFormat("#AR-Workshop_Dialog_ConfirmDownload_VersionDifferences", vDifCount);
65  }
66  }
67  }
68 
69  //------------------------------------------------------------------------------------------------
71  protected override void CreateAddonWidget(notnull SCR_WorkshopItem dep, Widget listRoot)
72  {
73  Widget w = GetGame().GetWorkspace().CreateWidgets(DOWNLOAD_LINE_LAYOUT, listRoot);
75 
76  // Setup addon revision
77  Revision revision = dep.GetLatestRevision();
78 
79  //Revision revision = dep.GetDependency().GetRevision();
80  comp.InitForWorkshopItem(dep, revision);
81  }
82 }
DOWNLOAD_LINE_LAYOUT
const protected ResourceName DOWNLOAD_LINE_LAYOUT
Definition: SCR_WorkshopUiCommon.c:684
SCR_DownloadConfirmationDialog
Dialog for confirming multiple downloads in workshop.
Definition: SCR_DownloadConfirmationDialog.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_Widgets
ref SCR_VoNOverlay_ElementWidgets m_Widgets
Definition: SCR_VonDisplay.c:3
SCR_WorkshopItem
Definition: SCR_WorkshopItem.c:21
m_aDependencies
protected ref array< ref SCR_WorkshopItem > m_aDependencies
Definition: SCR_ModDetailsSuperMenuComponent.c:10
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
SCR_AddonManager
Definition: SCR_AddonManager.c:72
SCR_AddonUpdateConfirmationDialog
Definition: SCR_AddonUpdateConfirmationDialog.c:9
SCR_WorkshopUiCommon
Definition: SCR_WorkshopUiCommon.c:5
SCR_DownloadManager_AddonDownloadLine
Definition: SCR_DownloadManager_AddonDownloadLine.c:5
EWorkshopItemQuery
EWorkshopItemQuery
Definition: SCR_AddonManager.c:34