Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_RoomPasswordVerification.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
5//------------------------------------------------------------------------------------------------
7{
8 protected string FALLBACK_ERROR = "#AR-Password_FailMessage";
9 protected string FALLBACK_TIMEOUT = "#AR-Password_TimeoutMessage";
10
11 protected Room m_Room;
14
16
19
20 //------------------------------------------------------------------------------------------------
25
26 //------------------------------------------------------------------------------------------------
31
32 //------------------------------------------------------------------------------------------------
34 void SetupDialog(notnull SCR_ConfigurableDialogUi dialog, notnull Room room, string message = "")
35 {
36 m_Dialog = dialog;
37 m_Room = room;
38
39 // Callbacks
40 dialog.m_OnConfirm.Insert(OnPasswordConfirm);
41 //dialog.m_OnCancel.Insert(PasswordClearInvokers);
42
43
44 // Display dialog message - TODO: Check what is this for?
45 SCR_EditboxDialogUi editDialog = SCR_EditboxDialogUi.Cast(dialog);
46 if (editDialog)
47 editDialog.SetWarningMessage(message);
48 }
49
50 //------------------------------------------------------------------------------------------------
51 protected void InitCheck()
52 {
53 // Show loading
55 m_LoadingOverlay.SetShown(true);
56 else
57 m_LoadingOverlay = SCR_LoadingOverlay.ShowForWidget(GetGame().GetWorkspace(), string.Empty);
58
61 }
62
63 //------------------------------------------------------------------------------------------------
65 {
66 if (!room)
67 {
68 Debug.Error("Room instance expected! Null found in room");
69 return;
70 }
71 m_Room = room;
72
73 InitCheck();
74 m_Room.CheckAuthorization(m_Callback);
75
76 }
77
78 //------------------------------------------------------------------------------------------------
80 protected void OnPasswordConfirm()
81 {
82 if (!m_Room)
83 {
84 Debug.Error("Room instance expected! Null found in m_Room");
85 return;
86 }
87
88 InitCheck();
89
91
92 // Get edit box value
93 string value = editboxDialog.GetEditbox().GetValue();
94
95 // Try join with password
96 m_Room.VerifyPassword(value, m_Callback);
97 }
98
99 //------------------------------------------------------------------------------------------------
102 {
103 // Hide loading
105 m_LoadingOverlay.SetShown(false);
106
107 // Clear
109
110 // Invoke verification with successful password struct
111 m_OnVerified.Invoke();
112 }
113
114 //------------------------------------------------------------------------------------------------
116 protected void OnPasswordCheckError(BackendCallback callback)
117 {
118 // Hide loading
120 m_LoadingOverlay.SetShown(false);
121
122 // Clear
124
125 // Reaction
126 if (callback.GetRestResult() == ERestResult.EREST_ERROR_TIMEOUT)
127 {
129 }
130 else
131 {
133 }
134 }
135
136 //------------------------------------------------------------------------------------------------
137 protected void ClearInvokers()
138 {
139 if(m_Dialog && m_Dialog.m_OnConfirm)
140 m_Dialog.m_OnConfirm.Remove(OnPasswordConfirm);
141 }
142}
ArmaReforgerScripted GetGame()
Definition game.c:1398
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerStringMethod > ScriptInvokerString
Definition Debug.c:13
Definition Room.c:13
Configurable editbox dialog base.
SCR_EditBoxComponent GetEditbox()
void SetWarningMessage(string message)
static SCR_LoadingOverlay ShowForWidget(Widget targetWidget, string text=string.Empty, bool showBlur=true, bool showBackground=true)
void OnPasswordConfirm()
Start password verification on confirming password dialog.
void SetupDialog(notnull SCR_ConfigurableDialogUi dialog, notnull Room room, string message="")
Setup dialog UI for handling password and joining room.
void OnPasswordCheckResponse(BackendCallback callback)
Handle password check request response.
void OnPasswordCheckError(BackendCallback callback)
Handle password check request response.
ERestResult
States and result + error code produced by RestApi.
Definition ERestResult.c:14