From 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 11 五月 2026 16:20:37 +0800
Subject: [PATCH] Merge branch 'master' into h5version

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

diff --git a/Main/System/HeroUI/GiftBaseCell.cs b/Main/System/HeroUI/GiftBaseCell.cs
index efa2179..4113405 100644
--- a/Main/System/HeroUI/GiftBaseCell.cs
+++ b/Main/System/HeroUI/GiftBaseCell.cs
@@ -1,6 +1,7 @@
 锘縰sing UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Events;
+using Cysharp.Threading.Tasks;
 
 public class GiftBaseCell : MonoBehaviour
 {
@@ -97,18 +98,32 @@
         }
     }
 
+    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();
+        LoadPrefab().Forget();
     }
 
     //showState 0锛氫笉鏄剧ず 1锛氭柊澧� 2锛氭彁鍗�
     //giftID 0 :浠h〃鐏拌壊闇�鍗囨槦婵�娲� -1锛氫唬琛ㄦ鑹查渶瑙夐啋婵�娲伙紝鍏朵粬鏍规嵁閰嶈〃锛屾病鏈夊ぉ璧嬬殑澶栧眰鎺у埗鏄鹃殣
-    public void Init(int giftID, int lv, UnityAction onclick = null, int showState = 0)
+    public async UniTask Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0)
     {
-        giftBtn.AddListener(onclick);
+        await LoadPrefab();   //瀛樺湪琚嵏杞界殑鍙兘锛岄噸鏂板姞杞�
+        if (this == null) return;
         if (HeroTalentConfig.HasKey(giftID))
         {
             var config = HeroTalentConfig.Get(giftID);
@@ -121,6 +136,16 @@
             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
         {
@@ -128,8 +153,45 @@
             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.OpenWindowAsync<SmallTipWin>().Forget();
+
+        }
+        else if (giftID == 0)
+        {
+            SmallTipWin.showText = Language.Get("HeroGift1");
+            UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
+        }
+        else if (giftID == -1)
+        { 
+            SmallTipWin.showText = Language.Get("HeroGift2", HeroAwakeConfig.GetAwakeLVByUnLockGiftIndex(heroID, index));
+            UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget();
         }
     }
+
 
     Color32 GetColor(int quality)
     {
@@ -160,29 +222,29 @@
     {
         if (quality == 1)
         {
-            //1D0029
-            return new Color32(29, 0, 41, 128);
+            //692088
+            return new Color32(105, 32, 136, 128);
         }
         else if (quality == 2)
         {
-            //372300
-            return new Color32(55, 35, 0, 128);
+            //886220
+            return new Color32(136, 98, 32, 128);
         }
         else if (quality == 3)
         {
-            //3A1800
-            return new Color32(58, 24, 0, 128);
+            //884a20
+            return new Color32(136, 74, 32, 128);
         }
         else if (quality == 4)
         {
-            //3A0000
-            return new Color32(58, 0, 0, 128);
+            //882020
+            return new Color32(136, 32, 32, 128);
         }
         return new Color32(0, 0, 0, 128);
     }
 
     GameObject cellContainer;
-    protected void LoadPrefab()
+    protected async UniTask LoadPrefab()
     {
         if (cellContainer != null)
             return;
@@ -195,7 +257,20 @@
         }
         if (cellContainer == null)
         {
-            cellContainer = UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+            var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell");
+            
+            if (this == null)
+            {
+                if (null != inst) GameObject.DestroyImmediate(inst);
+                return;
+            }
+
+            if (cellContainer != null)
+            {
+                GameObject.DestroyImmediate(inst);
+                return;
+            }
+            cellContainer = inst;
 
             if (cellContainer != null)
             {
@@ -220,7 +295,7 @@
             
         }
         scale = width / rect.sizeDelta.x;
-        cellContainer.transform.localScale = new Vector3(scale, scale, scale);
+        cellContainer.transform.localScale = cellContainer.transform.localScale * scale;
     }
 }
 

--
Gitblit v1.8.0