Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ErrorDialogUI.c
Go to the documentation of this file.
1 /*
2 Extend error dialog class for simple dialog to parse messages
3 */
4 
5 //------------------------------------------------------------------------------------------------
7 {
8  protected SCR_ErrorDialogDataComponent m_ErrorDialogData;
9 
10  //------------------------------------------------------------------------------------------------
11  override void OnMenuOpen()
12  {
13  super.OnMenuOpen();
14 
15  // Find data component
16  m_ErrorDialogData = SCR_ErrorDialogDataComponent.Cast(GetRootWidget().FindHandler(SCR_ErrorDialogDataComponent));
17  }
18 
19  //------------------------------------------------------------------------------------------------
20  // Set dialog texts based on ids of title and message
21  void DisplayError(string title, string msg)
22  {
23  // Get texts
24  FindTextsInMsgConfig(title, msg);
25 
26  // Set texts
27  this.SetTitle(title);
28  this.SetMessage(msg);
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  // Pass localized names if given names of title - message match to group - entry names
33  protected void FindTextsInMsgConfig(out string title, out string msg)
34  {
35  // Check error data
36  if (!m_ErrorDialogData)
37  return;
38 
39  // Check message config
40  SCR_ErrorDialogMessages errorMessages = m_ErrorDialogData.m_ErrorDialogMessages;
41  if (!errorMessages)
42  return;
43 
44  ref array<ref SCR_ErrorDialogMessageGroup> groups = errorMessages.m_aKickCauseGroups;
45 
46  // Go through groups
47  foreach (SCR_ErrorDialogMessageGroup group : groups)
48  {
49  // Check group
50  if (group.m_sName != title)
51  continue;
52 
53  // Set localized title
54  title = group.m_sNameLocalized;
55 
56  // Get entries
57  ref array<ref SCR_ErrorDialogMessageEntry> entries = group.m_aKickCauseEntries;
58 
59  // Go through entries
60  foreach (SCR_ErrorDialogMessageEntry entry : entries)
61  {
62  // Set localized msg
63  if (entry.m_sName == msg)
64  msg = entry.m_sNameLocalized;
65  }
66 
67  }
68  }
69 };
SetMessage
bool SetMessage(string message)
Definition: SCR_BrowserHoverTooltipComponent.c:255
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
SCR_ErrorDialogMessages
Definition: SCR_GameKickMessages.c:2
DialogUI
Definition: DialogUI.c:1
SCR_ErrorDialogMessageGroup
Definition: SCR_GameKickMessages.c:10
SCR_ErrorDialogMessageEntry
Definition: SCR_GameKickMessages.c:21
ErrorDialogUI
Definition: ErrorDialogUI.c:6
SCR_ErrorDialogDataComponent
Definition: SCR_MenuDialogComponent.c:16
SetTitle
override void SetTitle(string text)
Definition: SCR_ScenarioDialogs.c:178