public void PanelOn(GameObject exPanel, Product product) { this.exPanel = exPanel; this.product = product; exPanel.gameObject.SetActive(false); productUnit.InfoChange(product, gameObject); ResetReviewAndRead(); }
public void PanelOn(GameObject exPanel, Product product) { this.exPanel = exPanel; this.product = product; exPanel.SetActive(false); ChangeContentSize(); ResetComponents(); productUnit.InfoChange(product, gameObject); }
public void AddProductBookmarks() { List <int> productBookmarkList = StringToIntList(Panels.instance.memberInfo.member.productBookmarks); int amount = productBookmarkList.Count; Vector2 panelSize = body.GetComponent <RectTransform>().rect.size; RectTransform content = body.GetChild(0).GetChild(0).GetComponent <RectTransform>(); float ySize = panelSize.y / productOnePageAmount; float contentYSize = panelSize.y; if (amount > productOnePageAmount) { contentYSize = ySize * amount; } content.offsetMin = new Vector2(0, 0); content.offsetMax = new Vector2(0, contentYSize); content.localPosition = new Vector2(0, -contentYSize / 2); for (int i = 0; i < amount; i++) { Transform newBookmark = Instantiate(productBookmark); newBookmark.SetParent(content); ProductBookmark bookmarkInfo = newBookmark.GetComponent <ProductBookmark>(); productBookmarks.Add(bookmarkInfo); RectTransform rectTransform = newBookmark.GetComponent <RectTransform>(); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = new Vector2(0, ySize); rectTransform.localPosition = new Vector2(0, contentYSize / 2 + -ySize * i - ySize / 2); int productID = productBookmarkList[i]; string sql = "SELECT * FROM product WHERE id = " + productID + ";"; MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql); reader.Read(); Product product = new Product(); product.id = reader.GetInt32(0); product.name = reader.GetString(1); product.barcode = reader.GetString(2); product.company = reader.GetString(3); product.category = product.koreanToCategory(reader.GetString(4)); product.ingredients = reader.GetString(5); product.imagePath = reader.GetString(6); ProductUnit productUnit = newBookmark.GetChild(0).GetComponent <ProductUnit>(); productUnit.InfoChange(product, gameObject); reader.Close(); DbConnecter.instance.CloseConnection(); bookmarkInfo.productID = product.id; } }
public void PanelOn(Product product, GameObject exPanel) { this.product = product; this.exPanel = exPanel; exPanel.gameObject.SetActive(false); List <Ingredient> ingredients = new List <Ingredient>(); List <int> ingredientIntList = StringToIntList(product.ingredients); DbConnecter.instance.Connect(); for (int i = 0; i < ingredientIntList.Count; i++) { string sql = "SELECT * FROM ingredient WHERE id = " + ingredientIntList[i] + ";"; MySql.Data.MySqlClient.MySqlDataReader reader = DbConnecter.instance.Reader(sql); reader.Read(); Ingredient ingredient = new Ingredient(); ingredient.id = reader.GetInt32(0); ingredient.casNo = reader.GetString(1); ingredient.english = reader.GetString(2); ingredient.korean = reader.GetString(3); ingredient.ewgGrade = reader.GetString(4); ingredient.eye = reader.GetString(5); ingredient.respiratory = reader.GetString(6); ingredient.digestive = reader.GetString(7); ingredient.reproductive = reader.GetString(8); ingredient.integumentary = reader.GetString(9); ingredients.Add(ingredient); reader.Close(); } DbConnecter.instance.CloseConnection(); CheckBookmark(); AllChange(ingredients); productUnit.InfoChange(product, gameObject); ChangeReviewSummary(); circleGraph.Making(ingredients); }
void AddMyReview(List <Review> reviews, List <Product> products) { int amount = reviews.Count; RectTransform content = body.GetChild(0).GetComponent <RectTransform>(); for (int i = 0; i < amount; i++) { Transform newMyReviewUnit = Instantiate(myReviewUnit); newMyReviewUnit.SetParent(content); MyReviewUnit myReviewUnitInfo = newMyReviewUnit.GetComponent <MyReviewUnit>(); myReviewUnits.Add(myReviewUnitInfo); } SortReviewPanels(0); for (int i = 0; i < amount; i++) { Transform unit = myReviewUnits[i].transform; Product product = products[i]; Review review = reviews[i]; ProductUnit productUnit = unit.GetChild(0).GetComponent <ProductUnit>(); productUnit.InfoChange(product, gameObject); ReviewUnit reviewUnit = unit.GetChild(1).GetComponent <ReviewUnit>(); reviewUnit.Change(review, gameObject); } }