Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
CreateAccountDialogUI.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4  SCR_EditBoxComponent m_UserName;
5  SCR_EditBoxComponent m_Password;
6  SCR_EditBoxComponent m_ConfirmPassword;
7  Widget m_wOverlay;
8  int m_iDelayMs = 500;
9  SCR_LoadingOverlay m_LoadingOverlay;
10 
11  string m_sPasswordNotMatching = "Passwords do not match";
12 
13  ref ScriptInvoker m_OnDialogClosed = new ScriptInvoker();
14 
15  //------------------------------------------------------------------------------------------------
16  override void OnMenuOpen()
17  {
18  super.OnMenuOpen();
19 
20  m_UserName = SCR_EditBoxComponent.GetEditBoxComponent("UserName", GetRootWidget());
21  if (m_UserName)
22  m_UserName.m_OnChanged.Insert(CheckFilledEditboxes);
23 
24  m_Password = SCR_EditBoxComponent.GetEditBoxComponent("Password", GetRootWidget());
25  if (m_Password)
26  m_Password.m_OnChanged.Insert(CheckFilledEditboxes);
27 
28  m_ConfirmPassword = SCR_EditBoxComponent.GetEditBoxComponent("ConfirmPassword", GetRootWidget());
29  if (m_ConfirmPassword)
30  m_ConfirmPassword.m_OnChanged.Insert(CheckFilledEditboxes);
31 
32  m_Confirm.SetEnabled(false, false);
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override void OnMenuClose()
37  {
38  super.OnMenuClose();
39  ShowLoadinAnim(false);
40  m_OnDialogClosed.Invoke();
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override protected void OnConfirm()
45  {
46  if (m_Password.GetValue() != m_ConfirmPassword.GetValue())
47  {
48  ShowResponse(m_sPasswordNotMatching, Color.FromInt(UIColors.WARNING.PackToInt()));
49  return;
50  }
51 
52  // TODO: Send request to backend
53  }
54 
55  //------------------------------------------------------------------------------------------------
56  override void OnCancel()
57  {
58  super.OnCancel();
59  GetGame().GetMenuManager().OpenDialog(ChimeraMenuPreset.LoginDialog);
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  private void ShowResponse(string name, Color color)
64  {
65  // TODO
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  private void CheckFilledEditboxes()
70  {
71  bool enabled = m_UserName.GetValue() != string.Empty
72  && m_Password.GetValue() != string.Empty
73  && m_ConfirmPassword.GetValue() != string.Empty;
74  m_Confirm.SetEnabled(enabled);
75  }
76 
77  //------------------------------------------------------------------------------------------------
78  void CloseDelayed()
79  {
80  GetGame().GetCallqueue().CallLater(CloseAnimated, m_iDelayMs);
81  }
82 
83  //------------------------------------------------------------------------------------------------
84  void ShowLoadinAnim(bool show)
85  {
86  if (show && m_wOverlay)
87  m_LoadingOverlay = SCR_LoadingOverlay.ShowForWidget(m_wOverlay, string.Empty, false, true);
88  else if (m_LoadingOverlay)
89  m_LoadingOverlay.HideAndDelete();
90  }
91 };
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_LoadingOverlay
Definition: SCR_LoadingOverlay.c:49
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
m_LoadingOverlay
protected SCR_LoadingOverlay m_LoadingOverlay
Definition: SCR_BackendImageComponent.c:250
CreateAccountDialogUI
Definition: CreateAccountDialogUI.c:2
UIColors
Definition: Constants.c:16
DialogUI
Definition: DialogUI.c:1
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
SCR_EditBoxComponent
Definition: SCR_EditBoxComponent.c:8
m_wOverlay
private Widget m_wOverlay
Definition: SCR_AISettingsComponent.c:46