Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
AddonsToolsUI.c
Go to the documentation of this file.
1 
8 {
9  PRESETS,
12 }
13 
14 class AddonsToolsUI : SCR_TabDialog
15 {
16  //------------------------------------------------------------------------------------------------
18  {
19  super.OnMenuOpen(preset);
20 
21  // Setup workshop button
22  SCR_InputButtonComponent workshopButton = FindButton("NavOpenWorkshop");
23 
24  if (workshopButton)
25  {
26  workshopButton.SetVisible(!IsAddonManagerOpened());
27  workshopButton.m_OnActivated.Insert(OnOpenWorkshopButton);
28  }
29 
30  // Mod enabled callback
32  SCR_AddonManager.GetInstance().m_OnAddonsEnabledChanged.Insert(EnableExportTabs);
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override void OnMenuClose()
37  {
38  super.OnMenuClose();
39 
40  SCR_AddonManager.GetInstance().m_OnAddonsEnabledChanged.Remove(EnableExportTabs);
41  }
42 
43  //------------------------------------------------------------------------------------------------
45  protected bool IsAddonManagerOpened()
46  {
47  // Workshop opened
48  ContentBrowserUI workshopUI = ContentBrowserUI.Cast(GetGame().GetMenuManager().GetTopMenu());
49 
50  if (!workshopUI)
51  return false;
52 
53  return SCR_WorkshopListAddonsSubmenu.Cast(workshopUI.GetOpenedSubMenu());
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  protected void OnOpenWorkshopButton()
58  {
59  SCR_MenuToolsLib.GetEventOnAllMenuClosed().Insert(AllMenuClosed);
60  SCR_MenuToolsLib.CloseAllMenus({MainMenuUI, ContentBrowserUI});
61  }
62 
63  //------------------------------------------------------------------------------------------------
64  override protected void OnCancel()
65  {
66  if (!GetGame().GetInputManager().IsContextActive("MenuTextEditContext"))
67  super.OnCancel();
68  }
69 
70  //------------------------------------------------------------------------------------------------
72  protected void AllMenuClosed()
73  {
74  SCR_MenuToolsLib.GetEventOnAllMenuClosed().Remove(AllMenuClosed);
75  Close();
76 
77  ContentBrowserUI workshopUI = ContentBrowserUI.Cast(GetGame().GetMenuManager().GetTopMenu());
78  if (!workshopUI)
79  workshopUI = ContentBrowserUI.Cast(GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.ContentBrowser));
80 
81  // Open tab
82  if (workshopUI)
83  workshopUI.OpenModManager();
84  }
85 
86  //------------------------------------------------------------------------------------------------
88  protected void EnableExportTabs()
89  {
90  SCR_TabViewComponent tabView = m_SuperMenuComponent.GetTabView();
91  if (!tabView)
92  return;
93 
95  {
96  tabView.SetTabVisible(SCR_EModPresetsDialogTabs.EXPORT_JSON, false, false);
97  tabView.SetTabVisible(SCR_EModPresetsDialogTabs.EXPORT_CLI, false, false);
98  tabView.SetPagingButtonsVisible(false, false);
99  return;
100  }
101 
102  bool enable = (SCR_AddonManager.GetInstance().CountOfEnabledAddons() > 0);
103 
104  tabView.EnableTab(SCR_EModPresetsDialogTabs.EXPORT_JSON, enable);
105  tabView.EnableTab(SCR_EModPresetsDialogTabs.EXPORT_CLI, enable);
106  }
107 }
SCR_MenuToolsLib
Definition: SCR_MenuToolsLib.c:5
SCR_EModPresetsDialogTabs
SCR_EModPresetsDialogTabs
Definition: AddonsToolsUI.c:7
EnableExportTabs
protected void EnableExportTabs()
Enable export tabs only if player has enabled mods.
Definition: AddonsToolsUI.c:88
IsAddonManagerOpened
protected bool IsAddonManagerOpened()
Return true if workshop is opened on tab "Mod manager".
Definition: AddonsToolsUI.c:45
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
EXPORT_JSON
EXPORT_JSON
Definition: AddonsToolsUI.c:3
IsPlatformGameConsole
bool IsPlatformGameConsole()
Definition: game.c:1393
SCR_TabViewComponent
Definition: SCR_TabViewComponent.c:13
OnOpenWorkshopButton
protected void OnOpenWorkshopButton()
Definition: AddonsToolsUI.c:57
SCR_WorkshopListAddonsSubmenu
Definition: SCR_WorkshopListAddonsSubmenu.c:1
SCR_TabDialog
Definition: SCR_TabDialog.c:9
MainMenuUI
Definition: MainMenuUI.c:1
OnMenuClose
override void OnMenuClose()
Definition: AddonsToolsUI.c:36
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
SCR_AddonManager
Definition: SCR_AddonManager.c:72
PRESETS
PRESETS
Definition: AddonsToolsUI.c:2
OnCancel
override protected void OnCancel()
Definition: AddonsToolsUI.c:64
EXPORT_CLI
EXPORT_CLI
Definition: AddonsToolsUI.c:5
AllMenuClosed
protected void AllMenuClosed()
Callback for when all additional menu are closed and top menu is main menu.
Definition: AddonsToolsUI.c:72
FindButton
SCR_InputButtonComponent FindButton(string tag)
Returns a button with given tag.
Definition: SCR_BrowserHoverTooltipComponent.c:116
OnMenuOpen
enum SCR_EModPresetsDialogTabs OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
Definition: AddonsToolsUI.c:17
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1