yyl
2026-02-11 3f2cd27c5dfb3b450245bf1a37fc1b3414031c7c
Main/System/Main/HeroFightingCardCell.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
//主界面卡牌
public class HeroFightingCardCell : MonoBehaviour
@@ -118,6 +119,89 @@
    }
    public async UniTask DisplayAsync(int index, List<TeamHero> heros)
    {
        TeamHero teamHero = null;
        if (index < heros.Count)
        {
            teamHero = heros[index];
        }
        guid = teamHero != null ? teamHero.guid : "";
        if (guid == "")
        {
            clickHeroBtn.SetActive(false);
            clickEmptyBtn.SetActive(true);
            clickEmptyBtn.AddListener(ClickEmpty);
            emptyLockImg.SetActive(false);
            redPointImg.SetActive(false);
            int lockCnt = HeroUIManager.Instance.lockIndexList.Count;
            //根据锁数量 倒序判断锁住
            if (lockCnt > 0)
            {
                lockIndex = lockCnt - (TeamConst.MaxTeamHeroCount - 1 - index) - 1;
                if (lockIndex >= 0 && lockIndex < lockCnt)
                {
                    emptyLockImg.SetActive(true);
                    redPointImg.SetActive(HeroUIManager.Instance.CanUnLock(HeroUIManager.Instance.lockIndexList[lockIndex]));
                }
            }
            return;
        }
        else
        {
            clickHeroBtn.SetActive(true);
            clickEmptyBtn.SetActive(false);
        }
        var hero = HeroManager.Instance.GetHero(guid);
        var heroID = hero.heroId;
        var star = hero.heroStar;
        clickHeroBtn.AddListener(ClickHero);
        var heroConfig = HeroConfig.Get(heroID);
        qualityBG.SetSprite("herocBG" + heroConfig.Quality);
        var sprite = await UILoader.LoadSpriteAsync("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon);
        if (this == null) return;
        if (sprite == null)
        {
            // 内网未配置时
            heroIcon.SetSprite("herohead_big_default");
        }
        else
        {
            heroIcon.overrideSprite = sprite;
        }
        if (star == 0)
        {
            starRect.SetActive(false);
        }
        else
        {
            starRect.SetActive(true);
            for (int i = 0; i < starsImg.Count; i++)
            {
                if ((star - 1) % starsImg.Count >= i)
                {
                    starsImg[i].SetActive(true);
                    starsImg[i].SetSprite("herostar" + (((star - 1) / starsImg.Count) + 1) * starsImg.Count);
                }
                else
                {
                    starsImg[i].SetActive(false);
                }
            }
        }
        countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
        lvText.text = hero.heroLevel == 0 ? "" : Language.Get("L1094") + hero.heroLevel;
        // RefreshFightIng(false);
    }
    void ClickHero()
    {