public override void GenerateList(List <ResourcesSystem.ResourceInfo> resourceInfo) { _generatedElements = new ResourceTradingElement[resourceInfo.Count]; for (int i = 0; i < resourceInfo.Count; i++) { if (_elementsContainer == null) { throw new ArgumentNullException("Elements Container field must not be null."); } var tempResourceValue = _resourcesStorage.GetResourceValue(resourceInfo[i].GetResourceType()); var newElement = Instantiate(_resourceTradingPrefab, _elementsContainer); var tempText = resourceInfo[i].GetName(); newElement.SetTradingMenu(this); newElement.SetResourceNameAndValue(tempText, tempResourceValue); newElement.SetResourceType(resourceInfo[i].GetResourceType()); _generatedElements[i] = newElement; if (tempResourceValue == 0) { newElement.gameObject.SetActive(false); } else { newElement.gameObject.SetActive(true); _activeElementsCount++; } } CheckActiveElementsCount(); }
private string CreateResourceCountText(ResourcesSystem.ResourceInfo resourceInfo) { _resourceValue = Converter.ValueToString(_resourcesStorage.GetResourceValue(resourceInfo.GetResourceType())); return(resourceInfo.GetName() + _resourceValue + ResourcesSystem.GetUnitsOfMeasurement()); }