private void AddChildElement(GameObject content, BuyableDisplay buyable, int frequency) { UIElement element = Instantiate(elementTemplate); element.transform.SetParent(content.transform); element.SetImage(buyable.thumbnail); element.SetTitle(buyable.name + " (" + frequency + ")"); element.SetParagraph(buyable.netProfit + " ( Total: " + buyable.netProfit * frequency + ")"); }
private void PopulateContent(GameObject content, Dictionary <string, int> occurence, List <BuyableDisplay> list, out float total) { total = 0; foreach (KeyValuePair <string, int> entry in occurence) { BuyableDisplay buyable = list.Find(element => element.name == entry.Key); AddChildElement(content, buyable, entry.Value); total += buyable.netProfit * entry.Value; } }