4 [
Attribute(defvalue:
EResourceType.SUPPLIES.ToString(), uiwidget: UIWidgets.ComboBox,
desc:
"Sets the type of Resource to be used.\nOnly a transaction matching Resource types can be successfully concluded.", enums: ParamEnumArray.FromEnum(
EResourceType))]
8 protected int m_iMaxResourceValue = -1;
16 int GetMaxResourceValue()
18 return m_iMaxResourceValue;
23 protected void SetMaxResourceValue(
int maxResourceValue)
25 m_iMaxResourceValue = maxResourceValue;
34 Resource entityPrefab = Resource.Load(entry.GetPrefab());
38 Debug.Error2(
"SCR_ResourceContainerItemData",
"Data '" + entry.GetPrefab() +
"' (index: " + entry.GetCatalogIndex() +
") in catalog '" +
typename.EnumToString(
EEntityCatalogType, entry.GetCatalogParent().GetCatalogType()) +
"' has an invalid prefab!");
48 Debug.Error2(
"SCR_ResourceContainerItemData",
"Data '" + entry.GetPrefab() +
"' (index: " + entry.GetCatalogIndex() +
") in catalog '" +
typename.EnumToString(
EEntityCatalogType, entry.GetCatalogParent().GetCatalogType()) +
"' has an invalid prefab!");
56 int componentsCount = entitySource.GetComponentCount();
57 for (
int i = 0; i < componentsCount; i++)
60 IEntityComponentSource componentSource = entitySource.GetComponent(i);
61 if (componentSource.GetClassName().ToType().IsInherited(SCR_ResourceComponent))
64 BaseContainerList baseContainers = componentSource.GetObjectArray(
"m_aContainers");
66 if (!baseContainers || baseContainers.Count() == 0)
69 Debug.Error2(
"SCR_ResourceContainerItemData",
"Data '" + entry.GetPrefab() +
"' (index: " + entry.GetCatalogIndex() +
") in catalog '" +
typename.EnumToString(
EEntityCatalogType, entry.GetCatalogParent().GetCatalogType()) +
"' has 'SCR_ResourceComponent' but no SCR_ResourceContainer is assigned! (or container variable has been renamed)");
74 for (
int j = baseContainers.Count() - 1; j >= 0; j--)
76 resourceContainer =
SCR_ResourceContainer.Cast(BaseContainerTools.CreateInstanceFromContainer(baseContainers.Get(j)));
78 if (resourceContainer && resourceContainer.GetResourceType() == m_eResourceType)
79 return resourceContainer;
86 Debug.Error2(
"SCR_ResourceContainerItemData",
"Data '" + entry.GetPrefab() +
"' (index: " + entry.GetCatalogIndex() +
") in catalog '" +
typename.EnumToString(
EEntityCatalogType, entry.GetCatalogParent().GetCatalogType()) +
"' has no 'SCR_ResourceComponent'!");
96 if (m_iMaxResourceValue != -1)
101 if (resourceContainer)
102 SetMaxResourceValue(resourceContainer.GetMaxResourceValue());