Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ModDetailsSuperMenuComponent.c
Go to the documentation of this file.
2 {
3  OVERVIEW = 0,
5 }
6 
7 class SCR_ModDetailsSuperMenuComponent : SCR_SuperMenuComponent
8 {
10  protected ref array<ref SCR_WorkshopItem> m_aDependencies = {};
11 
12  //------------------------------------------------------------------------------------------------
14  override SCR_SubMenuBase OnTabCreate(SCR_TabViewComponent comp, Widget w, int index)
15  {
16  SCR_SubMenuBase subMenu = SCR_SubMenuBase.Cast(w.FindHandler(SCR_SubMenuBase));
17  if (!subMenu)
18  return null;
19 
20  SCR_ContentBrowser_AddonsSubMenu dependencySubMenu = SCR_ContentBrowser_AddonsSubMenu.Cast(subMenu);
21  if (dependencySubMenu)
22  dependencySubMenu.SetWorkshopItems(m_aDependencies);
23 
24  return super.OnTabCreate(comp, w, index);
25  }
26 
27  //------------------------------------------------------------------------------------------------
29  {
30  m_WorkshopItem = item;
31 
32  // Request data from the backend, if this item is present in the backend and we are connected
33  if (m_WorkshopItem.GetOnline() && SCR_ServicesStatusHelper.IsBackendReady() && GetGame().GetBackendApi().IsAuthenticated())
34  {
35  m_WorkshopItem.m_OnGetAsset.Insert(OnDetailsLoaded);
36  m_WorkshopItem.m_OnDependenciesLoaded.Insert(OnAskDetailsGetDependencyTree);
37 
38  m_WorkshopItem.LoadDetails();
39  }
40  else
41  {
42  // If this item is purely local, we call the callbacks ourselves
43  string gameEnv = GetGame().GetBackendApi().GetBackendEnv();
44  string modEnv = m_WorkshopItem.GetWorkshopItem().GetBackendEnv();
45  if (gameEnv == modEnv)
46  {
49  }
50  }
51  }
52 
53  // SCR_WorkshopItem requests
54  //------------------------------------------------------------------------------------------------
55  protected void OnDetailsLoaded()
56  {
57  #ifdef WORKSHOP_DEBUG
58  m_WorkshopItem.LogState();
59  #endif
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  // Called when we have received dependencies
65  {
66  // Whole list of dependencies is available now
67  m_aDependencies = m_WorkshopItem.GetLatestDependencies();
68 
69  if (m_aDependencies.IsEmpty())
70  return;
71 
72  SCR_ContentBrowser_AddonsSubMenu dependencySubMenu;
73 
74  if (m_aSubMenus.IsIndexValid(SCR_EModDetailsMenuTabs.DEPENDENCY))
75  dependencySubMenu = SCR_ContentBrowser_AddonsSubMenu.Cast(m_aSubMenus[SCR_EModDetailsMenuTabs.DEPENDENCY]);
76 
77  if (dependencySubMenu)
78  dependencySubMenu.SetWorkshopItems(m_aDependencies);
79 
80  // Load details for all dependencies, so we have data about reported state
81  foreach (SCR_WorkshopItem dep : m_aDependencies)
82  {
83  dep.LoadDetails();
84  }
85 
86  GetTabView().EnableTab(SCR_EModDetailsMenuTabs.DEPENDENCY, true);
87  }
88 }
m_WorkshopItem
enum SCR_EModDetailsMenuTabs m_WorkshopItem
SCR_EModDetailsMenuTabs
SCR_EModDetailsMenuTabs
Definition: SCR_ModDetailsSuperMenuComponent.c:1
SCR_SuperMenuComponent
Definition: SCR_SuperMenuComponent.c:10
DEPENDENCY
@ DEPENDENCY
Definition: SCR_ModDetailsSuperMenuComponent.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
OVERVIEW
@ OVERVIEW
Definition: SCR_ModDetailsSuperMenuComponent.c:3
SCR_SubMenuBase
Definition: SCR_SubMenuBase.c:6
OnAskDetailsGetDependencyTree
protected void OnAskDetailsGetDependencyTree()
Definition: SCR_ModDetailsSuperMenuComponent.c:64
SCR_WorkshopItem
Definition: SCR_WorkshopItem.c:21
SCR_TabViewComponent
Definition: SCR_TabViewComponent.c:13
OnDetailsLoaded
protected void OnDetailsLoaded()
Definition: SCR_ModDetailsSuperMenuComponent.c:55
m_aDependencies
protected ref array< ref SCR_WorkshopItem > m_aDependencies
Definition: SCR_ModDetailsSuperMenuComponent.c:10
OnTabCreate
override SCR_SubMenuBase OnTabCreate(SCR_TabViewComponent comp, Widget w, int index)
Callback passed to tab view, called when a new tab is created.
Definition: SCR_ModDetailsSuperMenuComponent.c:14
SetWorkshopItem
void SetWorkshopItem(SCR_WorkshopItem item)
Definition: SCR_ModDetailsSuperMenuComponent.c:28
SCR_ServicesStatusHelper
Definition: SCR_ServicesStatusHelper.c:15
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17