private void OnClickItem(int heroConfigID)
    {
        HeroInfo info = UserManager.Instance.GetHeroInfoByUnitID(heroConfigID);

        if (info == null)
        {
            return;
        }

        if (info.IsOnPVE())
        {
            UserManager.Instance.PVEHeroList.Remove(info);
        }
        else
        {
            UserManager.Instance.PVEHeroList.Add(info);
        }

        // 只刷新点击的英雄
        foreach (Transform item in _listView._listContainer)
        {
            PVESelectHeroWidget widget = item.GetComponent <PVESelectHeroWidget>();
            if (widget != null && widget.IsWidget(heroConfigID))
            {
                widget.SetInfo(info);
            }
        }

        // TODO 刷新英雄
    }
Exemple #2
0
    public override void SetInfo(object data)
    {
        _currentInfo = (HeroInfo)data;
        if (_currentInfo == null)
        {
            return;
        }

        _imgBg.sprite   = ResourceManager.Instance.GetIconBgByQuality(_currentInfo.StarLevel);
        _imgIcon.sprite = ResourceManager.Instance.GetHeroIcon(_currentInfo.ConfigID);
        _imgCheck.gameObject.SetActive(_currentInfo.IsOnPVE());
        _txtLevel.text = "Lv " + _currentInfo.Level;
    }