Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_RoomPasswordVerification.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
5
//------------------------------------------------------------------------------------------------
6
class
SCR_RoomPasswordVerification
7
{
8
protected
string
FALLBACK_ERROR
=
"#AR-Password_FailMessage"
;
9
protected
string
FALLBACK_TIMEOUT
=
"#AR-Password_TimeoutMessage"
;
10
11
protected
Room
m_Room
;
12
protected
SCR_ConfigurableDialogUi
m_Dialog
;
13
protected
SCR_LoadingOverlay
m_LoadingOverlay
;
14
15
protected
ref
BackendCallback
m_Callback
=
new
BackendCallback
();
16
17
protected
ref
ScriptInvokerVoid
m_OnVerified
=
new
ScriptInvokerVoid
();
18
protected
ref
ScriptInvokerString
m_OnFailVerification
=
new
ScriptInvokerString
();
19
20
//------------------------------------------------------------------------------------------------
21
ScriptInvokerVoid
GetOnVerified
()
22
{
23
return
m_OnVerified
;
24
}
25
26
//------------------------------------------------------------------------------------------------
27
ScriptInvokerString
GetOnFailVerification
()
28
{
29
return
m_OnFailVerification
;
30
}
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
54
if
(
m_LoadingOverlay
)
55
m_LoadingOverlay
.SetShown(
true
);
56
else
57
m_LoadingOverlay
=
SCR_LoadingOverlay
.
ShowForWidget
(
GetGame
().GetWorkspace(),
string
.Empty);
58
59
m_Callback
.SetOnSuccess(
OnPasswordCheckResponse
);
60
m_Callback
.SetOnError(
OnPasswordCheckError
);
61
}
62
63
//------------------------------------------------------------------------------------------------
64
void
CheckRejoinAuthorization
(
Room
room)
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
90
SCR_EditboxDialogUi
editboxDialog =
SCR_EditboxDialogUi
.Cast(
m_Dialog
);
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
//------------------------------------------------------------------------------------------------
101
protected
void
OnPasswordCheckResponse
(
BackendCallback
callback)
102
{
103
// Hide loading
104
if
(
m_LoadingOverlay
)
105
m_LoadingOverlay
.SetShown(
false
);
106
107
// Clear
108
ClearInvokers
();
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
119
if
(
m_LoadingOverlay
)
120
m_LoadingOverlay
.SetShown(
false
);
121
122
// Clear
123
ClearInvokers
();
124
125
// Reaction
126
if
(callback.GetRestResult() ==
ERestResult
.EREST_ERROR_TIMEOUT)
127
{
128
m_OnFailVerification
.Invoke(
FALLBACK_TIMEOUT
);
129
}
130
else
131
{
132
m_OnFailVerification
.Invoke(
FALLBACK_ERROR
);
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
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Definition
SCR_ScriptInvokerHelper.c:9
ScriptInvokerString
ScriptInvokerBase< ScriptInvokerStringMethod > ScriptInvokerString
Definition
SCR_ScriptInvokerHelper.c:75
BackendCallback
Definition
Backend_Storage.c:5
Debug
Definition
Debug.c:13
Room
Definition
Room.c:13
SCR_ConfigurableDialogUi
Definition
SCR_ConfigurableDialogUI.c:17
SCR_EditBoxComponent::GetValue
string GetValue()
Definition
SCR_EditBoxComponent.c:513
SCR_EditboxDialogUi
Configurable editbox dialog base.
Definition
SCR_EditboxDialogUI.c:4
SCR_EditboxDialogUi::GetEditbox
SCR_EditBoxComponent GetEditbox()
Definition
SCR_EditboxDialogUI.c:91
SCR_EditboxDialogUi::SetWarningMessage
void SetWarningMessage(string message)
Definition
SCR_EditboxDialogUI.c:75
SCR_LoadingOverlay
Definition
SCR_LoadingOverlay.c:50
SCR_LoadingOverlay::ShowForWidget
static SCR_LoadingOverlay ShowForWidget(Widget targetWidget, string text=string.Empty, bool showBlur=true, bool showBackground=true)
Definition
SCR_LoadingOverlay.c:72
SCR_RoomPasswordVerification
Definition
SCR_RoomPasswordVerification.c:7
SCR_RoomPasswordVerification::m_OnFailVerification
ref ScriptInvokerString m_OnFailVerification
Definition
SCR_RoomPasswordVerification.c:18
SCR_RoomPasswordVerification::m_OnVerified
ref ScriptInvokerVoid m_OnVerified
Definition
SCR_RoomPasswordVerification.c:17
SCR_RoomPasswordVerification::GetOnFailVerification
ScriptInvokerString GetOnFailVerification()
Definition
SCR_RoomPasswordVerification.c:27
SCR_RoomPasswordVerification::OnPasswordConfirm
void OnPasswordConfirm()
Start password verification on confirming password dialog.
Definition
SCR_RoomPasswordVerification.c:80
SCR_RoomPasswordVerification::InitCheck
void InitCheck()
Definition
SCR_RoomPasswordVerification.c:51
SCR_RoomPasswordVerification::SetupDialog
void SetupDialog(notnull SCR_ConfigurableDialogUi dialog, notnull Room room, string message="")
Setup dialog UI for handling password and joining room.
Definition
SCR_RoomPasswordVerification.c:34
SCR_RoomPasswordVerification::GetOnVerified
ScriptInvokerVoid GetOnVerified()
Definition
SCR_RoomPasswordVerification.c:21
SCR_RoomPasswordVerification::FALLBACK_TIMEOUT
string FALLBACK_TIMEOUT
Definition
SCR_RoomPasswordVerification.c:9
SCR_RoomPasswordVerification::m_Room
Room m_Room
Definition
SCR_RoomPasswordVerification.c:11
SCR_RoomPasswordVerification::m_LoadingOverlay
SCR_LoadingOverlay m_LoadingOverlay
Definition
SCR_RoomPasswordVerification.c:13
SCR_RoomPasswordVerification::OnPasswordCheckResponse
void OnPasswordCheckResponse(BackendCallback callback)
Handle password check request response.
Definition
SCR_RoomPasswordVerification.c:101
SCR_RoomPasswordVerification::FALLBACK_ERROR
string FALLBACK_ERROR
Definition
SCR_RoomPasswordVerification.c:8
SCR_RoomPasswordVerification::OnPasswordCheckError
void OnPasswordCheckError(BackendCallback callback)
Handle password check request response.
Definition
SCR_RoomPasswordVerification.c:116
SCR_RoomPasswordVerification::m_Dialog
SCR_ConfigurableDialogUi m_Dialog
Definition
SCR_RoomPasswordVerification.c:12
SCR_RoomPasswordVerification::ClearInvokers
void ClearInvokers()
Definition
SCR_RoomPasswordVerification.c:137
SCR_RoomPasswordVerification::CheckRejoinAuthorization
void CheckRejoinAuthorization(Room room)
Definition
SCR_RoomPasswordVerification.c:64
SCR_RoomPasswordVerification::m_Callback
ref BackendCallback m_Callback
Definition
SCR_RoomPasswordVerification.c:15
ERestResult
ERestResult
States and result + error code produced by RestApi.
Definition
ERestResult.c:14
scripts
Game
UI
Menu
ServerBrowser
SCR_RoomPasswordVerification.c
Generated by
1.17.0