From 871594462e82d6bc1341918d39e11ab036d59563 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 18 九月 2025 19:26:28 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/HeroUI/GiftBaseCell.cs | 102 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 93 insertions(+), 9 deletions(-)
diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index afd9460..cf7b6cc 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -45,6 +45,19 @@
}
}
+ OutlineEx m_TextOutline;
+ OutlineEx textOutline
+ {
+ get
+ {
+ if (m_TextOutline == null)
+ {
+ m_TextOutline = this.transform.GetComponent<OutlineEx>("Container_GiftCell/name");
+ }
+ return m_TextOutline;
+ }
+ }
+
Transform m_LvRect;
Transform lvRect
{
@@ -84,39 +97,99 @@
}
}
+ Image m_AwakeLockImg; //閲嶇敓闄嶄綆瑙夐啋绛夌骇閿佸畾鐨勫浘鐗�
+ Image awakeLockImg
+ {
+ get
+ {
+ if (m_AwakeLockImg == null)
+ {
+ m_AwakeLockImg = this.transform.GetComponent<Image>("Container_GiftCell/lock");
+ }
+ return m_AwakeLockImg;
+ }
+ }
+
+
+
void Awake()
{
LoadPrefab();
}
//showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
- //giftID 0 :浠h〃鏈縺娲荤伆鑹� -1锛氫唬琛ㄤ笉鑳芥縺娲� 妫曡壊锛屽叾浠栨牴鎹厤琛�
- public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
+ //giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
+ public void Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
{
+ LoadPrefab(); //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
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);
lvText.text = lv.ToString();
- lvText.color = GetColor(1);
- Outline textOutline = lvText.GetComponent<Outline>();
- textOutline.effectColor = GetOutlineColor(config.Quality);
lvRect.SetActive(lv > 0);
stateImg.SetActive(showState > 0);
stateImg.SetSprite("GiftState" + showState);
stateImg.SetNativeSize();
+
+ //鐗规畩澶勭悊閲嶇敓闄嶄綆瑙夐啋绛夌骇閿佸畾鐨勫ぉ璧�
+ if (index >= HeroUIManager.Instance.normalGiftMaxCnt)
+ {
+ awakeLockImg.SetActive(HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index) > awakeLevel);
+ }
+ else
+ {
+ awakeLockImg.SetActive(false);
+ }
}
else
{
qualityBG.SetSprite("GiftQualityBG" + giftID);
- giftBtn.RemoveAllListeners();
giftName.text = string.Empty;
lvRect.SetActive(false);
stateImg.SetActive(false);
+ awakeLockImg.SetActive(false);
+ }
+ giftBtn.AddListener(() => { ShowSmallTip(giftID, lv, heroID, index, awakeLevel); });
+ }
+
+ void ShowSmallTip(int giftID, int giftLV, int heroID, int index, int awakeLevel)
+ {
+ SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
+ if (giftID > 0)
+ {
+ var giftConfig = HeroTalentConfig.Get(giftID);
+ SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV),
+ Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue*giftLV)));
+
+ if (index >= HeroUIManager.Instance.normalGiftMaxCnt)
+ {
+ int needAwakeLV = HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index);
+ if (needAwakeLV > awakeLevel)
+ {
+ SmallTipWin.showText += "\n" + Language.Get("HeroAwake18", needAwakeLV);
+ }
+ }
+
+
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+
+ }
+ else if (giftID == 0)
+ {
+ SmallTipWin.showText = Language.Get("HeroGift1");
+ UIManager.Instance.OpenWindow<SmallTipWin>();
+ }
+ else if (giftID == -1)
+ {
+ SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index));
+ UIManager.Instance.OpenWindow<SmallTipWin>();
}
}
+
Color32 GetColor(int quality)
{
@@ -195,8 +268,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