Esempio n. 1
0
        public GameObject createEquipIcon(EquipConf data, float scale = 1f, bool istouch = false)
        {
            string     path       = "icon/equip/" + data.tpid;
            string     path2      = "icon/itemborder/b039_0" + data.quality;
            GameObject original   = Resources.Load("prefab/iconimage") as GameObject;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original);
            Image      component  = gameObject.transform.FindChild("icon").GetComponent <Image>();

            component.sprite = (Resources.Load(path, typeof(Sprite)) as Sprite);
            Image component2 = gameObject.transform.FindChild("iconbor").GetComponent <Image>();

            component2.sprite = (Resources.Load(path2, typeof(Sprite)) as Sprite);
            Text component3 = gameObject.transform.FindChild("num").GetComponent <Text>();

            component3.gameObject.SetActive(false);
            gameObject.transform.GetComponent <Button>().enabled = false;
            gameObject.transform.localScale = new Vector3(scale, scale, 1f);
            gameObject.name = "icon";
            if (istouch)
            {
                gameObject.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                gameObject.transform.GetComponent <Button>().enabled = false;
            }
            return(gameObject);
        }
Esempio n. 2
0
        public GameObject createEquipIcon(EquipConf data, float scale = 1.0f, bool istouch = false)
        {
            string     file       = "icon_equip_" + data.tpid;
            string     borderfile = "icon_itemborder_b039_0" + data.quality;
            GameObject iconPrefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_iconimage");
            GameObject root       = GameObject.Instantiate(iconPrefab) as GameObject;
            Image      icon       = root.transform.FindChild("icon").GetComponent <Image>();

            icon.sprite = GAMEAPI.ABUI_LoadSprite(file);
            Image iconborder = root.transform.FindChild("iconbor").GetComponent <Image>();

            iconborder.sprite = GAMEAPI.ABUI_LoadSprite(borderfile);
            Text numText = root.transform.FindChild("num").GetComponent <Text>();

            numText.gameObject.SetActive(false);
            root.transform.GetComponent <Button>().enabled = false;

            root.transform.localScale = new Vector3(scale, scale, 1.0f);
            root.name = "icon";

            if (istouch)
            {
                root.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                root.transform.GetComponent <Button>().enabled = false;
            }

            return(root);
        }
Esempio n. 3
0
        public EquipConf getEquipDataById(int id)
        {
            EquipConf conf = new EquipConf();

            conf.tpid    = id;
            conf.quality = 1;
            //SXML s_xml = XMLMgr.instance.GetSXML("equip.equip_info", "id==" + id.ToString());
            //EquipConf conf = new EquipConf();
            //if (s_xml != null)
            //{
            //    conf.id = id;
            //    conf.name = s_xml.getString("equip_name");
            //    conf.equipType = s_xml.getInt("equip_type");
            //    conf.quality = s_xml.getInt("quality");
            //    conf.needLv = s_xml.getInt("level_need");
            //    SXML e_xml = s_xml.GetNode("maineffect", null);
            //    if (e_xml != null)
            //    {
            //        conf.effect = e_xml.getInt("index");
            //        conf.value = e_xml.getInt("value");
            //    }
            //}
            return(conf);
        }