コード例 #1
0
    public void ShowShopItems()
    {
        UsersCoins();
        List <ShopItem> shopItems = new List <ShopItem>();

        shopItems = ShopItem.Brskaj();
        Instantiate(ColoursToBuy);

        int counter = 0;

        foreach (var item in shopItems)
        {
            GameObject shopItemInst = Instantiate(ShopItemPrefab) as GameObject;
            shopItemInst.name = item.Naziv;
            shopItemInst.transform.SetParent(GameObject.Find("ShopPanel").transform, false);
            shopItemInst.transform.FindChild("ShopItemText").GetComponent <Text>().text = item.Naziv;
            Color32 mojaColor = GameObject.Find("ColoursToBuy(Clone)").transform.FindChild(item.Naziv).GetComponent <ColourElementScript>().coloursPallette[0];
            Debug.Log(mojaColor);
            shopItemInst.GetComponent <RawImage>().color = mojaColor;
            shopItemInst.transform.localPosition        -= new Vector3(0.0f, (90 * counter), 0.0f);

            counter++;
        }
    }