8 protected const string TOS_BUTTON =
"ProfileTOS";
9 protected const string TOS_LINK =
"Link_PrivacyPolicy";
11 protected const string REGISTER_BUTTON =
"createAccount";
12 protected const string REGISTER_LINK =
"Link_RegisterAccount";
14 protected const string PID_TEXT_WIDGET =
"PIDText";
15 protected const string PID_BUTTON_WIDGET =
"CopyPIDButton";
18 protected const string WARNING_SUCCESS_IMG =
"check";
19 protected const string WARNING_FAILED_IMG =
"warning";
20 protected const string WARNING_TIMEOUT_IMG =
"disconnection";
22 protected const string WARNING_TIMEOUT =
"#AR-Account_LoginTimeout";
30 protected RichTextWidget m_wPIDText;
36 protected bool m_bForceConfirmButtonDisabled;
37 protected bool m_bIsLoading;
41 protected const int ON_FAIL_DELAY = 2000;
43 protected static const ResourceName DIALOG_CONFIG =
"{9381BF296A0E273B}Configs/Dialogs/LoginDialogs.conf";
47 static void CreateLoginDialog()
51 SCR_LoginDialogConsoleUI dialog =
new SCR_LoginDialogConsoleUI();
71 static void Create2FADialog(
string name,
string code)
75 SCR_Login2FADialogConsoleUI dialog =
new SCR_Login2FADialogConsoleUI(name, code);
100 static SCR_AccountLockedDialogUi CreateAccountLockedDialog()
102 SCR_AccountLockedDialogUi dialog =
new SCR_AccountLockedDialogUi();
112 super.OnMenuOpen(preset);
116 m_TOSButton.m_OnActivated.Insert(OnTOSButton);
118 m_CreateAccount =
FindButton(REGISTER_BUTTON);
120 m_CreateAccount.m_OnActivated.Insert(OnCreateAccount);
124 m_wPIDText = RichTextWidget.Cast(
m_wRoot.FindAnyWidget(PID_TEXT_WIDGET));
127 if (m_CopyButtonComponent)
128 m_CopyButtonComponent.m_OnClicked.Insert(CopyPID);
131 ShowWarningMessage(
false);
142 m_Callback.GetEventOnSuccess().Insert(OnSuccess);
144 m_Callback.GetEventOnTimeOut().Insert(OnTimeout);
148 override void OnMenuClose()
154 GetGame().GetCallqueue().Remove(OnTimeoutScripted);
158 override void OnConfirm()
160 ShowLoadingAnim(
true);
161 ShowWarningMessage(
false);
164 GetGame().GetCallqueue().Remove(OnTimeoutScripted);
170 protected bool UpdateButtons()
180 BackendApi backendAPI =
GetGame().GetBackendApi();
182 identity = backendAPI.GetLocalIdentityId();
185 m_wPIDText.SetText(identity);
187 if (m_CopyButtonComponent)
191 m_wPIDText.SetVisible(!identity.IsEmpty());
197 protected void ShowLoadingAnim(
bool show)
208 protected void ShowWarningMessage(
bool show)
211 m_Warning.SetWarningVisible(show);
216 protected void CopyPID()
218 System.ExportToClipboard(m_wPIDText.GetText());
223 protected bool VerifyFormatting(
string text)
230 protected void OnCommStatusCheckFinished(
SCR_ECommStatus status,
float responseTime,
float lastSuccessTime,
float lastFailTime)
236 protected void OnTOSButton()
238 GetGame().GetPlatformService().OpenBrowser(
GetGame().GetBackendApi().GetLinkItem(TOS_LINK));
242 private void OnCreateAccount()
244 GetGame().GetPlatformService().OpenBrowser(
GetGame().GetBackendApi().GetLinkItem(REGISTER_LINK));
250 CreateLoginSuccessDialog();
257 GetGame().GetCallqueue().Remove(OnTimeoutScripted);
261 GetGame().GetCallqueue().Remove(OnFailDelayed);
262 GetGame().GetCallqueue().CallLater(OnFailDelayed, ON_FAIL_DELAY,
false,
callback, code, restCode, apiCode);
268 GetGame().GetCallqueue().Remove(OnTimeoutScripted);
270 ShowLoadingAnim(
false);
271 ShowWarningMessage(
false);
273 CreateLoginTimeoutDialog();
279 GetGame().GetCallqueue().Remove(OnFailDelayed);
281 ShowLoadingAnim(
false);
282 ShowWarningMessage(
false);
288 ShowWarningMessage(
true);
294 if (apiCode == EApiCode.EACODE_ERROR_USER_NOT_FOUND)
295 ShowWarningMessage(
true);
298 else if (apiCode == EApiCode.EACODE_ERROR_USER_LOCKED)
299 CreateAccountLockedDialog();
302 CreateLoginTimeoutDialog();
306 protected void OnTimeoutScripted()
315 protected const string MAIN_MESSAGE =
"#AR-Account_Locked_Message";
317 protected const string MINUTES =
"#AR-ValueUnit_Short_Minutes";
318 protected const string SECONDS =
"#AR-ValueUnit_Short_Seconds";
320 protected const string SUPPORT =
"Link_SupportEmail";
325 super.OnMenuOpen(preset);
334 string message =
string.Format(
"<color rgba=%1>%2</color>",
UIColors.SRGBAFloatToInt(
UIColors.CONTRAST_COLOR),
GetGame().GetBackendApi().GetLinkItem(
SUPPORT));
352 int seconds =
GetGame().GetBackendApi().RemainingAccountLockedTime();
353 int minutes = seconds / 60;
355 string time = WidgetManager.Translate(
MINUTES, minutes) +
" " + WidgetManager.Translate(
SECONDS, seconds - (60 * minutes));
357 time = WidgetManager.Translate(
SECONDS, seconds);