yyl
2025-09-15 bb5909bcd36b48b919366c95b4248a3754452698
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
 
/// <summary>
/// 武将洗炼当前的天赋
/// </summary>
public class HeroGiftWashCell : MonoBehaviour
{
    [SerializeField] GiftBaseCell giftCell;
    [SerializeField] Button lockBtn;
    [SerializeField] Image lockImg;
 
    [SerializeField] UIEffectPlayer effectPlayer;
 
 
    public void Display(HeroInfo hero, int index)
    {
        int giftID = hero.talentIDList[index];
        int giftLV = hero.talentLvList[index];
 
        giftCell.Init(giftID, giftLV, 0, hero.heroId, index, hero.awakeLevel);
 
        if (hero.talentLockList.IndexOf(index) != -1)
        {
            lockImg.SetSprite("lockImage");
        }
        else
        {
            lockImg.SetSprite("unlockImage");
        }
 
        lockBtn.AddListener(() =>
        {
            var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectWashHeroGUID);
            if (hero == null)
            {
                return;
            }
 
            //没有发锁定包,客户端自己保存
            var state = hero.talentLockList.IndexOf(index) == -1 ? 0 : 1;
 
            if (state == 0 && hero.GetTalentLockCount() >= hero.talentIDList.Count - 1)
            {
                //至少要保留一个天赋未锁定
                SysNotifyMgr.Instance.ShowTip("HeroGift6");
                return;
            }
 
            hero.SetTalentLockState(index, state == 1 ? 0 : 1);
 
            if (hero.talentLockList.IndexOf(index) != -1)
            {
                lockImg.SetSprite("lockImage");
            }
            else
            {
                lockImg.SetSprite("unlockImage");
            }
            
            HeroUIManager.Instance.changeLockEvent?.Invoke();
        });
 
    }
 
    public void ShowEffect(HeroInfo hero, int index)
    {
        if (hero.talentLockList.IndexOf(index) != -1)
        {
            return;
        }
        
        effectPlayer.Play(true, true);
    }
 
}