4 protected ref Color m_ColorOnline;
7 protected ref Color m_ColorOffline;
10 protected ref Color m_ColorConnecting;
13 protected string m_sIconOnline;
16 protected string m_sIconOffline;
19 protected string m_sIconConnecting;
22 protected bool m_bShowOnlineIcon;
25 protected string m_sTooltipTag;
27 [
Attribute(
"#AR-Account_AuthenticationFailed")]
28 protected string m_sTooltipMessageOffline;
31 protected string m_sTooltipMessageConnecting;
36 protected SCR_ModularButtonComponent m_Profile;
39 protected bool m_bLoggedIn;
40 protected BackendApi m_BackendApi;
44 static const int AUTH_CHECK_PERIOD = 1000;
47 override void HandlerAttached(Widget w)
49 super.HandlerAttached(w);
53 m_News.GetButton().m_OnClicked.Insert(OnNews);
57 m_Career.GetButton().m_OnClicked.Insert(OnCareer);
59 Widget profile = w.FindAnyWidget(
"Profile");
62 m_Profile = SCR_ModularButtonComponent.FindComponent(profile);
64 m_Profile.m_OnClicked.Insert(OnProfile);
67 if (m_ProfileStatusIcon)
68 m_ProfileStatusIcon.SetIconColor(m_ColorOffline);
71 m_BackendApi =
GetGame().GetBackendApi();
73 UpdateAuthentication();
83 override void HandlerDeattached(Widget w)
85 super.HandlerDeattached(w);
99 GetGame().GetCallqueue().Remove(UpdateAuthentication);
100 GetGame().GetCallqueue().CallLater(UpdateAuthentication, AUTH_CHECK_PERIOD,
true);
111 GetGame().GetCallqueue().Remove(UpdateAuthentication);
118 protected void OnTooltipShow(
SCR_ScriptedWidgetTooltip tooltipClass, Widget tooltipWidget, Widget hoverWidget, SCR_ScriptedWidgetTooltipPreset preset,
string tag)
123 UpdateAuthentication();
128 protected void UpdateAuthentication()
132 m_BackendApi =
GetGame().GetBackendApi();
137 if (!m_ProfileStatusIcon)
140 m_ProfileStatusIcon.SetVisibile(
true);
142 Color color = m_ColorOffline;
143 string image = m_sIconOffline;
145 string tooltipMessage = m_sTooltipMessageOffline;
146 Color tooltipMessageColor = m_ColorOffline;
148 if (m_BackendApi.IsAuthInProgress())
150 color = m_ColorConnecting;
151 image = m_sIconConnecting;
153 tooltipMessage = m_sTooltipMessageConnecting;
154 tooltipMessageColor = m_ColorConnecting;
156 else if (m_BackendApi.IsAuthenticated())
158 color = m_ColorOnline;
159 image = m_sIconOnline;
161 m_ProfileStatusIcon.SetVisibile(m_bShowOnlineIcon);
164 tooltipMessage =
m_Tooltip.GetDefaultMessage();
166 tooltipMessageColor = Color.FromInt(Color.WHITE);
169 m_ProfileStatusIcon.SetIconColor(color);
170 m_ProfileStatusIcon.SetImage(image);
175 m_Tooltip.SetMessageColor(tooltipMessageColor);
180 protected void OnNews()
182 SCR_ProfileSuperMenu menu = SCR_ProfileSuperMenu.Cast(
GetGame().GetMenuManager().OpenMenu(
ChimeraMenuPreset.ProfileSuperMenu, 0,
true));
188 protected void OnCareer()
195 protected void OnProfile()
198 if (m_BackendApi.IsBIAccountLinked())