//private void CreateProductItems() //{ // for (int i = 0; i < 12; i++) // { // UIProduct product = Instantiate<UIProduct>(_uiProductPre, _productScrollView.content); // _productList.Add(product); // product.gameObject.SetActive(false); // } //} private UIProduct GetProduct(int id) { foreach (var product in _productList) { if (product.ID == id) { return(product); } } UIProduct uiProduct = Instantiate <UIProduct>(_uiProductPre, _productScrollView.content); _productList.Add(uiProduct); return(uiProduct); }
private void OnReceiveProductData(object sender, GameEventArgs e) { ReceiveProductDataEventArgs args = (ReceiveProductDataEventArgs)e; for (int i = 0; i < args.ProductModels.Length; i++) { UIProduct product = GetProduct(args.ProductModels[i].id); if (product != null) { ProductModel productModel = args.ProductModels[i]; product.ID = productModel.id; product.Binding(productModel.name, MainUIProcedure.Domain + productModel.iconimage, productModel.description, MainUIProcedure.Domain + productModel.assetfile, productModel.downloadcount); } } }