public string parseOpenTimeStruct() { GamingInfo.storeInfoItem info = new GamingInfo.storeInfoItem(); foreach (GamingInfo.storeInfoWithID item in GamingInfo.storeInfo) { if (shop_id == item.id) { info = item.info; break; } } string result = ""; for (int i = 0; i < 7; ++i) { switch (i) { case 0: result += "周一 "; break; case 1: result += "周二 "; break; case 2: result += "周三 "; break; case 3: result += "周四 "; break; case 4: result += "周五 "; break; case 5: result += "周六 "; break; case 6: result += "周日 "; break; } if (info.openTime[i].open == true) { for (int j = 0; j < info.openTime[i].timePeriod.Count; ++j) { result += info.openTime[i].timePeriod[j].begin_hr + ":" + info.openTime[i].timePeriod[j].begin_min + " - " + info.openTime[i].timePeriod[j].end_hr + ":" + info.openTime[i].timePeriod[j].end_min + " "; } result += "\n"; } else { result += "公休\n"; } } return(result); }
public void OnEnable() { shop_id = PlayerInfo.currentCheckingShopID; // should get from http request // remove old content GameObject[] oldList = GameObject.FindGameObjectsWithTag("content"); if (oldList.Length != 0) { foreach (GameObject obj in oldList) { Destroy(obj); } } // display new content GamingInfo.storeInfoItem info = new GamingInfo.storeInfoItem(); foreach (GamingInfo.storeInfoWithID item in GamingInfo.storeInfo) { if (shop_id.Equals(item.id)) { info = item.info; break; } } shop_title.text = info.shopName; shop_address.text = info.shopAddress; titlePrefab = Resources.Load <Text>("Prefabs/Text_title"); contentPrefab = Resources.Load <Text>("Prefabs/Text_content"); for (int i = 0; i < info.infoList.Count; ++i) { Text titleObj = Instantiate(titlePrefab); titleObj.transform.SetParent(parent.transform); titleObj.text = info.infoList[i].title; Text contentObj = Instantiate(contentPrefab); contentObj.transform.SetParent(parent.transform); contentObj.text = info.infoList[i].content; } // check if fav and set img bool found = false; foreach (string shopID in PlayerInfo.fav_shopID_list) { if (shopID.Equals(PlayerInfo.currentCheckingShopID)) { found = true; break; } } if (found) { btn_fav.GetComponent <AddFavShop>().isFav = true; btn_fav.GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("ImageSource/BackgroundImage/Street/btn_favoriteList"); } else { btn_fav.GetComponent <AddFavShop>().isFav = false; btn_fav.GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("ImageSource/BackgroundImage/ShopInfo/btn_favorite"); } }