void AddCategoryItem(Category cat) { GameObject obj = Instantiate(iconPrefab, catGroup.transform); // //test // GameObject obj; // Debug.Log ("AddCategoryItem currentLayer " + currentLayer); // if (currentLayer == 0) { // obj = Instantiate (iconPrefab, catGroup.transform); // } // else {//else if (currentLayer == 1) // obj = Instantiate (iconPrefab, subCatGroup.transform); // } obj.transform.localScale = Vector3.one; ResObjectItem item = obj.GetComponent <ResObjectItem>(); //attach the action "ShowCategory" for the catalogue. once the catalogue's icon was click, //it will call the function ShowCategory // item.Init(cat.name, cat.id, cat.icon, ShowCategory); //ShowSubCategory -> show what's inside the first category, 2nd layer Debug.Log("AddCategoryItem cat.name = " + cat.name); Debug.Log("AddCategoryItem cat.id = " + cat.id); if (cat.icon != null) { Debug.Log("AddCategoryItem cat.icon = " + cat.icon); } item.Init(cat.name, cat.id, cat.icon, ShowSecondLayer); }
void AddSubCategoryItem(SubCategory scat) { GameObject obj = Instantiate(iconPrefab, subCatGroup.transform); obj.transform.localScale = Vector3.one; ResObjectItem item = obj.GetComponent <ResObjectItem>(); item.Init(scat.sub_name, scat.sub_id, scat.icon, ShowThirdLayer); }
void AddProductItem(Product data) { GameObject obj = Instantiate(productPrefab, contentGroup.transform); obj.transform.localScale = Vector3.one; obj.name = data.sku; ResObjectItem item = obj.GetComponent <ResObjectItem>(); item.Init(data.name, data.sku, data.icon, LoadObject); loadingProductCount--; if (loadingProductCount == 0) { loadingUI.Hide(); StartCoroutine(DelayRefresh()); } }
// //test search // void ShowSearchProductResultItem(Product p) // { // if (p.sku == "") // return; // GameObject obj; // obj = Instantiate (iconPrefab, subCatGroup.transform); // obj.transform.localScale = Vector3.one; // obj.name = p.sku; // ResObjectItem item = obj.GetComponent<ResObjectItem>(); // item.Init(p.name, p.sku, p.icon, LoadObject); // } void AddProductItem(Product p) { // GameObject obj = Instantiate(iconPrefab, furGroup.transform); //test GameObject obj; Debug.Log("AddProductItem currentLayer " + currentLayer); if (currentLayer == 1) { obj = Instantiate(iconPrefab, subCatGroup.transform); } else //else if (currentLayer == 2) { obj = Instantiate(iconPrefab, furGroup.transform); } obj.transform.localScale = Vector3.one; obj.name = p.sku; ResObjectItem item = obj.GetComponent <ResObjectItem>(); // item.Init(p.name, p.sku, p.icon, LoadObject); //test if (currentLayer == 1) { item.Init(p.name, p.sku, p.icon, LoadObject); } else { item.Init(p.category_id, p.sku, p.icon, LoadSubObject); } //else item.Init(p.name, p.sku, p.icon, LoadSubObject); loadingProductCount--; loadedProductCount++; if (loadedProductCount > 8) { loadingUI.Hide(); } if (loadingProductCount == 0) { loadingUI.Hide(); StartCoroutine(DelayRefresh()); } }
void AddSubCatItem(SubCategory sc) { // GameObject obj = Instantiate(iconPrefab, furGroup.transform); //test GameObject obj = Instantiate(iconPrefab, subCatGroup.transform); obj.transform.localScale = Vector3.one; obj.name = sc.sub_name; ResObjectItem item = obj.GetComponent <ResObjectItem>(); item.Init(sc.sub_name, sc.sub_id, sc.icon, ShowThirdLayer); loadingProductCount--; loadedProductCount++; if (loadedProductCount > 8) { loadingUI.Hide(); } if (loadingProductCount == 0) { loadingUI.Hide(); StartCoroutine(DelayRefresh()); } }