示例#1
0
 void OnUpdateUIGrid(UIGridBase grid, int index)
 {
     if (grid is PetSkillItem)
     {
         if (index < m_typeList.Count)
         {
             SkillDatabase db = m_typeList[index];
             if (db != null)
             {
                 PetSkillItem item = grid as PetSkillItem;
                 item.gameObject.SetActive(true);
                 item.SetIcon(db);
             }
         }
     }
 }
示例#2
0
    void ShowNoSkill(Transform item)
    {
        Transform addskill = item.Find("addskill");

        if (addskill != null)
        {
            addskill.gameObject.SetActive(true);
        }
        Transform sprTrans = item.Find("bg_choose");

        if (sprTrans != null)
        {
            sprTrans.gameObject.SetActive(false);
        }
        PetSkillItem ps = item.GetComponent <PetSkillItem>();

        if (ps != null)
        {
            ps.SetIcon(null);
        }

        Transform skillLv = item.Find("lv");

        if (skillLv != null)
        {
            skillLv.gameObject.SetActive(false);
        }
        Transform nameTrans = item.Find("Label");

        if (nameTrans == null)
        {
            nameTrans = item.Find("skillname");
        }
        if (nameTrans != null)
        {
            UILabel nameLabel = nameTrans.GetComponent <UILabel>();
            if (nameLabel != null)
            {
                nameLabel.text = CommonData.GetLocalString("技能");
            }
        }
    }
示例#3
0
    void ShowHasSkill(Transform item, GameCmd.PetSkillObj skill)
    {
        Transform addskill = item.Find("addskill");

        if (addskill != null)
        {
            addskill.gameObject.SetActive(false);
        }
        SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)skill.id, 1);

        if (db != null)
        {
            Transform skillLv = item.Find("lv");
            if (skillLv != null)
            {
                UILabel lvLabel = skillLv.GetComponent <UILabel>();
                if (lvLabel != null)
                {
                    lvLabel.text = skill.lv.ToString();
                }
                skillLv.gameObject.SetActive(true);
            }
            PetSkillItem skillitem = item.gameObject.GetComponent <PetSkillItem>();
            if (skillitem == null)
            {
                skillitem = item.gameObject.AddComponent <PetSkillItem>();
            }
            skillitem.SkillData = db;
            skillitem.SetIcon(db);
            //Transform icon = item.Find("icon");
            //if (icon != null)
            //{
            //    icon.gameObject.SetActive(true);
            //    UITexture spr = icon.GetComponent<UITexture>();
            //    if (spr != null)
            //    {
            //        UIManager.GetTextureAsyn(db.iconPath, ref m_iconCASD, () =>
            //        {
            //            if (null != spr)
            //            {
            //                spr.mainTexture = null;
            //            }
            //        }, spr);

            //    }
            //    ShowTips(db, item, new Vector2(spr.width, spr.height));
            //}
            Transform nameTrans = item.Find("Label");
            if (nameTrans == null)
            {
                nameTrans = item.Find("skillname");
            }
            if (nameTrans != null)
            {
                UILabel nameLabel = nameTrans.GetComponent <UILabel>();
                if (nameLabel != null)
                {
                    nameLabel.text = db.strName;
                }
            }
            Transform sprTrans = item.Find("bg_choose");
            if (sprTrans != null)
            {
                if (petDataManager.SelectSkillDataBase != null)
                {
                    if (petDataManager.SelectSkillDataBase.wdID == skill.id)
                    {
                        sprTrans.gameObject.SetActive(true);
                    }
                    else
                    {
                        sprTrans.gameObject.SetActive(false);
                    }
                }
            }
        }
    }