hch
59 分钟以前 5880535f4ed8e45cc1c1c931109b931d66785141
Main/System/HeroUI/HeroCardCell.cs
@@ -6,47 +6,56 @@
{
    [SerializeField] Button heroCardBtn;
    [SerializeField] Image heroCardBG;
    [SerializeField] Material glowMaterial; // 流光效果材质
    [SerializeField] Text lvText;
    [SerializeField] Image countryImg;
    [SerializeField] Image jobImg;
    [SerializeField] UIHeroController heroModel;
    [SerializeField] Image onStateImg;
    [SerializeField] RedpointBehaviour redpoint;
    [SerializeField] Image newImage;    //新标识和红点互斥
    [SerializeField] Image trainStateImg;
    [SerializeField] Text nameText;
    [SerializeField] Image awakeImg;
    [SerializeField] Text awakeLVText;
    [SerializeField] List<Image> starImgList;
    string guid;
    public void Display(int index)
    {
        var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.heroSortList[index]);
        guid = HeroUIManager.Instance.heroSortList[index];
        var hero = HeroManager.Instance.GetHero(guid);
        if (hero == null)
        {
            this.gameObject.SetActive(false);
            return;
        }
        this.gameObject.SetActive(true);
        heroCardBG.SetSprite("herocardbg" + hero.Quality);
        if (glowMaterial != null)
        {
            heroCardBG.material = glowMaterial;
        }
        lvText.text = Language.Get("L1094") + hero.heroLevel.ToString();
        var heroConfig = hero.heroConfig;
        countryImg.SetSprite("herocountry" + heroConfig.Country);
        jobImg.SetSprite("herojob" + heroConfig.Class);
        countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
        jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(heroConfig.Class));
        heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale);
        onStateImg.SetActive(hero.IsInTeamByTeamType(TeamType.Story));
        redpoint.redpointId = MainRedDot.HeroCardRedpoint * 1000 + hero.itemHero.gridIndex;
        var funcState = hero.funcState;
        if (funcState > 0)
        int teamPos = TeamManager.Instance.GetTeam(TeamType.Story).GetPosition(hero.itemHero.guid);
        if (teamPos >= 0)
        {
            redpoint.redpointId = MainRedDot.HeroCardRedpoint * 10 + teamPos;
            newImage.SetActive(false);
        }
        else
        { 
            redpoint.redpointId = 0;
            newImage.SetActive(HeroUIManager.Instance.newHeroIDList.Contains(hero.heroId));
        }
        var funcState = HeroUIManager.Instance.GetFuncState(hero);
        if (funcState > 0)
        {
            trainStateImg.SetActive(true);
            trainStateImg.SetSprite("herofuncstate" + hero.funcState);
            trainStateImg.SetSprite("herofuncstate" + funcState);
        }
        else
        {
@@ -67,13 +76,19 @@
            else if ((hero.heroStar - 1) % starImgList.Count >= i)
            {
                starImgList[i].SetActive(true);
                starImgList[i].SetSprite("herostar" +  (((hero.heroStar - 1)/starImgList.Count)+1)*starImgList.Count);
                starImgList[i].SetSprite("herostar" + (((hero.heroStar - 1) / starImgList.Count) + 1) * starImgList.Count);
            }
            else
            {
                starImgList[i].SetActive(false);
            }
        }
        heroCardBtn.AddListener(() =>
        {
            HeroUIManager.Instance.selectHeroGuid = guid;
            UIManager.Instance.OpenWindow<HeroTrainWin>();
        });
    }
}