Esempio n. 1
0
    void SetPetIcon()
    {
        string spName     = "";
        string borderName = "";

        if (m_petData.CurFightingPet != 0)
        {
            IPet pet = m_petData.GetPetByThisID(m_petData.CurFightingPet);
            if (pet != null)
            {
                uint        baseID = pet.PetBaseID;
                PetDataBase pdb    = GameTableManager.Instance.GetTableItem <PetDataBase>(baseID);
                if (pdb != null)
                {
                    spName     = pdb.icon;
                    borderName = ItemDefine.GetItemBgYuanBorderIconByItemID(pdb.ItemID);
                }
            }
            m_hpSlider.gameObject.SetActive(true);
        }
        else
        {
            m_hpSlider.gameObject.SetActive(false);
        }

        if (m_sprIcon != null)
        {
            spName = UIManager.BuildCircleIconName(spName);
            UIManager.GetTextureAsyn(spName, ref m_curIconAsynSeed, () =>
            {
                if (null != m_sprIcon)
                {
                    m_sprIcon.mainTexture = null;
                }
            }, m_sprIcon, false);
        }
        if (m_spriteBg != null)
        {
            UIManager.GetAtlasAsyn(borderName, ref m_curBgAsynSeed, () =>
            {
                if (null != m_spriteBg)
                {
                    m_spriteBg.atlas = null;
                }
            }, m_spriteBg, false);
            m_spriteBg.gameObject.SetActive(!string.IsNullOrEmpty(spName));
        }
    }