186 [
Attribute(
desc:
"List of all entities of the given type (Note that this list can still be used if using the 'SCR_EntityCatalogMultiList' Class. All entries in the multi lists will be merged into this one on init including the entries already in it)")]
187 protected ref array<ref SCR_EntityCatalogEntry> m_aEntityEntryList;
196 return m_eEntityCatalogType;
208 int GetEntityList(notnull out array<SCR_EntityCatalogEntry> entityList)
216 entityList.Insert(entityEntry);
219 return entityList.Count();
235 if (entityEntry.GetPrefab() == prefabToFind)
254 if (!m_aEntityEntryList.IsIndexValid(
index))
256 Print(
string.Format(
"'SCR_EntityCatalog' Function: 'GetCatalogEntry()'. index: '%1' is invalid for catalog type '%2'.",
index,
typename.EnumToString(
EEntityCatalogType, m_eEntityCatalogType)), LogLevel.ERROR);
261 return m_aEntityEntryList[
index];
274 int GetEntityListWithLabel(
EEditableEntityLabel label, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
277 filteredEntityList.Clear();
283 if (!entityEntry.HasEditableEntityLabel(label))
287 filteredEntityList.Insert(entityEntry);
290 return filteredEntityList.Count();
302 int GetEntityListExcludingLabel(
EEditableEntityLabel excludinglabel, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
305 filteredEntityList.Clear();
311 if (entityEntry.HasEditableEntityLabel(excludinglabel))
315 filteredEntityList.Insert(entityEntry);
318 return filteredEntityList.Count();
332 int GetFullFilteredEntityListWithLabels(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<EEditableEntityLabel> includedLabels =
null, array<EEditableEntityLabel> excludedLabels =
null,
bool needsAllIncluded =
true)
335 filteredEntityList.Clear();
341 if (excludedLabels !=
null && !excludedLabels.IsEmpty() && entityEntry.HasAnyEditableEntityLabels(excludedLabels))
345 if (includedLabels !=
null && !includedLabels.IsEmpty())
348 if (needsAllIncluded)
350 if (!entityEntry.HasAllEditableEntityLabels(includedLabels))
356 if (!entityEntry.HasAnyEditableEntityLabels(includedLabels))
362 filteredEntityList.Insert(entityEntry);
365 return filteredEntityList.Count();
379 int GetEntityListWithData(
typename dataClass, notnull out array<SCR_EntityCatalogEntry> filteredEntityList, out array<SCR_BaseEntityCatalogData> dataList =
null)
382 filteredEntityList.Clear();
393 data = entityEntry.GetEntityDataOfType(dataClass);
399 dataList.Insert(
data);
402 filteredEntityList.Insert(entityEntry);
405 return filteredEntityList.Count();
417 int GetEntityListExcludingData(
typename excludingDataClass, notnull out array<SCR_EntityCatalogEntry> filteredEntityList)
420 filteredEntityList.Clear();
426 if (entityEntry.HasEntityDataOfType(excludingDataClass))
430 filteredEntityList.Insert(entityEntry);
433 return filteredEntityList.Count();
447 int GetFullFilteredEntityListWithData(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<typename> includedDataClasses =
null, array<typename> excludedDataClasses =
null,
bool needsAllIncluded =
true)
450 filteredEntityList.Clear();
456 if (excludedDataClasses !=
null && !excludedDataClasses.IsEmpty() && entityEntry.HasAnyEntityDataOfTypes(excludedDataClasses))
460 if (includedDataClasses !=
null && !includedDataClasses.IsEmpty())
463 if (needsAllIncluded)
465 if (!entityEntry.HasAllEntityDataOfTypes(includedDataClasses))
471 if (!entityEntry.HasAnyEntityDataOfTypes(includedDataClasses))
477 filteredEntityList.Insert(entityEntry);
480 return filteredEntityList.Count();
498 int GetFullFilteredEntityList(notnull out array<SCR_EntityCatalogEntry> filteredEntityList, array<EEditableEntityLabel> includedLabels =
null, array<EEditableEntityLabel> excludedLabels =
null, array<typename> includedDataClasses =
null, array<typename> excludedDataClasses =
null,
bool needsAllIncludedLabels =
true,
bool needsAllIncludedClasses =
true)
501 filteredEntityList.Clear();
507 if (excludedLabels !=
null && !excludedLabels.IsEmpty() && entityEntry.HasAnyEditableEntityLabels(excludedLabels))
511 if (excludedDataClasses !=
null && !excludedDataClasses.IsEmpty() && entityEntry.HasAnyEntityDataOfTypes(excludedDataClasses))
515 if (includedLabels !=
null && !includedLabels.IsEmpty())
518 if (needsAllIncludedLabels)
520 if (!entityEntry.HasAllEditableEntityLabels(includedLabels))
526 if (!entityEntry.HasAnyEditableEntityLabels(includedLabels))
532 if (includedDataClasses !=
null && !includedDataClasses.IsEmpty())
534 if (needsAllIncludedClasses)
536 if (!entityEntry.HasAllEntityDataOfTypes(includedDataClasses))
541 if (!entityEntry.HasAnyEntityDataOfTypes(includedDataClasses))
547 filteredEntityList.Insert(entityEntry);
550 return filteredEntityList.Count();
561 array<SCR_EntityCatalogEntry> entityList = {};
562 catalogToMerge.GetEntityList(entityList);
567 m_aEntityEntryList.Insert(entry);
575 for (
int i = m_aEntityEntryList.Count() - 1; i >= 0; i--)
580 m_aEntityEntryList.RemoveOrdered(i);
585 m_aEntityEntryList[i].InitEntry(
this, i);
601 private typename m_EnumType;
602 private string m_PropertyName;
603 protected string m_sEntityListName;
604 protected string m_sEntityMultiListName;
609 m_EnumType = enumType;
610 m_PropertyName = propertyName;
611 m_sEntityListName = entityListName;
612 m_sEntityMultiListName = multiListName;
616 override bool _WB_GetCustomTitle(BaseContainer source, out
string title)
618 bool hasError =
false;
621 if (!source.Get(m_PropertyName, enumValue))
627 int enabledCount = 0;
630 array<ref SCR_EntityCatalogEntry> entityList;
631 if (!source.Get(m_sEntityListName, entityList))
636 if (entry.IsEnabled())
641 if (entry.GetPrefab().IsEmpty())
648 array<ref SCR_EntityCatalogMultiListEntry> multiLists;
649 if (source.Get(m_sEntityMultiListName, multiLists))
651 foreach (SCR_EntityCatalogMultiListEntry multiList: multiLists)
655 if (entry.IsEnabled())
660 if (entry.GetPrefab().IsEmpty())
671 if (enabledCount == totalCount)
675 format =
"%1 (%3 of %2)";
681 title =
string.Format(format,
typename.EnumToString(m_EnumType, enumValue), totalCount, enabledCount);