Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
ContentBrowserUI.c
Go to the documentation of this file.
1
enum
EWorkshopTabId
2
{
3
MANW
= 0,
4
ONLINE
,
5
GAME_SAVES
,
6
OFFLINE
,
7
MOD_MANAGER
8
}
9
11
class
ContentBrowserUI :
SCR_SuperMenuBase
12
{
13
protected
SCR_InputButtonComponent
m_NavBack
;
14
static
const
float
SMALL_DOWNLOAD_THRESHOLD = 50 * 1024 * 1024;
// 50 Megabytes
15
16
float
m_fTimerLowFreqUpdate
;
17
18
//------------------------------------------------------------------------------------------------
19
static
ContentBrowserUI Create()
20
{
21
MenuBase
menuBase =
GetGame
().GetMenuManager().OpenMenu(
ChimeraMenuPreset
.ContentBrowser);
22
ContentBrowserUI browser = ContentBrowserUI.Cast(menuBase);
23
24
return
browser;
25
}
26
27
// --- Overrides ---
28
//------------------------------------------------------------------------------------------------
29
override
void
OnMenuOpen
()
30
{
31
super.OnMenuOpen();
32
33
// Setup the 'back' nav button
34
m_NavBack
= m_DynamicFooter.FindButton(
UIConstants
.BUTTON_BACK);
35
if
(
m_NavBack
)
36
m_NavBack
.m_OnActivated.Insert(
Close
);
37
38
// Hide news menu button (top right corner) on PS
39
if
(
GetGame
().GetPlatformService().GetLocalPlatformKind() ==
PlatformKind
.PSN)
40
{
41
Widget
newsButton =
GetRootWidget
().FindAnyWidget(
"NewsButton"
);
42
if
(newsButton)
43
{
44
newsButton.SetVisible(
false
);
45
newsButton.SetEnabled(
false
);
46
}
47
}
48
}
49
50
//------------------------------------------------------------------------------------------------
51
override
void
OnMenuShow
()
52
{
53
super.OnMenuShow();
54
55
//SCR_AnalyticsApplication.GetInstance().OpenWorkshop();
56
}
57
58
//------------------------------------------------------------------------------------------------
59
override
void
OnMenuClose
()
60
{
61
super.OnMenuClose();
62
63
// Restore server hosting
64
if
(!
GetGame
().
IsPlatformGameConsole
())
65
{
66
if
(ServerHostingUI.GetTemporaryConfig())
67
{
68
GetGame
().GetMenuManager().OpenMenu(
ChimeraMenuPreset
.ServerBrowserMenu);
69
SCR_CommonDialogs
.CreateServerHostingDialog();
70
}
71
}
72
}
73
74
//------------------------------------------------------------------------------------------------
75
override
void
OnMenuHide
()
76
{
77
super.OnMenuHide();
78
79
//SCR_AnalyticsApplication.GetInstance().CloseWorkshop();
80
}
81
82
//------------------------------------------------------------------------------------------------
83
override
void
OnMenuUpdate
(
float
tDelta)
84
{
85
super.OnMenuUpdate(tDelta);
86
87
m_fTimerLowFreqUpdate
+= tDelta;
88
if
(
m_fTimerLowFreqUpdate
> 1)
89
{
90
LowFreqUpdate
();
91
m_fTimerLowFreqUpdate
-= 1;
92
}
93
}
94
95
//------------------------------------------------------------------------------------------------
97
protected
void
LowFreqUpdate
()
98
{
99
SCR_AddonManager
mgr =
SCR_AddonManager
.
GetInstance
();
100
101
if
(!mgr)
102
return
;
103
104
// Warning sign
105
// Show warning icon if there is any offline mod which has any issue
106
array<ref SCR_WorkshopItem> allAddons = mgr.
GetAllAddons
();
107
array<ref SCR_WorkshopItem> offlineAddons =
SCR_AddonManager
.
SelectItemsBasic
(allAddons,
EWorkshopItemQuery
.OFFLINE);
108
109
bool
anyIssue;
110
foreach
(
SCR_WorkshopItem
item : offlineAddons)
111
{
112
anyIssue =
113
item.GetAnyDependencyMissing() ||
114
item.GetAnyDependencyUpdateAvailable() ||
115
item.GetEnabledAndAnyDependencyDisabled() ||
116
item.GetUpdateAvailable();
117
118
if
(anyIssue)
119
break
;
120
}
121
122
m_SuperMenuComponent.GetTabView().ShowIcon(
EWorkshopTabId
.OFFLINE, anyIssue);
123
}
124
125
// --- Public ---
126
//-----------------------------------------------------------------------------------------------
127
SCR_SubMenuBase
GetOpenedSubMenu
()
128
{
129
return
m_SuperMenuComponent.GetOpenedSubMenu();
130
}
131
132
//-----------------------------------------------------------------------------------------------
133
void
OpenModManager
()
134
{
135
m_SuperMenuComponent.GetTabView().ShowTab(
EWorkshopTabId
.MOD_MANAGER);
136
}
137
138
// --- Debug ---
139
//------------------------------------------------------------------------------------------------
140
#ifdef WORKSHOP_DEBUG
141
static
void
_print
(
string
str,
LogLevel
logLevel =
LogLevel
.DEBUG)
142
{
143
Print
(
string
.Format(
"[Content Browser] %1"
, str), logLevel);
144
}
145
#endif
146
}
OnMenuClose
override void OnMenuClose()
Definition
AddonsToolsUI.c:36
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
m_fTimerLowFreqUpdate
float m_fTimerLowFreqUpdate
Definition
ContentBrowserUI.c:16
OpenModManager
void OpenModManager()
Definition
ContentBrowserUI.c:133
LowFreqUpdate
void LowFreqUpdate()
Update non important UI elements.
Definition
ContentBrowserUI.c:97
GetOpenedSubMenu
SCR_SubMenuBase GetOpenedSubMenu()
Definition
ContentBrowserUI.c:127
EWorkshopTabId
EWorkshopTabId
Definition
ContentBrowserUI.c:2
MANW
@ MANW
Definition
ContentBrowserUI.c:3
MOD_MANAGER
@ MOD_MANAGER
Definition
ContentBrowserUI.c:7
GAME_SAVES
@ GAME_SAVES
Definition
ContentBrowserUI.c:5
m_NavBack
enum EWorkshopTabId m_NavBack
The super menu class for WORKSHOP content browser.
IsPlatformGameConsole
bool IsPlatformGameConsole()
Definition
game.c:1357
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
PlatformKind
PlatformKind
Definition
PlatformKind.c:8
EWorkshopItemQuery
EWorkshopItemQuery
Definition
SCR_AddonManager.c:35
OnMenuUpdate
void OnMenuUpdate(float tDelta)
Definition
SCR_CursorEditorUIComponent.c:423
OnMenuHide
override void OnMenuHide()
Definition
SCR_ModDetailsSuperMenuComponent.c:55
_print
void _print(string s)
Definition
SCR_ModularButtonComponent.c:678
GetRootWidget
Widget GetRootWidget()
Definition
SCR_ModularButtonComponent.c:189
OnMenuShow
override void OnMenuShow()
Definition
SCR_ProfileSuperMenu.c:41
OnMenuOpen
override void OnMenuOpen()
Definition
SCR_ProfileSuperMenu.c:12
OFFLINE
enum SCR_EServicePointType OFFLINE
ONLINE
enum SCR_EServicePointType ONLINE
Close
proto native void Close()
Definition
SCR_WorkshopDialogs.c:77
MenuBase
Definition
MenuBase.c:32
SCR_AddonManager
Definition
SCR_AddonManager.c:80
SCR_AddonManager::SelectItemsBasic
static array< ref SCR_WorkshopItem > SelectItemsBasic(array< ref SCR_WorkshopItem > items, EWorkshopItemQuery query)
Definition
SCR_AddonManager.c:304
SCR_AddonManager::GetAllAddons
array< ref SCR_WorkshopItem > GetAllAddons()
Returns array with all addons currently in the system - online and offline.
Definition
SCR_AddonManager.c:147
SCR_AddonManager::GetInstance
static SCR_AddonManager GetInstance()
Definition
SCR_AddonManager.c:139
SCR_CommonDialogs
Definition
CommonDialogs.c:6
SCR_InputButtonComponent
Definition
SCR_InputButtonComponent.c:2
SCR_SubMenuBase
Definition
SCR_SubMenuBase.c:7
SCR_SuperMenuBase
Definition
SCR_SuperMenuBase.c:7
SCR_WorkshopItem
Definition
SCR_WorkshopItem.c:28
UIConstants
Definition
Constants.c:151
Widget
Definition
Widget.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
scripts
Game
UI
Menu
ContentBrowser
MainMenu
ContentBrowserUI.c
Generated by
1.17.0