From 258234852dd4c5e7c70df9b9fe2a3f91e53d965a Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 20 十一月 2025 15:29:12 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/SkillUI/SkillWordCell.cs |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Main/System/SkillUI/SkillWordCell.cs b/Main/System/SkillUI/SkillWordCell.cs
index 168f1f9..3658500 100644
--- a/Main/System/SkillUI/SkillWordCell.cs
+++ b/Main/System/SkillUI/SkillWordCell.cs
@@ -52,6 +52,7 @@
 
     public void Init(int skillID, UnityAction onclick = null, bool showType = false)
     {
+        LoadPrefab();   //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
         var config = SkillConfig.Get(skillID);
         if (config == null)
         {
@@ -102,8 +103,19 @@
         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);
+        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 = cellContainer.transform.localScale * scale;
     }
 }
 

--
Gitblit v1.8.0