Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
errorproperties.c
Go to the documentation of this file.
1 class ErrorProperties
3 {
4  const string EP_HEADER_FORMAT_STRING = "%1 (%2)";
5  const string EP_MESSAGE_FORMAT_STRING = "%1\n(%2)";
6 
7  protected string m_Message;
8  protected string m_ServerMessage;
9 
10  void ErrorProperties(string message, string serverMessage)
11  {
12  m_Message = message;
13  m_ServerMessage = serverMessage;
14  }
15 
16  void HandleError(int errorCode, string additionalInfo = "") {}
17 
18  string GetClientMessage(string additionalInfo = "")
19  {
20  if ( additionalInfo != "" )
21  return string.Format(EP_MESSAGE_FORMAT_STRING, m_Message, additionalInfo);
22  else
23  return m_Message;
24  }
25 
26  string GetServerMessage(string additionalInfo = "")
27  {
28  if ( additionalInfo != "" )
29  return string.Format(EP_MESSAGE_FORMAT_STRING, m_ServerMessage, additionalInfo);
30  else
31  return m_ServerMessage;
32  }
33 }
34 
37 {
38  protected string m_Header;
39  protected int m_DialogButtonType;
40  protected int m_DefaultButton;
41  protected int m_DialogMeaningType;
43  protected bool m_DisplayAdditionalInfo;
44 
45  void DialogueErrorProperties(string message, string serverMessage, string header, UIScriptedMenu handler = null, int dialogButtonType = DBT_OK, int defaultButton = DBB_OK, int dialogMeaningType = DMT_EXCLAMATION, bool displayAdditionalInfo = true)
46  {
47  m_Header = header;
48  m_DialogButtonType = dialogButtonType;
49  m_DefaultButton = defaultButton;
50  m_DialogMeaningType = dialogMeaningType;
51  m_Handler = handler;
52  m_DisplayAdditionalInfo = displayAdditionalInfo;
53  }
54 
55  override void HandleError(int errorCode, string additionalInfo = "")
56  {
57 #ifdef NO_GUI
58  return; //do not display error if GUI is disabled
59 #endif
60 
61 #ifdef SERVER
62  return;
63 #else
64  string message;
65  if (m_DisplayAdditionalInfo && additionalInfo != "")
66  message = string.Format(EP_MESSAGE_FORMAT_STRING, m_Message, additionalInfo);
67  else
68  message = m_Message;
69 
70  GetGame().GetUIManager().ShowDialog(
71  string.Format(EP_HEADER_FORMAT_STRING, m_Header, ErrorModuleHandler.GetErrorHex(errorCode)),
73 #endif
74  }
75 
76  string GetHeader() { return m_Message; }
81 }
GetGame
proto native CGame GetGame()
GetDialogButtonType
int GetDialogButtonType()
Definition: errorproperties.c:77
UIScriptedMenu
Definition: dayzgame.c:63
ErrorProperties
Class which holds the properties and handling of an error.
Definition: errorproperties.c:2
HandleError
override void HandleError(int errorCode, string additionalInfo="")
Definition: errorproperties.c:55
m_DialogButtonType
protected int m_DialogButtonType
Definition: errorproperties.c:39
GetDialogMeaningType
int GetDialogMeaningType()
Definition: errorproperties.c:79
DialogueErrorProperties
void DialogueErrorProperties(string message, string serverMessage, string header, UIScriptedMenu handler=null, int dialogButtonType=DBT_OK, int defaultButton=DBB_OK, int dialogMeaningType=DMT_EXCLAMATION, bool displayAdditionalInfo=true)
Definition: errorproperties.c:45
GetHeader
string GetHeader()
Definition: errorproperties.c:76
m_DisplayAdditionalInfo
protected bool m_DisplayAdditionalInfo
Definition: errorproperties.c:43
m_Handler
protected UIScriptedMenu m_Handler
Definition: errorproperties.c:42
m_DefaultButton
protected int m_DefaultButton
Definition: errorproperties.c:40
GetDefaultButton
int GetDefaultButton()
Definition: errorproperties.c:78
m_Header
class ErrorProperties m_Header
Error which shows a generic Dialogue UI.
m_DialogMeaningType
protected int m_DialogMeaningType
Definition: errorproperties.c:41
GetHandler
UIScriptedMenu GetHandler()
Definition: errorproperties.c:80
ErrorModuleHandler
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Definition: errormodulehandler.c:28