Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SimpleEntryListDialog.c
Go to the documentation of this file.
1 
5 //------------------------------------------------------------------------------------------------
8 {
9  protected ResourceName ADDON_LINE_LAYOUT = "{99668AEF3063A9F2}UI/layouts/Menus/Common/SimpleEntry.layout";
10 
11  protected ref array<string> m_aNames = {};
12  protected ref array<SCR_SimpleEntryComponent> m_aLines = {};
13 
14  //------------------------------------------------------------------------------------------------
15  override void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
16  {
17  VerticalLayoutWidget layout = VerticalLayoutWidget.Cast(GetRootWidget().FindAnyWidget("AddonList"));
18  if (!layout)
19  {
20  Print("SCR_SimpleEntryListDialog - can't create list due to missing list layout" , LogLevel.WARNING);
21  return;
22  }
23 
24  // Create widgets
25  for (int i = 0, count = m_aNames.Count(); i < count; i++)
26  {
27  Widget w = GetGame().GetWorkspace().CreateWidgets(ADDON_LINE_LAYOUT, layout);
28 
30  if (!comp)
31  continue;
32 
33  comp.SetMessages(m_aNames[i], string.Empty);
34 
35  m_aLines.Insert(comp);
36  }
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  static SCR_SimpleEntryListDialog CreateDialog(array<string> names, string preset, ResourceName dialogsConfig = "")
41  {
42  if (dialogsConfig == string.Empty)
43  dialogsConfig = SCR_WorkshopUiCommon.DIALOGS_CONFIG;
44 
45  SCR_SimpleEntryListDialog ListDialog = new SCR_SimpleEntryListDialog(names, "");
46  SCR_ConfigurableDialogUi.CreateFromPreset(dialogsConfig, preset, ListDialog);
47  return ListDialog;
48  }
49 
50  //------------------------------------------------------------------------------------------------
52  protected void SCR_SimpleEntryListDialog(array<string> names, string preset)
53  {
54  m_aNames.InsertAll(names);
55 
56  if (!preset.IsEmpty())
57  SCR_ConfigurableDialogUi.CreateFromPreset(SCR_WorkshopUiCommon.DIALOGS_CONFIG, preset, this);
58  }
59 };
SCR_SimpleEntryListDialog
Shows a list of simple entries.
Definition: SCR_SimpleEntryListDialog.c:7
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
SCR_SimpleEntryComponent
Definition: SCR_SimpleEntryComponent.c:6
m_aLines
protected ref array< ref MapLine > m_aLines
Definition: SCR_MapDrawingUI.c:183
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
layout
UI layouts HUD CampaignMP CampaignMainHUD layout
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:20
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
SCR_WorkshopUiCommon
Definition: SCR_WorkshopUiCommon.c:5