From c5adf3e22a5cdfb185a4befc22ef0cd079a7eb33 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 02 九月 2025 22:30:10 +0800
Subject: [PATCH] 117 【武将】武将系统 - 天赋显示,修复描边文字遇到mask问题

---
 Main/System/HeroUI/GiftBaseCell.cs |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index 5ab0faf..56b9f68 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -105,14 +105,14 @@
     }
 
     //showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
-    //giftID 0 :浠h〃鏈縺娲荤伆鑹� -1锛氫唬琛ㄤ笉鑳芥縺娲� 妫曡壊锛屽叾浠栨牴鎹厤琛�
+    //giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
     public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
     {
+        giftBtn.AddListener(onclick);
         if (HeroTalentConfig.HasKey(giftID))
         {
             var config = HeroTalentConfig.Get(giftID);
             qualityBG.SetSprite("GiftQualityBG" + config.Quality);
-            giftBtn.AddListener(onclick);
             giftName.text = config.Name;
             giftName.color = GetColor(config.Quality);
             textOutline.OutlineColor = GetOutlineColor(config.Quality);
@@ -125,7 +125,6 @@
         else
         {
             qualityBG.SetSprite("GiftQualityBG" + giftID);
-            giftBtn.RemoveAllListeners();
             giftName.text = string.Empty;
             lvRect.SetActive(false);
             stateImg.SetActive(false);
@@ -209,7 +208,18 @@
         var scale = 1f;
         var rect = cellContainer.GetComponent<RectTransform>();
         var parentRect = transform.GetComponent<RectTransform>();
-        scale = parentRect.sizeDelta.x / rect.sizeDelta.x;
+        float width = parentRect.sizeDelta.x;
+        if (width <= 0f)
+        {
+            //澶栭儴鎺у埗浜嗗昂瀵歌幏鍙栦负0
+            GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>();
+            if (grid != null)
+            { 
+                width = grid.cellSize.x;
+            }
+            
+        }
+        scale = width / rect.sizeDelta.x;
         cellContainer.transform.localScale = new Vector3(scale, scale, scale);
     }
 }

--
Gitblit v1.8.0