public IEnumerator GetSubCategoryDetail(long sub_id, string sub_name, SubCategoryDownloadCallback callback) { bool toEnd = false; yield return(null); foreach (Category cat in catList) { foreach (SubCategory scat in cat.SubCategorys) { if (scat.sub_id == sub_id) { SubCategory sc = new SubCategory(); sc = scat; callback(sc); toEnd = true; break; } } if (toEnd) { break; } } }
public void GetSubCategoryDetail(long sub_id, string sub_name, SubCategoryDownloadCallback callback) { StartCoroutine(collector.GetSubCategoryDetail(sub_id, sub_name, callback)); }
//test !!!!need to rewrite in the future public IEnumerator GetSubCategoryDetail(long subCategoryId, string subCategoryName, SubCategoryDownloadCallback callback) { long subCategoryParentID = subCategoryId / 100; WWW cases = new WWW(baseUrl + "/magento/Json/" + subCategoryParentID + "/sc/" + EncodeUriComponent(subCategoryName) + ".json"); yield return(cases); string json = cases.text; SubCategory result = JsonConvert.DeserializeObject <SubCategory>(json); callback(result); }