From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式
---
Main/System/SkillUI/SkillBaseCell.cs | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/Main/System/SkillUI/SkillBaseCell.cs b/Main/System/SkillUI/SkillBaseCell.cs
index 77101a2..934ef53 100644
--- a/Main/System/SkillUI/SkillBaseCell.cs
+++ b/Main/System/SkillUI/SkillBaseCell.cs
@@ -45,6 +45,20 @@
}
}
+ Image m_WordBG;
+ Image wordBG
+ {
+ get
+ {
+ if (m_WordBG == null)
+ {
+ m_WordBG = this.transform.GetComponent<Image>("Container_SkillCell/Image");
+ }
+ return m_WordBG;
+ }
+ }
+
+
void Awake()
{
LoadPrefab();
@@ -52,6 +66,7 @@
public void Init(int skillID, UnityAction onclick = null, bool showType = false)
{
+ LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
var config = SkillConfig.Get(skillID);
if (config == null)
{
@@ -75,10 +90,12 @@
if (showType)
{
skillType.text = Language.Get(config.FuncType == 1 ? "HeroSkillType_1" : "HeroSkillType_2");
+ wordBG.SetActive(true);
}
else
- {
+ {
skillType.text = string.Empty;
+ wordBG.SetActive(false);
}
}
@@ -109,8 +126,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