Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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 
11 {
13  {
14  SetCategory(ErrorCategory.ConnectErrorScript);
15  }
16 
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 
35  override void OnEvent(EventType eventTypeId, Param params)
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 
58  if (loadMpPrivilege)
59  {
60  OnlineServices.LoadMPPrivilege();
61  }
62  }
63 
64  override bool OnModalResult(Widget w, int x, int y, int code, int result)
65  {
66  super.OnModalResult(w, x, y, code, result);
67 
68  int error = ErrorModuleHandler.GetCodeFromError(code);
69  switch ( error )
70  {
71  case EConnectErrorScript.ALREADY_CONNECTING:
72  {
73  switch ( result )
74  {
75  case DBB_YES:
76  g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(DisconnectSession, true);
77  break;
78  case DBB_CANCEL:
79  g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(DisconnectSession, false);
80  break;
81 
82  default:
83  break;
84  }
85  break;
86  }
87 
88  default:
89  break;
90  }
91 
92  return true;
93  }
94 }
FillErrorDataMap
override void FillErrorDataMap()
Definition: connecterrorscriptmodule.c:27
UIScriptedMenu
Definition: dayzgame.c:63
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition: tools.c:8
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
y
Icon y
ConnectErrorScriptModuleUI
Definition: connecterrorscriptmodule.c:51
MPSessionPlayerReadyEventTypeID
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition: gameplay.c:468
ErrorCategory
ErrorCategory
ErrorCategory - To decide what ErrorHandlerModule needs to be called and easily identify where it cam...
Definition: errormodulehandler.c:4
OnEvent
override void OnEvent(EventType eventTypeId, Param params)
Handles VON-related events.
Definition: connecterrorscriptmodule.c:35
EventType
TypeID EventType
Definition: enwidgets.c:55
InsertDialogueErrorProperties
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.
Definition: errorhandlermodule.c:233
ALREADY_CONNECTING_THIS
ALREADY_CONNECTING_THIS
Definition: connecterrorscriptmodule.c:6
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
m_LastErrorThrown
protected int m_LastErrorThrown
Holds the last thrown error in this module, defaults to 0.
Definition: errorhandlermodule.c:69
m_Header
class ErrorHandlerModule m_Header
This is where to input logic and extend functionality of ErrorHandlerModule.
x
Icon x
InitOptionalVariables
override void InitOptionalVariables()
Definition: connecterrorscriptmodule.c:17
EConnectErrorScript
EConnectErrorScript
Definition: connecterrorscriptmodule.c:1
ConnectErrorScriptModule
enum EConnectErrorScript ConnectErrorScriptModule()
Definition: connecterrorscriptmodule.c:12
OK
OK
Definition: connecterrorscriptmodule.c:3
Widget
Definition: enwidgets.c:189
UNKNOWN
UNKNOWN
Definition: connecterrorscriptmodule.c:2
OnlineServices
Definition: onlineservices.c:1
ALREADY_CONNECTING
ALREADY_CONNECTING
Definition: connecterrorscriptmodule.c:5
ErrorHandlerModuleScript
void ErrorHandlerModuleScript()
Constructor, by default calls the function that will fill the ErrorDataMap.
Definition: errorhandlermodule.c:81
ErrorModuleHandler
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Definition: errormodulehandler.c:28
m_UIHandler
protected ref UIScriptedMenu m_UIHandler
Optional: The UI the handler might generally use
Definition: errorhandlermodule.c:67