hch
2025-07-22 ad54ddbd4c12125fd44e9b7b3fd5bbcd92cce677
Main/System/HeroUI/GiftBaseCell.cs
@@ -65,7 +65,7 @@
        {
            if (m_LvText == null)
            {
                m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lv");
                m_LvText = this.transform.GetComponent<Text>("Container_GiftCell/lvrect/lv");
            }
            return m_LvText;
        }
@@ -91,7 +91,7 @@
    //showState 0:不显示 1:新增 2:提升
    //giftID 0 :代表未激活灰色 -1:代表不能激活 棕色,其他根据配表
    private void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
    public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
    {
        if (HeroTalentConfig.HasKey(giftID))
        {
@@ -148,24 +148,24 @@
        if (quality == 1)
        {
            //692088
            return new Color32(105, 32, 136, 255);
            return new Color32(105, 32, 136, 128);
        }
        else if (quality == 2)
        {
            //886220
            return new Color32(136, 98, 32, 255);
            return new Color32(136, 98, 32, 128);
        }
        else if (quality == 3)
        {
            //884a20
            return new Color32(136, 74, 32, 255);
            return new Color32(136, 74, 32, 128);
        }
        else if (quality == 4)
        {
            //882020
            return new Color32(136, 32, 32, 255);
            return new Color32(136, 32, 32, 128);
        }
        return new Color32(255, 255, 255, 255);
        return new Color32(0, 0, 0, 128);
    }
    GameObject cellContainer;
@@ -174,7 +174,7 @@
        if (cellContainer != null)
            return;
        
        var tmp = transform.Find("Container_SkillCell");
        var tmp = transform.Find("Container_GiftCell");
        if (tmp != null)
        {
            cellContainer = tmp.gameObject;
@@ -182,7 +182,7 @@
        }
        if (cellContainer == null)
        {
            cellContainer = UIUtility.CreateWidget("SkillBaseCell", "Container_SkillCell");
            cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
            if (cellContainer != null)
            {
@@ -190,6 +190,13 @@
                cellContainer.transform.SetAsFirstSibling();
            }
        }
        //缩放到和父rect一样大
        var scale = 1f;
        var rect = cellContainer.GetComponent<RectTransform>();
        var parentRect = transform.GetComponent<RectTransform>();
        scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
        cellContainer.transform.localScale = new Vector3(scale, scale, scale);
    }
}