Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_NewsSubMenu.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_NewsEntry
3
{
4
NewsFeedItem
m_Item
;
5
SCR_NewsTileComponent
m_Tile
;
6
Widget
m_wRoot
;
7
bool
m_bRead
;
8
9
void
SCR_NewsEntry
(
NewsFeedItem
item)
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
21
class
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
28
protected
SCR_GalleryComponent
m_Gallery
;
29
protected
SCR_SimpleMessageComponent
m_SimpleMessage
;
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
37
m_Gallery
=
SCR_GalleryComponent
.
GetGalleryComponent
(
"Gallery"
,
m_wRoot
);
38
39
Widget
simpleMessageRoot =
m_wRoot
.FindAnyWidget(
"SimpleMessage"
);
40
if
(simpleMessageRoot)
41
m_SimpleMessage
=
SCR_SimpleMessageComponent
.Cast(simpleMessageRoot.FindHandler(
SCR_SimpleMessageComponent
));
42
43
SCR_ServicesStatusHelper
.
RefreshPing
();
44
SCR_ServicesStatusHelper
.
GetOnCommStatusCheckFinished
().Insert(
OnCommStatusCheckFinished
);
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
55
SetNewsEntries
();
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();
70
SCR_ServicesStatusHelper
.
GetOnCommStatusCheckFinished
().Remove(
OnCommStatusCheckFinished
);
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
{
82
ShowErrorDialog
();
83
return
;
84
}
85
86
if
(
m_bEntriesDisplayed
)
87
return
;
88
89
if
(
m_SimpleMessage
)
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
100
SCR_NewsTileComponent
tile =
SCR_NewsTileComponent
.Cast(w.FindHandler(
SCR_NewsTileComponent
));
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)
131
SetNewsEntries
();
132
else
133
ShowErrorDialog
();
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
155
RequestTabChange
(
SCR_EProfileSuperMenuTabId
.COMMUNITY);
156
}
157
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
m_Layout
ResourceName m_Layout
Definition
SCR_ActionsToolbarEditorUIComponent.c:4
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
m_wRoot
Widget m_wRoot
Definition
SCR_GameModeCleanSweep.c:25
m_bShown
bool m_bShown
Definition
SCR_InfoDisplay.c:61
OnRead
void OnRead(SCR_NewsTileComponent comp)
Definition
SCR_NewsSubMenu.c:115
ShowErrorDialog
void ShowErrorDialog()
Definition
SCR_NewsSubMenu.c:137
m_Tile
SCR_NewsTileComponent m_Tile
Definition
SCR_NewsSubMenu.c:1
m_Gallery
SCR_GalleryComponent m_Gallery
Definition
SCR_NewsSubMenu.c:28
m_bEntriesDisplayed
bool m_bEntriesDisplayed
Definition
SCR_NewsSubMenu.c:30
SetNewsEntries
void SetNewsEntries()
Definition
SCR_NewsSubMenu.c:76
OnErrorDialogClose
void OnErrorDialogClose()
Definition
SCR_NewsSubMenu.c:150
m_SimpleMessage
SCR_SimpleMessageComponent m_SimpleMessage
Definition
SCR_NewsSubMenu.c:29
m_Item
NewsFeedItem m_Item
Definition
SCR_NewsSubMenu.c:0
OnCommStatusCheckFinished
void OnCommStatusCheckFinished(SCR_ECommStatus status, float responseTime, float lastSuccessTime, float lastFailTime)
Definition
SCR_NewsSubMenu.c:125
m_bRead
bool m_bRead
Definition
SCR_NewsSubMenu.c:3
SCR_EProfileSuperMenuTabId
SCR_EProfileSuperMenuTabId
Definition
SCR_ProfileSuperMenu.c:2
SCR_ECommStatus
SCR_ECommStatus
This class may become obsolete on BackendAPI update.
Definition
SCR_ServicesStatusHelper.c:3
m_aEntries
ref array< ref SCR_VONEntry > m_aEntries
Definition
SCR_VONController.c:67
NewsFeedItem
New Feed data structure.
Definition
NewsFeedItem.c:14
ResourceName
Definition
ResourceName.c:13
SCR_CommonDialogs
Definition
CommonDialogs.c:6
SCR_ConfigurableDialogUi
Definition
SCR_ConfigurableDialogUI.c:17
SCR_ConfigurableDialogUi::m_OnConfirm
ref ScriptInvoker m_OnConfirm
Definition
SCR_ConfigurableDialogUI.c:47
SCR_GalleryComponent
Definition
SCR_GalleryComponent.c:2
SCR_GalleryComponent::GetGalleryComponent
static SCR_GalleryComponent GetGalleryComponent(string name, Widget parent, bool searchAllChildren=true)
Definition
SCR_GalleryComponent.c:460
SCR_NewsEntry
Definition
SCR_NewsSubMenu.c:3
SCR_NewsTileComponent
Definition
SCR_NewsTileComponent.c:2
SCR_NewsTileComponent::ShowTile
void ShowTile(SCR_NewsEntry entry)
Definition
SCR_NewsTileComponent.c:130
SCR_ServicesStatusHelper
Definition
SCR_ServicesStatusHelper.c:16
SCR_ServicesStatusHelper::GetOnCommStatusCheckFinished
static ScriptInvokerCommStatus GetOnCommStatusCheckFinished()
Definition
SCR_ServicesStatusHelper.c:422
SCR_ServicesStatusHelper::RefreshPing
static void RefreshPing()
Definition
SCR_ServicesStatusHelper.c:94
SCR_ServicesStatusHelper::GetLastReceivedCommStatus
static SCR_ECommStatus GetLastReceivedCommStatus()
Definition
SCR_ServicesStatusHelper.c:223
SCR_SimpleMessageComponent
Definition
SCR_SimpleMessageComponent.c:2
SCR_SubMenuBase
Definition
SCR_SubMenuBase.c:7
SCR_SubMenuBase::OnTabRemove
void OnTabRemove()
Definition
SCR_SubMenuBase.c:73
SCR_SubMenuBase::OnTabShow
void OnTabShow()
Definition
SCR_SubMenuBase.c:57
SCR_SubMenuBase::OnTabHide
void OnTabHide()
Definition
SCR_SubMenuBase.c:65
SCR_SubMenuBase::RequestTabChange
void RequestTabChange(int newTabIndex)
Definition
SCR_SubMenuBase.c:179
SCR_SubMenuBase::OnTabCreate
void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
Definition
SCR_SubMenuBase.c:47
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
MainMenu
SCR_NewsSubMenu.c
Generated by
1.17.0