Exemplo n.º 1
0
    void setInteriorList()
    {
        Interior.transform.FindChild("build_content").transform.FindChild("name").GetComponent <Text>().text
            = "";
        Interior.transform.FindChild("build_content").transform.FindChild("content").GetComponent <Text>().text
            = "";
        Coin.SetActive(false);
        Coin.transform.FindChild("Text").GetComponent <Text>().text = "";

        Star.SetActive(false);
        Star.transform.FindChild("Text").GetComponent <Text>().text = "";

        for (int i = 0; i < Interiorlist.transform.childCount; i++)
        {
            Destroy(Interiorlist.transform.GetChild(i).gameObject);
        }

        for (int i = 0; i < GameData.InteriorList.Count; i++)
        {
            GameObject Iitem;
            Iitem      = Instantiate(InItem, InItem.transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
            Iitem.name = "" + i;
            Iitem.transform.SetParent(Interiorlist.transform);
            Iitem.transform.localScale = new Vector3(1, 1, 1);
            Iitem.GetComponent <InteriorItem>().type = InteriotType;
            if (InteriotType == 0)
            {
                Iitem.GetComponent <Image>().sprite = Resources.LoadAll <Sprite>("Shop/Stand")[i];
            }
            else if (InteriotType == 1)
            {
                Iitem.GetComponent <Image>().sprite = Resources.LoadAll <Sprite>("Shop/Wall")[i];
            }
            else if (InteriotType == 2)
            {
                Iitem.GetComponent <Image>().sprite = Resources.LoadAll <Sprite>("Shop/Door")[i];
            }
            else if (InteriotType == 3)
            {
                Iitem.GetComponent <Image>().sprite = Resources.LoadAll <Sprite>("Shop/Counter")[i];
            }
        }
    }