DayZ 1.24
Loading...
Searching...
No Matches
ConnectErrorScriptModule.c
Go to the documentation of this file.
2{
3 UNKNOWN = -1, // -1 must always be UNKNOWN
4 OK = 0, // 0 must always be OK
5
6 ALREADY_CONNECTING, // Already joining a server
7 ALREADY_CONNECTING_THIS, // Already joining this exact server
8}
9
10class ConnectErrorScriptModule : ErrorHandlerModuleScript
11{
13 {
14 SetCategory(ErrorCategory.ConnectErrorScript);
15 }
17 override void InitOptionalVariables()
18 {
19 super.InitOptionalVariables();
20
21 m_Header = "#server_browser_connecting_failed";
22#ifndef NO_GUI
24#endif
25 }
26
27 override void FillErrorDataMap()
28 {
29 super.FillErrorDataMap();
30
31 InsertDialogueErrorProperties(EConnectErrorScript.ALREADY_CONNECTING, "#STR_script_already_connecting", DBT_YESNOCANCEL, DBB_NO);
32 InsertDialogueErrorProperties(EConnectErrorScript.ALREADY_CONNECTING_THIS, "#STR_script_already_connecting_this");
33 }
34
36 {
37 switch (eventTypeId)
38 {
40#ifndef NO_GUI
41 g_Game.GetUIManager().CloseSpecificDialog(m_LastErrorThrown);
42#endif
43 break;
44
45 default:
46 break;
47 }
48 }
49}
50
52{
53 protected static void DisconnectSession(bool loadMpPrivilege)
54 {
55 g_Game.DisconnectSessionForce();
56 g_Game.DisconnectSessionScript();
57
60 }
61
62 override bool OnModalResult(Widget w, int x, int y, int code, int result)
63 {
64 super.OnModalResult(w, x, y, code, result);
65
67 switch (error)
68 {
69 case EConnectErrorScript.ALREADY_CONNECTING:
70 {
71 switch (result)
72 {
73 case DBB_YES:
74 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(DisconnectSession, true);
75 break;
76 case DBB_CANCEL:
77 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(DisconnectSession, false);
78 break;
79
80 default:
81 break;
82 }
83 break;
84 }
85
86 default:
87 break;
88 }
89
90 return true;
91 }
92}
override void InitOptionalVariables()
override void OnEvent(EventType eventTypeId, Param params)
Handles VON-related events.
enum EConnectErrorScript ConnectErrorScriptModule()
override void FillErrorDataMap()
DayZGame g_Game
Definition DayZGame.c:3528
class ErrorHandlerModule m_Header
This is where to input logic and extend functionality of ErrorHandlerModule.
int m_LastErrorThrown
Holds the last thrown error in this module, defaults to 0.
ref UIScriptedMenu m_UIHandler
Optional: The UI the handler might generally use
void InsertDialogueErrorProperties(int code, string message, int dialogButtonType=DBT_OK, int defaultButton=DBB_OK, int dialogMeaningType=DMT_EXCLAMATION, bool displayAdditionalInfo=true)
Insert an error with Dialogue as handling, using the Optional Variables.
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
Icon x
Icon y
static void DisconnectSession(bool loadMpPrivilege)
override bool OnModalResult(Widget w, int x, int y, int code, int result)
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
static proto int GetCodeFromError(int errorCode)
Returns the code of the error.
static void LoadMPPrivilege()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:466
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
TypeID EventType
Definition EnWidgets.c:55