Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityCatalogMultiList.c
Go to the documentation of this file.
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 //------------------------------------------------------------------------------------------------
14 int GetMultiList(notnull out array <SCR_EntityCatalogMultiListEntry> multiLists)
15 {
16 multiLists.Clear();
17
18 if (!m_aMultiLists)
19 return 0;
20
21 foreach (SCR_EntityCatalogMultiListEntry entry : m_aMultiLists)
22 {
23 multiLists.Insert(entry);
24 }
25
26 return multiLists.Count();
27 }
28
29 //------------------------------------------------------------------------------------------------
30 override void ClearCatalogOnMerge()
31 {
32 super.ClearCatalogOnMerge();
33
34 m_aMultiLists.Clear();
35 }
36
37 //======================================== INIT ========================================\\
38 protected override void InitCatalog()
39 {
40 //~ Merge entries lists into the m_aEntityEntryList so the system can use it
41 foreach (SCR_EntityCatalogMultiListEntry multiList: m_aMultiLists)
42 {
43 foreach (SCR_EntityCatalogEntry entry : multiList.m_aEntities)
44 {
45 //~ Ignore disabled entries
46 if (!entry.IsEnabled())
47 continue;
48
49 m_aEntityEntryList.Insert(entry);
50 }
51 }
52
53 //~ Clear Multilist array as no need to keep data
54 m_aMultiLists = null;
55
56 //~ Default init
57 super.InitCatalog();
58 }
59}
60
61//--------------------------------- Multi List entry ---------------------------------\\
62[BaseContainerProps(), SCR_BaseContainerCustomEntityCatalogMultiListEntry("m_sIdentifier", "m_aEntities")]
63class SCR_EntityCatalogMultiListEntry
64{
65 [Attribute("UNKNOWN", desc: "For devs only to understand which entries are in the list")]
66 protected string m_sIdentifier;
68 [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")]
69 ref array<ref SCR_EntityCatalogEntry> m_aEntities;
70}
71
72//--------------------------------- Custom Attribute for MultiList ---------------------------------\\
73class SCR_BaseContainerCustomEntityCatalogMultiListEntry : BaseContainerCustomTitle
74{
75 protected string m_sPropertyName;
76 protected string m_sEntityListName;
77
78 void SCR_BaseContainerCustomEntityCatalogMultiListEntry(string propertyName, string entityListName)
79 {
80 m_sPropertyName = propertyName;
81 m_sEntityListName = entityListName;
82 }
83
84 override bool _WB_GetCustomTitle(BaseContainer source, out string title)
85 {
86 bool hasError = false;
87 string propertyName;
88 if (!source.Get(m_sPropertyName, propertyName))
89 {
90 return false;
91 }
92
93 //~ Get entry count
94 array<ref SCR_EntityCatalogEntry> entityList;
95 if (!source.Get(m_sEntityListName, entityList))
96 return false;
97
98 int enabledCount = 0;
99
100 //~ Get count of enabled entries
101 foreach (SCR_EntityCatalogEntry entity: entityList)
102 {
103 if (entity.IsEnabled())
104 {
105 enabledCount++;
106
107 //~ Is Empty show error warning in title
108 if (entity.GetPrefab() == "")
109 hasError = true;
110 }
111 }
112
113 string format;
114 //~ Does not have disabled entries
115 if (enabledCount == entityList.Count())
116 format = "%1 (%2)";
117 //~ Has disabled entries
118 else
119 format = "%1 (%3 of %2)";
120
121 if (hasError)
122 format += " !!";
123
124 title = string.Format(format, propertyName, entityList.Count(), enabledCount);
125 return true;
126 }
127};
EEntityCatalogType
BaseContainerCustomCheckIntWithFlagTitleField m_sPropertyName
Attribute for setting UIInfo's name property as (Localized) custom title.
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ref array< ref SCR_EntityCatalogMultiListEntry > m_aMultiLists
string m_sIdentifier
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
If is Enabled return If enabled or disabled *bool IsEnabled()
ref array< ref SCR_EntityCatalogEntry > m_aEntityEntryList
int GetMultiList(notnull out array< SCR_EntityCatalogMultiListEntry > multiLists)
ref array< ref SCR_EntityCatalogMultiListEntry > m_aMultiLists
SCR_FieldOfViewSettings Attribute
class SCR_BaseManualCameraComponent _WB_GetCustomTitle(BaseContainer source, out string title)