hch
2025-07-23 64f046bdca87c2dcf8427cd2a2154fe9c4fc9249
Main/System/HeroUI/HeroListWin.cs
@@ -31,26 +31,48 @@
    /// </summary>
    protected override void InitComponent()
    {
        heroPackBtn.onClick.AddListener(() =>
        {
            HeroUIManager.Instance.QueryUnLockHeroPack();
        });
    }
    protected override void OnPreOpen()
    {
        heroListScroller.OnRefreshCell += OnRefreshCell;
        PackManager.Instance.RefreshItemEvent += RefreshPakCount;
        HeroManager.Instance.SortHeroList();
        CreateScroller();
        Refresh();
    }
    protected override void OnPreClose()
    {
        heroListScroller.OnRefreshCell -= OnRefreshCell;
        PackManager.Instance.RefreshItemEvent -= RefreshPakCount;
    }
    public override void Refresh()
    {
        SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item);
        if (singlePack == null || singlePack.GetAllItems().Count <= 0)
        {
            heroListEmpty.SetActive(true);
            heroListScroller.SetActive(false);
        }
        else
        {
            heroListEmpty.SetActive(false);
            heroListScroller.SetActive(true);
        }
        //上阵属性
        for (int i = 0; i < attrOnList.Count; i++)
        {
            attrOnList[i].text = PlayerPropertyConfig.GetFullDescription(new Int2 (PlayerPropertyConfig.baseAttrs[i], 1 ));
        }
    }
    void OnRefreshCell(ScrollerDataType type, CellView cell)
@@ -65,13 +87,24 @@
        for (int i = 0; i < HeroManager.Instance.heroSortList.Count; i++)
        {
            if (i % 4 == 0)
            {
            {
                heroListScroller.AddCell(ScrollerDataType.Header, i);
            }
        }
        heroListScroller.Restart();
    }
    void RefreshPakCount(PackType type, int index, int itemID)
    {
        SinglePack singlePack = PackManager.Instance.GetSinglePack(PackType.Item);
        if (singlePack == null)
            return;
        int count = singlePack.GetAllItems().Count;
        heroPackText.text =  UIHelper.AppendColor(count > singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown,
                            string.Format("{0}/{1}", count, singlePack.unlockedGridCount));
    }
    
}