4 protected DialogUI m_BannedDetectionDialog;
6 protected ref array<string> m_aBannedItems = {};
7 protected static ref array<ref SCR_NewsEntry> m_aNews = {};
8 protected static ref array<ref SCR_NewsEntry> m_aNotifications = {};
9 protected ref array<ref Widget> m_aTiles = {};
11 protected static bool s_bDidCheckNetwork;
12 protected static const int SERVICES_STATUS_CHECK_DELAY = 2000;
13 protected bool m_bFirstLoad;
18 protected override void OnMenuOpen()
26 Widget content = w.FindAnyWidget(
"Grid");
27 Widget descriptionRoot = w.FindAnyWidget(
"Description");
28 Widget footer = w.FindAnyWidget(
"Footer");
29 if (!content || !descriptionRoot || !footer)
33 Widget child = content.GetChildren();
43 tile.m_OnClicked.Insert(OnTileClick);
44 tile.m_OnFocused.Insert(OnTileFocus);
45 child = child.GetSibling();
51 back.m_OnActivated.Insert(OnBack);
56 servicesStatus.m_OnActivated.Insert(OnServicesStatus);
60 feedback.m_OnActivated.Insert(OnFeedback);
64 credits.m_OnActivated.Insert(OnCredits);
67 GetGame().GetInputManager().AddActionListener(
"MenuBackWB", EActionTrigger.DOWN, OnBack);
72 GetNotificationEntries(
null);
75 if (!s_bDidCheckNetwork)
77 s_bDidCheckNetwork =
true;
78 GetGame().GetCallqueue().CallLater(CheckServicesStatusIfFocused, SERVICES_STATUS_CHECK_DELAY);
81 Widget logoWidget = w.FindAnyWidget(
"LogoButton");
84 SCR_ModularButtonComponent logo = SCR_ModularButtonComponent.FindComponent(logoWidget);
86 logo.m_OnClicked.Insert(OnLogoClicked);
90 GetGame().GetBackendApi().GetClientLobby().MeasureLatency(
null);
94 protected override void OnMenuOpened()
99 SCR_MenuLoadingComponent.LoadLastMenu();
100 SCR_MenuLoadingComponent.ClearLastMenu();
102 BaseContainer cont =
GetGame().GetGameUserSettings().GetModule(
"SCR_RecentGames");
106 cont.Set(
"m_bFirstTimePlay",
false);
112 GetGame().UserSettingsChanged();
116 bool firstLoadInSession = GameSessionStorage.s_Data[
"m_bMenuFirstOpening"].IsEmpty();
117 GameSessionStorage.s_Data[
"m_bMenuFirstOpening"] =
"false";
121 if (!firstLoadInSession)
131 protected override void OnMenuFocusLost()
135 super.OnMenuFocusLost();
139 protected override void OnMenuFocusGained()
144 GetGame().GetWorkspace().SetFocusedWidget(m_FocusedTile.GetRootWidget(),
true);
146 super.OnMenuFocusGained();
150 protected void OnBack()
159 protected void OnCredits()
172 GetGame().GetMenuManager().OpenDialog(preset);
176 GetGame().GetMenuManager().OpenMenu(preset);
185 m_FocusedTile = comp;
189 protected void OnButtonSelect()
195 OnTileClick(m_FocusedTile);
199 void OnServicesStatus()
208 protected void OnFeedback()
217 protected void OnLogoClicked()
223 protected void RestoreFocus()
226 GetGame().GetWorkspace().SetFocusedWidget(m_FocusedTile.GetRootWidget());
230 static int GetNewsEntries(out array<ref SCR_NewsEntry> entries =
null)
238 for (
int i, cnt =
GetGame().GetBackendApi().GetNewsCount(); i < cnt; i++)
240 NewsFeedItem item =
GetGame().GetBackendApi().GetNewsItem(i);
248 return m_aNews.Count();
252 static int GetNotificationEntries(out array<ref SCR_NewsEntry> entries =
null)
257 m_aNotifications.Clear();
260 for (
int i, cnt =
GetGame().GetBackendApi().GetNotifyCount(); i < cnt; i++)
262 NewsFeedItem item =
GetGame().GetBackendApi().GetNotifyItem(i);
268 entries = m_aNotifications;
270 return m_aNotifications.Count();
274 static int GetUnreadNewsCount()
286 static int GetUnreadNotificationCount()
300 protected static void TryExitGame()
302 int nCompleted, nTotal;
305 mgr.GetDownloadQueueState(nCompleted, nTotal);
315 protected void CheckServicesStatusIfFocused()