Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_NewsSubMenu.c
Go to the documentation of this file.
2class SCR_NewsEntry
10 {
11 m_Item = item;
12 }
13
14 void SetTile(SCR_NewsTileComponent tile, Widget w)
15 {
16 m_Tile = tile;
17 m_wRoot = w;
18 }
19}
20
21class SCR_NewsSubMenu : SCR_SubMenuBase
22{
23 [Attribute("{02155A85F2DC521F}UI/layouts/Menus/PlayMenu/PlayMenuTile.layout", UIWidgets.ResourceNamePicker, "", "layout")]
24 protected ResourceName m_Layout;
25
26 protected static ref array<ref SCR_NewsEntry> m_aEntries = {};
27
30 protected bool m_bEntriesDisplayed;
31
32 //------------------------------------------------------------------------------------------------
33 override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
34 {
35 super.OnTabCreate(menuRoot, buttonsLayout, index);
36
38
39 Widget simpleMessageRoot = m_wRoot.FindAnyWidget("SimpleMessage");
40 if (simpleMessageRoot)
41 m_SimpleMessage = SCR_SimpleMessageComponent.Cast(simpleMessageRoot.FindHandler(SCR_SimpleMessageComponent));
42
45 }
46
47 //------------------------------------------------------------------------------------------------
48 override void OnTabShow()
49 {
50 super.OnTabShow();
51
52 if (m_SimpleMessage && SCR_ServicesStatusHelper.GetLastReceivedCommStatus() != SCR_ECommStatus.FINISHED && m_aEntries.IsEmpty())
53 m_SimpleMessage.SetVisible(true);
54 else
56 }
57
58 //------------------------------------------------------------------------------------------------
59 override void OnTabHide()
60 {
61 super.OnTabHide();
62
63 m_bEntriesDisplayed = false;
64 }
65
66 //------------------------------------------------------------------------------------------------
67 override void OnTabRemove()
68 {
69 super.OnTabRemove();
71
72 m_bEntriesDisplayed = false;
73 }
74
75 //------------------------------------------------------------------------------------------------
76 protected void SetNewsEntries()
77 {
78 MainMenuUI.GetNewsEntries(m_aEntries);
79
80 if (m_aEntries.IsEmpty())
81 {
83 return;
84 }
85
87 return;
88
90 m_SimpleMessage.SetVisible(false);
91
92 m_Gallery.ClearAll();
93
94 foreach (SCR_NewsEntry entry : m_aEntries)
95 {
96 Widget w = GetGame().GetWorkspace().CreateWidgets(m_Layout);
97 if (!w)
98 continue;
99
101 if (!tile)
102 continue;
103
104 entry.SetTile(tile, tile.m_wRoot);
105 tile.m_OnRead.Insert(OnRead);
106 tile.ShowTile(entry);
107
108 m_Gallery.AddItem(w);
109 }
110
111 m_bEntriesDisplayed = true;
112 }
113
114 //------------------------------------------------------------------------------------------------
115 protected void OnRead(SCR_NewsTileComponent comp)
116 {
117 string url = comp.m_Entry.m_Item.URL();
118 if (url.IsEmpty())
119 return;
120
121 GetGame().GetPlatformService().OpenBrowser(url);
122 }
123
124 //------------------------------------------------------------------------------------------------
125 protected void OnCommStatusCheckFinished(SCR_ECommStatus status, float responseTime, float lastSuccessTime, float lastFailTime)
126 {
127 if (!m_bShown)
128 return;
129
130 if (status == SCR_ECommStatus.FINISHED)
132 else
134 }
135
136 //------------------------------------------------------------------------------------------------
137 protected void ShowErrorDialog()
138 {
139 if (!m_bShown)
140 return;
141
142 SCR_ConfigurableDialogUi dialog = SCR_CommonDialogs.CreateTimeoutOkDialog();
143 if (dialog)
144 dialog.m_OnConfirm.Insert(OnErrorDialogClose);
145
146 m_bEntriesDisplayed = false;
147 }
148
149 //------------------------------------------------------------------------------------------------
150 protected void OnErrorDialogClose()
151 {
152 if (!m_bShown)
153 return;
154
156 }
157}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ResourceName m_Layout
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Widget m_wRoot
bool m_bShown
void OnRead(SCR_NewsTileComponent comp)
void ShowErrorDialog()
SCR_NewsTileComponent m_Tile
SCR_GalleryComponent m_Gallery
bool m_bEntriesDisplayed
void SetNewsEntries()
void OnErrorDialogClose()
SCR_SimpleMessageComponent m_SimpleMessage
NewsFeedItem m_Item
void OnCommStatusCheckFinished(SCR_ECommStatus status, float responseTime, float lastSuccessTime, float lastFailTime)
bool m_bRead
SCR_EProfileSuperMenuTabId
SCR_ECommStatus
This class may become obsolete on BackendAPI update.
ref array< ref SCR_VONEntry > m_aEntries
New Feed data structure.
void ShowTile(SCR_NewsEntry entry)
static ScriptInvokerCommStatus GetOnCommStatusCheckFinished()
static SCR_ECommStatus GetLastReceivedCommStatus()
void RequestTabChange(int newTabIndex)
void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
SCR_FieldOfViewSettings Attribute