3 protected const ResourceName KICK_DIALOGS_CONFIG =
"{D3BFEE28E7D5B6A1}Configs/ServerBrowser/KickDialogs.conf";
4 protected const ResourceName HOSTING_ERROR_DIALOG_CONFIG =
"{F96212757F65C4A3}Configs/ServerBrowser/ServerHosting/Dialogs/ServerHostingErrors.conf";
6 protected const string TAG_KICK_DEFAULT =
"DEFAULT_ERROR";
7 protected const int MAX_AUTO_REJOINS = 3;
11 protected static string s_sErrorMessage;
12 protected static string s_sErrorMessageGroup;
13 protected static string s_sErrorMessageDetail;
15 protected static bool m_bReconnectEnabled;
25 static void CreateKickErrorDialog(
string msg,
string group,
string details =
"")
27 s_sErrorMessage = msg;
28 s_sErrorMessageGroup = group;
29 s_sErrorMessageDetail = details;
31 if (s_OnErrorMessageSet)
32 s_OnErrorMessageSet.Invoke();
34 DisplayKickErrorDialog();
39 static void DisplayKickErrorDialog()
41 if (s_sErrorMessage.IsEmpty())
61 s_CurrentKickDialog = dialogUi;
62 dialogUi.m_OnClose.Insert(OnDialogClose);
67 errorDialogComp.SetErrorDetail(s_sErrorMessageDetail);
71 bool reconnect = m_bReconnectEnabled && kickPreset && kickPreset.m_bCanBeReconnected;
75 confirmButton.SetVisible(reconnect);
84 string errorStr = kickPreset.m_sMessage;
85 errorDialogComp.SetErrorMessage(errorStr);
88 string strAttempt = GameSessionStorage.s_Data[
"m_iRejoinAttempt"];
89 int attempt = strAttempt.ToInt();
91 if (attempt <= MAX_AUTO_REJOINS)
93 errorStr +=
"\n" +
"#AR-ServerBrowser_JoinMessageDefault";
94 errorDialogComp.SetErrorMessage(errorStr);
96 dialogUi.SetMessage(errorStr +
" " + errorDialogComp.GetTimer());
99 errorDialogComp.GetEventOnTimerChanged().Insert(OnDialogTimerChange);
101 errorDialogComp.ShowLoading(
true);
102 errorDialogComp.SetTimer(kickPreset.m_iAutomaticReconnectTime);
103 errorDialogComp.RunTimer(
true);
107 dialogUi.SetMessage(errorStr);
110 errorDialogComp.ShowLoading(
false);
112 confirmButton.SetEnabled(
false);
116 dialogUi.m_OnConfirm.Insert(OnReconnect);
117 dialogUi.m_OnCancel.Insert(OnCancel);
124 static void CheckLastServerHost()
127 m_ProcessLastHostCallback.GetEventOnResponse().Insert(OnProcessLastHostResponse);
128 GetGame().GetBackendApi().GetClientLobby().ProcessLastHostError(m_ProcessLastHostCallback);
140 string apiStr =
typename.EnumToString(EApiCode, api);
144 case EApiCode.EACODE_ERROR_ASSET_NOT_FOUND:
157 callback.GetEventOnResponse().Remove(OnProcessLastHostResponse);
161 static void SetReconnectEnabled(
bool enabled)
163 m_bReconnectEnabled = enabled;
169 s_sErrorMessage =
string.Empty;
170 s_sErrorMessageGroup =
string.Empty;
171 s_sErrorMessageDetail =
string.Empty;
178 return s_CurrentKickDialog;
196 return s_OnReconnect;
201 protected static void OnDialogTimerChange(
SCR_RejoinDialog dialog,
int time)
203 if (!s_CurrentKickDialog)
206 s_CurrentKickDialog.SetMessage(dialog.GetErrorMessage() +
" " + time);
211 s_CurrentKickDialog.Close();
216 protected static void OnDialogClose()
218 s_CurrentKickDialog =
null;
223 protected static void OnReconnect()
226 s_OnReconnect.Invoke();
230 protected static void OnCancel()