コード例 #1
0
ファイル: UICommon_Hero.cs プロジェクト: ww386362087/MoyuHero
    public void SetData(ObjectCard objectCard)
    {
        mObjectCard = objectCard;

        HeroData heroData = objectCard.GetHeroData();

        HeroTemplate heroT = objectCard.GetHeroRow();

        //----英雄信息----
        m_Name.text  = string.Format(GameUtils.GetHeroNameFontColor(heroData.QualityLev), GameUtils.getString(heroT.getNameID()));
        m_Alias.text = string.Format(GameUtils.GetHeroNameFontColor(heroData.QualityLev), GameUtils.getString(heroT.getTitleID()));
        //InterfaceControler.GetInst().ReturnHeroQuailty(heroData.QualityLev);
        //GameUtils.GetItemQualitySprite()

        //TODO:资质图;
        m_ApitudeImg.sprite = InterfaceControler.GetInst().GetHeroAptImg(heroT);
        InterfaceControler.GetInst().ShowTypeIcon(heroT, m_HeroTypeImg);


        m_Value.text      = heroData.Level + "/" + heroT.getMaxLevel();
        m_ExpTxt.text     = heroData.Exp + "/" + objectCard.GetAllExp();
        m_ExpSlider.value = heroData.GetExpPercentage();

        int maxStar = GameUtils.GetCurStarMax(heroT.getBorn(), heroT.getQosition(), heroData.QualityLev);

        mStarGroup.ShowStar(heroData.StarLevel, 6);

        //----模型----
        StartCoroutine(Show3DModel());

        //----属性----;
        m_AText0.text = GameUtils.getString("power");
        m_AText1.text = GameUtils.getString("attribute1name");
        m_AText2.text = GameUtils.getString("attribute2name");
        m_AText3.text = GameUtils.getString("attribute3name");

        m_AValue0.text = heroData.FightVigor.ToString();
        m_AValue1.text = objectCard.GetPhysicalAttack().ToString();
        m_AValue2.text = objectCard.GetPhysicalDefence().ToString();
        m_AValue3.text = objectCard.GetMaxHP().ToString();

        //----特点----
        m_FeatureTxt.text = GameUtils.getString(heroT.getTedian());

        //----技能----
        List <int> skillIds = heroData.HeroSkillDB.SkillList;

        if (skillIds == null || skillIds.Count != 6)
        {
            LogManager.LogError("技能个数不为6个");
            return;
        }

        for (int i = 0; i < skillIds.Count; i++)
        {
            //是否解锁了;
            bool isUnlock = IsSkillLocked(i);

            SkillTemplate skillT = DataTemplate.GetInstance().m_SkillTable.getTableData(skillIds[i]) as SkillTemplate;
            mSkillIcons[i].SetIcon(skillT.getSkillIcon());
            mSkillIcons[i].SetName(skillT.getSkillName());
            mSkillIcons[i].SetType(skillT.getSkillType());

            if (isUnlock)
            {
                mSkillIcons[i].SetLevel(skillT.getSkillLevel().ToString());
            }
            else
            {
                mSkillIcons[i].SetHint(string.Format(GameUtils.getString("skillunlockquality"), GameUtils.ConverQualityToStr(i + 1)));
            }
        }

        //----简介----
        m_IntroductTxt.text = GameUtils.getString(heroT.getDescriptionID());
    }