Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AccountWidgetComponent.c
Go to the documentation of this file.
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")]
32
37
38 protected SCR_ModularButtonComponent m_Profile;
40
41 protected bool m_bLoggedIn;
43
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
55 if (m_News)
56 m_News.GetButton().m_OnClicked.Insert(OnNews);
57
59 if (m_Career)
60 m_Career.GetButton().m_OnClicked.Insert(OnCareer);
61
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)
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
85 }
86
87 m_BackendApi = GetGame().GetBackendApi();
88
90
91 // Owner menu events
96 }
97
98 //------------------------------------------------------------------------------------------------
99 override void HandlerDeattached(Widget w)
100 {
101 super.HandlerDeattached(w);
102
103 // Owner menu events
108 }
109
110 //------------------------------------------------------------------------------------------------
111 protected void OnMenuEnabled(ChimeraMenuBase menu)
112 {
114 {
115 GetGame().GetCallqueue().Remove(UpdateAuthentication);
116 GetGame().GetCallqueue().CallLater(UpdateAuthentication, AUTH_CHECK_PERIOD, true);
117
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 {
137 {
138 GetGame().GetCallqueue().Remove(UpdateAuthentication);
139
141 }
142 }
143
144 //------------------------------------------------------------------------------------------------
146 {
147 if (tooltip.GetTag() == m_sTooltipTag)
148 {
149 m_Tooltip = tooltip;
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
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
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
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 {
235 }
236
237 //------------------------------------------------------------------------------------------------
238 protected void OnProfile()
239 {
240 // Show profile screen
241 if (BohemiaAccountApi.IsLinked())
243 else
245 }
246}
ChimeraMenuPreset
Menu presets.
ArmaReforgerScripted GetGame()
Definition game.c:1398
PlatformKind
Definition PlatformKind.c:8
Backend Api instance.
Definition BackendApi.c:14
Constant variables used in various menus.
static ChimeraMenuBase GetOwnerMenu(Widget w)
Returns parent menu of a widget.
Definition Color.c:13
SCR_DynamicIconComponent m_ProfileStatusIcon
void OnTooltipShow(SCR_ScriptedWidgetTooltip tooltip)
void OnSettings()
Open the Settings menu.
SCR_CoreMenuHeaderButtonComponent m_News
override void HandlerDeattached(Widget w)
void OnMenuEnabled(ChimeraMenuBase menu)
override void HandlerAttached(Widget w)
SCR_ModularButtonComponent m_Profile
void OnMenuDisabled(ChimeraMenuBase menu)
SCR_CoreMenuHeaderButtonComponent m_BlockedList
SCR_CoreMenuHeaderButtonComponent m_Settings
SCR_ScriptedWidgetTooltip m_Tooltip
static const ResourceName BLOCKED_USER_DIALOG_CONFIG
SCR_CoreMenuHeaderButtonComponent m_Career
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
Helper component for core menu header button prefabs.
static SCR_DynamicIconComponent FindComponent(string name, Widget parent, bool searchAllChildren=true)
static SCR_LoginDialogUI CreateLoginDialog()
static SCR_PlayerProfileDialogUI CreateProfileDialog()
static ScriptInvokerMenu GetOnMenuFocusLost()
static ScriptInvokerMenu GetOnMenuClose()
static ScriptInvokerMenu GetOnMenuOpen()
static ScriptInvokerMenu GetOnMenuFocusGained()
static SCR_ScriptedWidgetComponent GetComponent(typename componentType, string name, Widget parent, bool searchAllChildren=true)
Base method for component lookup through the widget library.
static ScriptInvokerTooltip GetOnTooltipShow()
SCR_FieldOfViewSettings Attribute