Exemplo n.º 1
0
    static public void SetImage(Transform t, string name)
    {
        if (name == null)
        {
            return;
        }

        if (name == "")
        {
            return;
        }

        if (name.IndexOf("http:") == 0)
        {
            netImage.SetImage(t, name);
            return;
        }

        if (imgList == null)
        {
            var        obj     = ResTools.Load("res/cards");
            GameObject gameObj = GameObject.Instantiate(obj) as GameObject;
            imgList = gameObj.GetComponent <ImageList>();
        }

        if (t != null)
        {
            Image s = t.GetComponent <Image>();
            s.sprite = imgList.Get(name);
        }
    }