void loadItems() { AdventureMeta meta = BaseSaver.getAdventure(); Dictionary <string, int> treasure = meta.GetTreasureList(); List <string> keys = new List <string>(treasure.Keys); GameObject.Find("MoneyTxt").GetComponent <Text>().text = "¥" + meta.getYen(); for (int i = 1; i < 10; i++) { if (keys.Count >= i) { itemSubPnls[i - 1].SetActive(true); string img = "I0" + i.ToString() + "Img"; string nme = "I0" + i.ToString() + "Name"; string description = "I0" + i.ToString() + "Desc"; string qty = "I0" + i.ToString() + "Qty"; GameObject.Find(img).GetComponent <Image>().sprite = glossy.GetItem(keys[i - 1]).GetComponent <SpriteRenderer>().sprite; GameObject.Find(nme).GetComponent <Text>().text = keys[i - 1]; GameObject.Find(description).GetComponent <Text>().text = glossy.GetItem(keys[i - 1]).monTreas.description; GameObject.Find(qty).GetComponent <Text>().text = treasure[keys[i - 1]].ToString(); } else { itemSubPnls[i - 1].SetActive(false); } } }
public void PopulateShop() { shopActive = true; Debug.Log("PopulateShop"); Glossary glossy = PauseManager.instance.glossaryObj.GetComponent <Glossary>(); List <string> defeated = GameUtilities.getInteractedWith(glossy, false, true); if (defeated.Contains("Gaia Temple Leader Audrey") && !shopOwnersStock.ContainsKey("Stim")) { shopOwnersStock.Add("Stim", 150); } if (shopitemSubPnls == null) { shopitemSubPnls = new GameObject[] { GameObject.Find("ShopItemPnl01"), GameObject.Find("ShopItemPnl02"), GameObject.Find("ShopItemPnl03"), GameObject.Find("ShopItemPnl04"), GameObject.Find("ShopItemPnl05"), GameObject.Find("ShopItemPnl06"), GameObject.Find("ShopItemPnl07"), GameObject.Find("ShopItemPnl08"), GameObject.Find("ShopItemPnl09") }; } AdventureMeta meta = BaseSaver.getAdventure(); Dictionary <string, int> treasure = meta.GetTreasureList(); List <string> inventoryKeys = new List <string>(treasure.Keys); List <string> shopKeys = new List <string>(shopOwnersStock.Keys); GameObject.Find("MoneyTxt").GetComponent <Text>().text = "¥" + meta.getYen(); for (int i = 1; i < 10; i++) { if (shopKeys.Count >= i) { shopitemSubPnls[i - 1].SetActive(true); string img = "SI0" + i.ToString() + "Img"; string nme = "SI0" + i.ToString() + "Name"; string description = "SI0" + i.ToString() + "Desc"; string qty = "SI0" + i.ToString() + "Qty"; string cost = "SI0" + i.ToString() + "Cost"; GameObject.Find(img).GetComponent <Image>().sprite = glossy.GetItem(shopKeys[i - 1]).GetComponent <SpriteRenderer>().sprite; GameObject.Find(nme).GetComponent <Text>().text = shopKeys[i - 1]; GameObject.Find(description).GetComponent <Text>().text = glossy.GetItem(shopKeys[i - 1]).monTreas.description; GameObject.Find(qty).GetComponent <Text>().text = treasure.ContainsKey(shopKeys[i - 1]) ? treasure[shopKeys[i - 1]].ToString() : "0"; GameObject.Find(cost).GetComponent <Text>().text = "¥" + shopOwnersStock[shopKeys[i - 1]].ToString(); } else { shopitemSubPnls[i - 1].SetActive(false); } } }