public void AddSupplier() { ClearSupp(); int iSupplier; for (iSupplier = 0; iSupplier < GameMaster.Instance.SupplierManager.Suppliers.Count; iSupplier++) { SupplierAI supplier = GameMaster.Instance.SupplierManager.Suppliers[iSupplier]; GameObject newSupp = Instantiate(Supplierbtn, SupplierContent); //newSupp.transform.Find("SuppName").GetComponent<TMP_Text>().text = supplier.Name; newSupp.transform.Find("Button/Text").GetComponent <TMP_Text>().text = supplier.Name; newSupp.transform.Find("Button").GetComponent <Button>().onClick.AddListener(delegate { SetSupp(supplier.Name); }); } }
public void AddByCateSupp(string cat, string supp, string subcat) { ClearInventory(); int iSupplier, iItem; bool allSupp, allCat, allSubcat; if (supp == "all") { allSupp = true; } else { allSupp = false; } if (cat == "all") { allCat = true; } else { allCat = false; } if (subcat == "all") { allSubcat = true; } else { allSubcat = false; } // gets SOs from suppliers and displays them based on categoryId and supplier for (iSupplier = 0; iSupplier < GameMaster.Instance.SupplierManager.Suppliers.Count; iSupplier++) { SupplierAI supplier = GameMaster.Instance.SupplierManager.Suppliers[iSupplier]; if (supplier.Name == supp && allSupp == false) { for (iItem = 0; iItem < supplier.Inventory.Items.Count; iItem++) { Item item = supplier.Inventory.Items[iItem]; if (item.Category.Name == cat && allCat == false && allSubcat == true) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } else if (allSubcat == false && allCat == false && item.Subcategory.EnumID.ToString() == subcat) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } else if (allCat == true) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } } } else if (allSupp == true) { for (iItem = 0; iItem < supplier.Inventory.Items.Count; iItem++) { Item item = supplier.Inventory.Items [iItem]; if (item.Category.Name == cat && allCat == false && allSubcat == true) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } else if (allSubcat == false && allCat == false && item.Subcategory.EnumID.ToString() == subcat) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } else if (allCat == true) { GameObject newItem = Instantiate(ItemContainer, scrollViewContent); SetItem(newItem, iSupplier, iItem, item); } } } } }