internal void AddOneItemToContainer(List <ResourceView> resourceViews, int viewIndex, Transform itemContainer, Item item, int itemAmount, float?neededCount, Func <Item, int, string> itemTooltipTextFunc) { ResourceView view = this.GetResourceView(resourceViews, viewIndex, itemContainer); Panel valueCont = view.gameObject.transform.Find("ValueContainer").GetComponent <Panel>(); Transform demandCont = view.transform.Find("DemandContainer"); if (neededCount != null) { view.Show(null, null, LazyManager <IconRenderer> .Current.GetItemIcon(item.AssetId), StringHelper.Simplify((double)itemAmount), StringHelper.FormatCountString(item.DisplayName, itemAmount.ToString("N0") + "/" + neededCount.Value.ToString("N0"))); demandCont.Find <Text>("Value").text = StringHelper.Simplify(neededCount.Value); demandCont.gameObject.SetActive(true); float ratio = itemAmount / neededCount.Value; if (ratio > 1.05f) { valueCont.color = Color.blue; } else if (ratio < 0.9f) { valueCont.color = Color.red; } else { valueCont.color = new Color(0, 0.88f, 0); } } else { view.ShowItem(item, null, itemAmount); valueCont.color = _resourceViewOrigColor; demandCont.gameObject.SetActive(false); } if (itemTooltipTextFunc != null) { view.GetComponent <TooltipTarget>().DynamicText = delegate { return(itemTooltipTextFunc.Invoke(item, itemAmount)); }; } }