yyl
22 小时以前 4b5b31a23a74c1559460643836d70778d7d49931
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
79
80
81
82
83
84
85
86
87
88
89
90
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
 
/// <summary>
/// 武将觉醒选择天赋界面
/// </summary>
public class HeroAwakeSelectGiftWin : UIBase
{
    [SerializeField] GameObject[] slectGos;
    [SerializeField] Button[] giftBtns;
    [SerializeField] GiftBaseCell[] giftCells;
    [SerializeField] Text[] skillText;
    [SerializeField] Button okBtn;
 
    int selectIndex = 0;
    protected override void InitComponent()
    {
        okBtn.AddListener(SelectGift);
        for (int i = 0; i < giftBtns.Length; i++)
        {
            int index = i;
            giftBtns[i].AddListener(() =>
            {
                selectIndex = index;
                Display();
            });
        }
    }
 
    protected override void OnPreOpen()
    {
        selectIndex = 0;
        Display();
    }
 
 
    public void Display()
    {
        var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectAwakeHeroGuid);
        if (hero == null)
        {
            return;
        }
 
        for (int i = 0; i < giftBtns.Length; i++)
        {
            slectGos[i].SetActive(i == selectIndex);
            if (i < hero.talentAwakeRandomIDList.Count)
            {
                giftCells[i].Init(hero.talentAwakeRandomIDList[i], 1);
                var giftConfig = HeroTalentConfig.Get(hero.talentAwakeRandomIDList[i]);
                skillText[i].text = PlayerPropertyConfig.GetFullDescription(giftConfig.AttrID, giftConfig.AttrValue);
            }
        }
 
    }
 
 
    void SelectGift()
    { 
        ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("HeroAwake7"), (bool isOK) =>
            {
                if (isOK)
                {
                    var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectAwakeHeroGuid);
                    if (hero == null)
                    {
                        return;
                    }
 
                    HeroUIManager.Instance.heroBeforeAwakeGiftIDList = new List<int>(hero.talentIDList);
                    HeroUIManager.Instance.heroBeforeAwakeGiftLevelList = new List<int>(hero.talentLvList);
 
                    HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse()
                    {
                        guid = HeroUIManager.Instance.selectAwakeHeroGuid,
                        type = HeroFuncType.Awake,
                        time = Time.time
                    };
                    var pack = new CB234_tagCSHeroAwakeSelectTalent();
                    pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
                    pack.SelectIndex = (byte)selectIndex;
                    GameNetSystem.Instance.SendInfo(pack);
                    CloseWindow();
                }
            });
    }
}