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_AccountWidgetComponent.c
Go to the documentation of this file.
1
class
SCR_AccountWidgetComponent
:
SCR_ScriptedWidgetComponent
2
{
3
[
Attribute
(
UIColors
.GetColorAttribute(
UIColors
.CONFIRM),
UIWidgets
.ColorPicker)]
4
protected
ref
Color
m_ColorOnline
;
5
6
[
Attribute
(
UIColors
.GetColorAttribute(
UIColors
.NEUTRAL_ACTIVE_STANDBY),
UIWidgets
.ColorPicker)]
7
protected
ref
Color
m_ColorOffline
;
8
9
[
Attribute
(
UIColors
.GetColorAttribute(
UIColors
.NEUTRAL_ACTIVE_STANDBY),
UIWidgets
.ColorPicker)]
10
protected
ref
Color
m_ColorConnecting
;
11
12
[
Attribute
(
SCR_ConnectionUICommon
.ICON_CONNECTION)]
13
protected
string
m_sIconOnline
;
14
15
[
Attribute
(
SCR_ConnectionUICommon
.ICON_SERVICES_ISSUES)]
16
protected
string
m_sIconOffline
;
17
18
[
Attribute
(
SCR_ConnectionUICommon
.ICON_CONNECTION)]
19
protected
string
m_sIconConnecting
;
20
21
[
Attribute
(
"0"
)]
22
protected
bool
m_bShowOnlineIcon
;
23
24
[
Attribute
(
"Profile"
)]
25
protected
string
m_sTooltipTag
;
26
27
[
Attribute
(
"#AR-Account_AuthenticationFailed"
)]
28
protected
string
m_sTooltipMessageOffline
;
29
30
[
Attribute
(
"#AR-Account_Authenticating"
)]
31
protected
string
m_sTooltipMessageConnecting
;
32
33
protected
SCR_CoreMenuHeaderButtonComponent
m_News
;
34
protected
SCR_CoreMenuHeaderButtonComponent
m_Career
;
35
protected
SCR_CoreMenuHeaderButtonComponent
m_Settings
;
36
protected
SCR_CoreMenuHeaderButtonComponent
m_BlockedList
;
37
38
protected
SCR_ModularButtonComponent
m_Profile
;
39
protected
SCR_DynamicIconComponent
m_ProfileStatusIcon
;
40
41
protected
bool
m_bLoggedIn
;
42
protected
BackendApi
m_BackendApi
;
43
44
protected
SCR_ScriptedWidgetTooltip
m_Tooltip
;
45
46
static
const
int
AUTH_CHECK_PERIOD
= 1000;
47
static
const
ResourceName
BLOCKED_USER_DIALOG_CONFIG
=
"{12C2EC09520BE302}Configs/Blocking/BlockedUsersDialog.conf"
;
48
49
//------------------------------------------------------------------------------------------------
50
override
void
HandlerAttached
(
Widget
w)
51
{
52
super.HandlerAttached(w);
53
54
m_News
=
SCR_CoreMenuHeaderButtonComponent
.Cast(
GetComponent
(
SCR_CoreMenuHeaderButtonComponent
,
"NewsButton"
, w));
55
if
(
m_News
)
56
m_News
.GetButton().m_OnClicked.Insert(
OnNews
);
57
58
m_Career
=
SCR_CoreMenuHeaderButtonComponent
.Cast(
GetComponent
(
SCR_CoreMenuHeaderButtonComponent
,
"CareerButton"
, w));
59
if
(
m_Career
)
60
m_Career
.GetButton().m_OnClicked.Insert(
OnCareer
);
61
62
m_Settings
=
SCR_CoreMenuHeaderButtonComponent
.Cast(
GetComponent
(
SCR_CoreMenuHeaderButtonComponent
,
"SettingsButton"
, w));
63
if
(
m_Settings
)
64
m_Settings
.GetButton().m_OnClicked.Insert(
OnSettings
);
65
66
// TODO: Hide if no user is on block list (Backend API needed)
67
m_BlockedList
=
SCR_CoreMenuHeaderButtonComponent
.Cast(
GetComponent
(
SCR_CoreMenuHeaderButtonComponent
,
"BlockedUsersButton"
, w));
68
if
(
m_BlockedList
)
69
{
70
m_BlockedList
.GetButton().m_OnClicked.Insert(
OnBlocked
);
71
//if (System.GetPlatform() != EPlatform.PS5 && System.GetPlatform() != EPlatform.PS5_PRO)
72
//m_BlockedList.GetButton().SetVisible(false);
73
}
74
75
Widget
profile = w.FindAnyWidget(
"Profile"
);
76
if
(profile)
77
{
78
m_Profile
= SCR_ModularButtonComponent.FindComponent(profile);
79
if
(
m_Profile
)
80
m_Profile
.m_OnClicked.Insert(
OnProfile
);
81
82
m_ProfileStatusIcon
=
SCR_DynamicIconComponent
.
FindComponent
(
"DotOverlay"
, profile);
83
if
(
m_ProfileStatusIcon
)
84
m_ProfileStatusIcon
.SetIconColor(
m_ColorOffline
);
85
}
86
87
m_BackendApi
=
GetGame
().GetBackendApi();
88
89
UpdateAuthentication
();
90
91
// Owner menu events
92
SCR_MenuHelper
.
GetOnMenuFocusGained
().Insert(
OnMenuEnabled
);
93
SCR_MenuHelper
.
GetOnMenuOpen
().Insert(
OnMenuEnabled
);
94
SCR_MenuHelper
.
GetOnMenuFocusLost
().Insert(
OnMenuDisabled
);
95
SCR_MenuHelper
.
GetOnMenuClose
().Insert(
OnMenuDisabled
);
96
}
97
98
//------------------------------------------------------------------------------------------------
99
override
void
HandlerDeattached
(
Widget
w)
100
{
101
super.HandlerDeattached(w);
102
103
// Owner menu events
104
SCR_MenuHelper
.
GetOnMenuFocusGained
().Remove(
OnMenuEnabled
);
105
SCR_MenuHelper
.
GetOnMenuOpen
().Remove(
OnMenuEnabled
);
106
SCR_MenuHelper
.
GetOnMenuFocusLost
().Remove(
OnMenuDisabled
);
107
SCR_MenuHelper
.
GetOnMenuClose
().Remove(
OnMenuDisabled
);
108
}
109
110
//------------------------------------------------------------------------------------------------
111
protected
void
OnMenuEnabled
(
ChimeraMenuBase
menu)
112
{
113
if
(menu ==
ChimeraMenuBase
.
GetOwnerMenu
(
GetRootWidget
()))
114
{
115
GetGame
().GetCallqueue().Remove(
UpdateAuthentication
);
116
GetGame
().GetCallqueue().CallLater(
UpdateAuthentication
,
AUTH_CHECK_PERIOD
,
true
);
117
118
SCR_ScriptedWidgetTooltip
.
GetOnTooltipShow
().Insert(
OnTooltipShow
);
119
}
120
121
// Hide news menu button (top right corner) on PS
122
if
(
GetGame
().GetPlatformService().GetLocalPlatformKind() ==
PlatformKind
.PSN)
123
{
124
Widget
newsButton =
GetRootWidget
().FindAnyWidget(
"NewsButton"
);
125
if
(newsButton)
126
{
127
newsButton.SetVisible(
false
);
128
newsButton.SetEnabled(
false
);
129
}
130
}
131
}
132
133
//------------------------------------------------------------------------------------------------
134
protected
void
OnMenuDisabled
(
ChimeraMenuBase
menu)
135
{
136
if
(menu ==
ChimeraMenuBase
.
GetOwnerMenu
(
GetRootWidget
()))
137
{
138
GetGame
().GetCallqueue().Remove(
UpdateAuthentication
);
139
140
SCR_ScriptedWidgetTooltip
.
GetOnTooltipShow
().Remove(
OnTooltipShow
);
141
}
142
}
143
144
//------------------------------------------------------------------------------------------------
145
protected
void
OnTooltipShow
(
SCR_ScriptedWidgetTooltip
tooltip)
146
{
147
if
(tooltip.
GetTag
() ==
m_sTooltipTag
)
148
{
149
m_Tooltip
= tooltip;
150
UpdateAuthentication
();
151
}
152
}
153
154
//------------------------------------------------------------------------------------------------
155
protected
void
UpdateAuthentication
()
156
{
157
if
(!
m_BackendApi
)
158
{
159
m_BackendApi
=
GetGame
().GetBackendApi();
160
if
(!
m_BackendApi
)
161
return
;
162
}
163
164
if
(!
m_ProfileStatusIcon
)
165
return
;
166
167
m_ProfileStatusIcon
.SetVisible(
true
);
168
169
Color
color =
m_ColorOffline
;
170
string
image =
m_sIconOffline
;
171
172
string
tooltipMessage =
m_sTooltipMessageOffline
;
173
Color
tooltipMessageColor =
m_ColorOffline
;
174
175
SCR_ScriptedWidgetTooltipContentBase
tooltipContent;
176
if
(
m_Tooltip
)
177
tooltipContent =
m_Tooltip
.GetContent();
178
179
if
(
BackendAuthenticatorApi
.IsAuthInProgress())
180
{
181
color =
m_ColorConnecting
;
182
image =
m_sIconConnecting
;
183
184
tooltipMessage =
m_sTooltipMessageConnecting
;
185
tooltipMessageColor =
m_ColorConnecting
;
186
}
187
else
if
(
BackendAuthenticatorApi
.IsAuthenticated())
188
{
189
color =
m_ColorOnline
;
190
image =
m_sIconOnline
;
191
192
m_ProfileStatusIcon
.SetVisible(
m_bShowOnlineIcon
);
193
194
if
(tooltipContent)
195
tooltipMessage = tooltipContent.
GetDefaultMessage
();
196
197
tooltipMessageColor =
Color
.FromInt(
Color
.WHITE);
198
}
199
200
m_ProfileStatusIcon
.SetIconColor(color);
201
m_ProfileStatusIcon
.SetImage(image);
202
203
if
(tooltipContent)
204
{
205
tooltipContent.
SetMessage
(tooltipMessage);
206
tooltipContent.
SetMessageColor
(tooltipMessageColor);
207
}
208
}
209
210
//------------------------------------------------------------------------------------------------
211
protected
void
OnNews
()
212
{
213
GetGame
().GetMenuManager().OpenMenu(
ChimeraMenuPreset
.ProfileSuperMenu, 0,
true
);
214
}
215
216
//------------------------------------------------------------------------------------------------
217
protected
void
OnCareer
()
218
{
219
//TODO: uncomment once Career Menu is finished
220
//GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.CareerProfileMenu, 0, true);
221
}
222
223
//------------------------------------------------------------------------------------------------
225
protected
void
OnSettings
()
226
{
227
GetGame
().GetMenuManager().OpenMenu(
ChimeraMenuPreset
.SettingsSuperMenu, 0,
true
);
228
}
229
230
//------------------------------------------------------------------------------------------------
231
protected
void
OnBlocked
()
232
{
233
SCR_BlockedUsersDialogUI
dialog =
new
SCR_BlockedUsersDialogUI
();
234
SCR_ConfigurableDialogUi
.
CreateFromPreset
(
BLOCKED_USER_DIALOG_CONFIG
,
"blocked_list"
, dialog);
235
}
236
237
//------------------------------------------------------------------------------------------------
238
protected
void
OnProfile
()
239
{
240
// Show profile screen
241
if
(
BohemiaAccountApi
.IsLinked())
242
SCR_LoginProcessDialogUI
.
CreateProfileDialog
();
243
else
244
SCR_LoginProcessDialogUI
.
CreateLoginDialog
();
245
}
246
}
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition
ChimeraMenuBase.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
PlatformKind
PlatformKind
Definition
PlatformKind.c:8
BackendApi
Backend Api instance.
Definition
BackendApi.c:14
BackendAuthenticatorApi
Definition
BackendAuthenticatorApi.c:21
BohemiaAccountApi
Definition
BohemiaAccountApi.c:19
ChimeraMenuBase
Constant variables used in various menus.
Definition
ChimeraMenuBase.c:72
ChimeraMenuBase::GetOwnerMenu
static ChimeraMenuBase GetOwnerMenu(Widget w)
Returns parent menu of a widget.
Definition
ChimeraMenuBase.c:179
Color
Definition
Color.c:13
ResourceName
Definition
ResourceName.c:13
SCR_AccountWidgetComponent
Definition
SCR_AccountWidgetComponent.c:2
SCR_AccountWidgetComponent::OnBlocked
void OnBlocked()
Definition
SCR_AccountWidgetComponent.c:231
SCR_AccountWidgetComponent::m_bShowOnlineIcon
bool m_bShowOnlineIcon
Definition
SCR_AccountWidgetComponent.c:22
SCR_AccountWidgetComponent::m_ProfileStatusIcon
SCR_DynamicIconComponent m_ProfileStatusIcon
Definition
SCR_AccountWidgetComponent.c:39
SCR_AccountWidgetComponent::OnTooltipShow
void OnTooltipShow(SCR_ScriptedWidgetTooltip tooltip)
Definition
SCR_AccountWidgetComponent.c:145
SCR_AccountWidgetComponent::OnSettings
void OnSettings()
Open the Settings menu.
Definition
SCR_AccountWidgetComponent.c:225
SCR_AccountWidgetComponent::m_News
SCR_CoreMenuHeaderButtonComponent m_News
Definition
SCR_AccountWidgetComponent.c:33
SCR_AccountWidgetComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_AccountWidgetComponent.c:99
SCR_AccountWidgetComponent::OnMenuEnabled
void OnMenuEnabled(ChimeraMenuBase menu)
Definition
SCR_AccountWidgetComponent.c:111
SCR_AccountWidgetComponent::OnProfile
void OnProfile()
Definition
SCR_AccountWidgetComponent.c:238
SCR_AccountWidgetComponent::m_sTooltipTag
string m_sTooltipTag
Definition
SCR_AccountWidgetComponent.c:25
SCR_AccountWidgetComponent::m_ColorOnline
ref Color m_ColorOnline
Definition
SCR_AccountWidgetComponent.c:4
SCR_AccountWidgetComponent::m_BackendApi
BackendApi m_BackendApi
Definition
SCR_AccountWidgetComponent.c:42
SCR_AccountWidgetComponent::m_sTooltipMessageConnecting
string m_sTooltipMessageConnecting
Definition
SCR_AccountWidgetComponent.c:31
SCR_AccountWidgetComponent::m_sIconConnecting
string m_sIconConnecting
Definition
SCR_AccountWidgetComponent.c:19
SCR_AccountWidgetComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_AccountWidgetComponent.c:50
SCR_AccountWidgetComponent::m_sTooltipMessageOffline
string m_sTooltipMessageOffline
Definition
SCR_AccountWidgetComponent.c:28
SCR_AccountWidgetComponent::m_Profile
SCR_ModularButtonComponent m_Profile
Definition
SCR_AccountWidgetComponent.c:38
SCR_AccountWidgetComponent::m_sIconOnline
string m_sIconOnline
Definition
SCR_AccountWidgetComponent.c:13
SCR_AccountWidgetComponent::OnMenuDisabled
void OnMenuDisabled(ChimeraMenuBase menu)
Definition
SCR_AccountWidgetComponent.c:134
SCR_AccountWidgetComponent::m_ColorOffline
ref Color m_ColorOffline
Definition
SCR_AccountWidgetComponent.c:7
SCR_AccountWidgetComponent::m_BlockedList
SCR_CoreMenuHeaderButtonComponent m_BlockedList
Definition
SCR_AccountWidgetComponent.c:36
SCR_AccountWidgetComponent::m_bLoggedIn
bool m_bLoggedIn
Definition
SCR_AccountWidgetComponent.c:41
SCR_AccountWidgetComponent::m_sIconOffline
string m_sIconOffline
Definition
SCR_AccountWidgetComponent.c:16
SCR_AccountWidgetComponent::m_Settings
SCR_CoreMenuHeaderButtonComponent m_Settings
Definition
SCR_AccountWidgetComponent.c:35
SCR_AccountWidgetComponent::AUTH_CHECK_PERIOD
static const int AUTH_CHECK_PERIOD
Definition
SCR_AccountWidgetComponent.c:46
SCR_AccountWidgetComponent::m_Tooltip
SCR_ScriptedWidgetTooltip m_Tooltip
Definition
SCR_AccountWidgetComponent.c:44
SCR_AccountWidgetComponent::m_ColorConnecting
ref Color m_ColorConnecting
Definition
SCR_AccountWidgetComponent.c:10
SCR_AccountWidgetComponent::OnNews
void OnNews()
Definition
SCR_AccountWidgetComponent.c:211
SCR_AccountWidgetComponent::BLOCKED_USER_DIALOG_CONFIG
static const ResourceName BLOCKED_USER_DIALOG_CONFIG
Definition
SCR_AccountWidgetComponent.c:47
SCR_AccountWidgetComponent::UpdateAuthentication
void UpdateAuthentication()
Definition
SCR_AccountWidgetComponent.c:155
SCR_AccountWidgetComponent::OnCareer
void OnCareer()
Definition
SCR_AccountWidgetComponent.c:217
SCR_AccountWidgetComponent::m_Career
SCR_CoreMenuHeaderButtonComponent m_Career
Definition
SCR_AccountWidgetComponent.c:34
SCR_BlockedUsersDialogUI
Definition
SCR_BlockedUsersDialogUI.c:2
SCR_ConfigurableDialogUi
Definition
SCR_ConfigurableDialogUI.c:17
SCR_ConfigurableDialogUi::CreateFromPreset
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
Definition
SCR_ConfigurableDialogUI.c:94
SCR_ConnectionUICommon
Definition
SCR_ConnectionUICommon.c:2
SCR_CoreMenuHeaderButtonComponent
Helper component for core menu header button prefabs.
Definition
SCR_CoreMenuHeaderButtonComponent.c:3
SCR_DynamicIconComponent
Definition
SCR_DynamicIconComponent.c:6
SCR_DynamicIconComponent::FindComponent
static SCR_DynamicIconComponent FindComponent(string name, Widget parent, bool searchAllChildren=true)
Definition
SCR_DynamicIconComponent.c:123
SCR_LoginProcessDialogUI
Definition
SCR_LoginProcessDialogUI.c:6
SCR_LoginProcessDialogUI::CreateLoginDialog
static SCR_LoginDialogUI CreateLoginDialog()
Definition
SCR_LoginProcessDialogUI.c:40
SCR_LoginProcessDialogUI::CreateProfileDialog
static SCR_PlayerProfileDialogUI CreateProfileDialog()
Definition
SCR_LoginProcessDialogUI.c:57
SCR_MenuHelper
Definition
SCR_MenuHelper.c:19
SCR_MenuHelper::GetOnMenuFocusLost
static ScriptInvokerMenu GetOnMenuFocusLost()
Definition
SCR_MenuHelper.c:97
SCR_MenuHelper::GetOnMenuClose
static ScriptInvokerMenu GetOnMenuClose()
Definition
SCR_MenuHelper.c:79
SCR_MenuHelper::GetOnMenuOpen
static ScriptInvokerMenu GetOnMenuOpen()
Definition
SCR_MenuHelper.c:61
SCR_MenuHelper::GetOnMenuFocusGained
static ScriptInvokerMenu GetOnMenuFocusGained()
Definition
SCR_MenuHelper.c:88
SCR_ScriptedWidgetComponent
Definition
SCR_ScriptedWidgetComponent.c:8
SCR_ScriptedWidgetComponent::GetComponent
static SCR_ScriptedWidgetComponent GetComponent(typename componentType, string name, Widget parent, bool searchAllChildren=true)
Base method for component lookup through the widget library.
Definition
SCR_ScriptedWidgetComponent.c:29
SCR_ScriptedWidgetComponent::GetRootWidget
Widget GetRootWidget()
Definition
SCR_ScriptedWidgetComponent.c:51
SCR_ScriptedWidgetTooltipContentBase
Definition
SCR_ScriptedWidgetTooltipContentBase.c:3
SCR_ScriptedWidgetTooltipContentBase::SetMessage
bool SetMessage(string message)
Definition
SCR_ScriptedWidgetTooltipContentBase.c:47
SCR_ScriptedWidgetTooltipContentBase::SetMessageColor
bool SetMessageColor(Color color)
Definition
SCR_ScriptedWidgetTooltipContentBase.c:63
SCR_ScriptedWidgetTooltipContentBase::GetDefaultMessage
string GetDefaultMessage()
Definition
SCR_ScriptedWidgetTooltipContentBase.c:94
SCR_ScriptedWidgetTooltip
Definition
SCR_ScriptedWidgetTooltip.c:16
SCR_ScriptedWidgetTooltip::GetOnTooltipShow
static ScriptInvokerTooltip GetOnTooltipShow()
Definition
SCR_ScriptedWidgetTooltip.c:396
SCR_ScriptedWidgetTooltip::GetTag
string GetTag()
Definition
SCR_ScriptedWidgetTooltip.c:333
UIColors
Definition
Constants.c:17
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
MainMenu
SCR_AccountWidgetComponent.c
Generated by
1.17.0