Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EntityCatalogMultiList.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(configRoot: true), SCR_BaseContainerCustomEntityCatalogCatalog(EEntityCatalogType, "m_eEntityCatalogType", "m_aEntityEntryList", "m_aMultiLists")]
6 {
7  [Attribute(desc: "An array of all multi lists which in turn hold lists of entries. Used for readablility for devs and each works the same as the m_aEntityEntryList. You are free to make, delete, rename and move lists as you want and names do not need to be unique. Note that this array will be null after Init as it will be merged into the m_aEntityEntryList")]
8  protected ref array <ref SCR_EntityCatalogMultiListEntry> m_aMultiLists;
9 
10  //======================================== INIT ========================================\\
11  protected override void InitCatalog()
12  {
13  //~ Merge entries lists into the m_aEntityEntryList so the system can use it
14  foreach (SCR_EntityCatalogMultiListEntry multiList: m_aMultiLists)
15  {
16  foreach (SCR_EntityCatalogEntry entry : multiList.m_aEntities)
17  {
18  //~ Ignore disabled entries
19  if (!entry.IsEnabled())
20  continue;
21 
22  m_aEntityEntryList.Insert(entry);
23  }
24  }
25 
26  //~ Clear Multilist array as no need to keep data
27  m_aMultiLists = null;
28 
29  //~ Default init
30  super.InitCatalog();
31  }
32 }
33 
34 //--------------------------------- Multi List entry ---------------------------------\\
35 [BaseContainerProps(), SCR_BaseContainerCustomEntityCatalogMultiListEntry("m_sIdentifier", "m_aEntities")]
36 class SCR_EntityCatalogMultiListEntry
37 {
38  [Attribute("UNKNOWN", desc: "For devs only to understand which entries are in the list")]
39  protected string m_sIdentifier;
40 
41  [Attribute(desc: "List of entries. This list will be merged into the m_aEntityEntryList on init. You can still add entries to the m_aEntityEntryList as those will NOT be cleared")]
42  ref array<ref SCR_EntityCatalogEntry> m_aEntities;
43 }
44 
45 //--------------------------------- Custom Attribute for MultiList ---------------------------------\\
46 class SCR_BaseContainerCustomEntityCatalogMultiListEntry : BaseContainerCustomTitle
47 {
48  protected string m_sPropertyName;
49  protected string m_sEntityListName;
50 
51  void SCR_BaseContainerCustomEntityCatalogMultiListEntry(string propertyName, string entityListName)
52  {
53  m_sPropertyName = propertyName;
54  m_sEntityListName = entityListName;
55  }
56 
57  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
58  {
59  bool hasError = false;
60  string propertyName;
61  if (!source.Get(m_sPropertyName, propertyName))
62  {
63  return false;
64  }
65 
66  //~ Get entry count
67  array<ref SCR_EntityCatalogEntry> entityList;
68  if (!source.Get(m_sEntityListName, entityList))
69  return false;
70 
71  int enabledCount = 0;
72 
73  //~ Get count of enabled entries
74  foreach (SCR_EntityCatalogEntry entity: entityList)
75  {
76  if (entity.IsEnabled())
77  {
78  enabledCount++;
79 
80  //~ Is Empty show error warning in title
81  if (entity.GetPrefab() == "")
82  hasError = true;
83  }
84  }
85 
86  string format;
87  //~ Does not have disabled entries
88  if (enabledCount == entityList.Count())
89  format = "%1 (%2)";
90  //~ Has disabled entries
91  else
92  format = "%1 (%3 of %2)";
93 
94  if (hasError)
95  format += " !!";
96 
97  title = string.Format(format, propertyName, entityList.Count(), enabledCount);
98  return true;
99  }
100 };
SCR_EntityCatalogMultiList
Definition: SCR_EntityCatalogMultiList.c:5
_WB_GetCustomTitle
SCR_ControlPlayerCameraComponent _WB_GetCustomTitle
Definition: SCR_DestructionBaseComponent.c:697
EEntityCatalogType
EEntityCatalogType
Definition: EEntityCatalogType.c:4
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_sIdentifier
string m_sIdentifier
Definition: SCR_MapMarkerEntryPlaced.c:3
SCR_BaseContainerCustomEntityCatalogCatalog
Definition: SCR_EntityCatalog.c:599
SCR_EntityCatalog
Definition: SCR_EntityCatalog.c:181
m_aMultiLists
protected ref array< ref SCR_EntityCatalogMultiListEntry > m_aMultiLists
Definition: SCR_EntityCatalogMultiList.c:3
m_sPropertyName
BaseContainerCustomCheckIntWithFlagTitleField m_sPropertyName
Attribute for setting UIInfo's name property as (Localized) custom title.
SCR_EntityCatalogEntry
Definition: SCR_EntityCatalogEntry.c:5
Attribute
SCR_EntityCatalogMultiList SCR_EntityCatalog Attribute("UNKNOWN", desc:"For devs only to understand which entries are in the list")
Definition: SCR_EntityCatalogMultiList.c:38
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468