lcy
6 天以前 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4
Main/Component/UI/Common/GroupButtonEx.cs
@@ -10,6 +10,7 @@
//关联按钮,其中一个亮起,其他按下,文字颜色对应变更
//数据更新通过SelectBtn更新 或者 GroupButtonExManager.SelectButton
//使用步骤 1.序列化GroupButtonEx类型的按钮,2:初始需设置SelectBtn()选中哪个按钮,其他和按钮使用方法一致
public class GroupButtonEx : ButtonEx
{
    [SerializeField] GroupButtonExManager m_Manager; // 按钮组管理器引用
@@ -77,6 +78,9 @@
        set { m_SelectEffect = value; }
    }
    [SerializeField] public RedpointBehaviour redpoint;   //外部自己用
    public bool isLock = false;
    protected override void Awake()
    {
@@ -99,11 +103,13 @@
    public override void OnPointerClick(PointerEventData eventData)
    {
        if (isLock)
            return;
        base.OnPointerClick(eventData);
        SelectBtn();
    }
    // 选中当前按钮
    // 选中当前按钮,只处理刷新显示
    public void SelectBtn(bool forceRefresh = false)
    {
        if (m_State == TitleBtnState.Click && !forceRefresh)
@@ -120,12 +126,19 @@
    // 更新按钮状态
    public void UpdateButtonState()
    {
        // 更新图标显示
        if (m_SelectIcon != null)
            m_SelectIcon.SetActive(m_State == TitleBtnState.Click);
        if (m_SelectIcon != null && m_UnSelectIcon != null && m_SelectIcon.sprite == m_UnSelectIcon.sprite)
        {
            m_SelectIcon.SetActive(true);
        }
        else
        {
            // 更新图标显示
            if (m_SelectIcon != null)
                m_SelectIcon.SetActive(m_State == TitleBtnState.Click);
        if (m_UnSelectIcon != null)
            m_UnSelectIcon.SetActive(m_State != TitleBtnState.Click);
            if (m_UnSelectIcon != null)
                m_UnSelectIcon.SetActive(m_State != TitleBtnState.Click);
        }
        // 更新文字颜色
        if (m_Title != null && m_Manager != null)