using UnityEngine;
using UnityEngine.UI;
//羁绊模块
public class HeroConnectionCell : MonoBehaviour
{
    [SerializeField] HeroConnectionHeadCell[] heros;
    [SerializeField] Text connAttrText;
    /// 
    /// 羁绊图片展示
    /// 
    /// 
    /// 属性文字排版
    /// 是否按收集显示置灰状态
    /// 切换皮肤用
    public void Display(int fetterID, string showStr = "", bool showCollect = false, string guid = "")
    {
        HeroFetterConfig heroFetterConfig = HeroFetterConfig.Get(fetterID);
        int fromHeroID = 0;
        int _skinID = 0;
        if (guid != "")
        {
            fromHeroID = HeroManager.Instance.GetHero(guid).heroId;
            _skinID = HeroManager.Instance.GetHero(guid).SkinID;
        }
        for (int i = 0; i < heros.Length; i++)
        {
            if (i < heroFetterConfig.HeroIDList.Length)
            {
                heros[i].SetActive(true);
                heros[i].Display(heroFetterConfig.HeroIDList[i], i, showCollect,
                fromHeroID == heroFetterConfig.HeroIDList[i] ? _skinID : 0);
            }
            else
            {
                heros[i].SetActive(false);
            }
        }
        string attrStr = "";
        for (int i = 0; i < heroFetterConfig.AttrIDList.Length; i++)
        {
            attrStr += PlayerPropertyConfig.GetFullDescription(heroFetterConfig.AttrIDList[i], heroFetterConfig.AttrValueList[i]) + " ";
        }
        if (string.IsNullOrEmpty(showStr))
        {
            connAttrText.text = Language.Get("L1100", heroFetterConfig.FetterName, UIHelper.AppendColor(TextColType.lightYellow, attrStr));
        }
        else
        {
            connAttrText.text = showStr + attrStr;
        }
    }
}