yyl
2026-03-26 f4a702e212d1853735f8dae399da69d23bfa510e
Main/System/Main/HeroFightingCardCell.cs
@@ -1,7 +1,6 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
//主界面卡牌
public class HeroFightingCardCell : MonoBehaviour
@@ -24,6 +23,7 @@
    [SerializeField] Image emptyLockImg;
    [SerializeField] Image redPointImg;
    [SerializeField] UIEffectPlayer unlockEffect;
    [SerializeField] GameObject onTip;  //上阵提示
    void OnEnable()
    {
@@ -64,85 +64,26 @@
                    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);
        UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon, heroIcon, "herohead_big_default").Forget();
        if (star == 0)
        {
            starRect.SetActive(false);
        }
        else
        {
            starRect.SetActive(true);
            for (int i = 0; i < starsImg.Count; i++)
            if (onTip != null)
            {
                if ((star - 1) % starsImg.Count >= i)
                if (PlayerDatas.Instance.baseData.ExAttr1 / 100 < 601 && HeroManager.Instance.GetHeroCount() > index && index < 3)
                {
                    starsImg[i].SetActive(true);
                    starsImg[i].SetSprite("herostar" + (((star - 1) / starsImg.Count) + 1) * starsImg.Count);
                    //新手期 可能因为一些操作原因没上阵英雄
                    onTip.SetActive(true);
                }
                else
                {
                    starsImg[i].SetActive(false);
                    onTip.SetActive(false);
                }
            }
        }
        countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country));
        lvText.text = hero.heroLevel == 0 ? "" : Language.Get("L1094") + hero.heroLevel;
        // RefreshFightIng(false);
    }
    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
        {
            if (onTip != null)
            {
                onTip.SetActive(false);
            }
            clickHeroBtn.SetActive(true);
            clickEmptyBtn.SetActive(false);
        }
@@ -154,8 +95,7 @@
        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;
        var sprite = UILoader.LoadSprite("HeroHead", HeroSkinConfig.Get(hero.SkinID).RectangleIcon);
        if (sprite == null)
        {
            // 内网未配置时
@@ -199,7 +139,7 @@
    {
        HeroUIManager.Instance.SortHeroList();
        HeroUIManager.Instance.selectHeroGuid = guid;
        UIManager.Instance.OpenWindowAsync<HeroTrainWin>().Forget();
        UIManager.Instance.OpenWindow<HeroTrainBaseWin>();
    }
    void ClickEmpty()
@@ -218,7 +158,7 @@
            }
            return;
        }
        UIManager.Instance.OpenWindowAsync<HeroPosWin>().Forget();
        UIManager.Instance.OpenWindow<HeroPosWin>();
    }
    void OnSkillCast(bool isfighting)
    {