hch
15 小时以前 a52fe6a398500fd26d57a561ff50b3daaaeb6b54
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
91
92
93
94
95
96
97
98
99
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
/// <summary>
/// 坐骑升阶
/// </summary>
public class HorseRankUPWin : UIBase
{
    [SerializeField] Text curLVText;
    [SerializeField] Text nextLVText;
    [SerializeField] Text[] attrNameTexts;
    [SerializeField] Text[] attrValueTexts;
    [SerializeField] Text[] nextAttrValueTexts;
 
    [SerializeField] Transform[] specialAttrRect;
    [SerializeField] Text[] specialAttrNameTexts;
    [SerializeField] Text[] specialAttrValueTexts;
    [SerializeField] Text[] specialNextAttrValueTexts;
 
    [SerializeField] Text costText;
    [SerializeField] Image costItemImg;
    [SerializeField] Button rankUpBtn;
 
    
    protected override void InitComponent()
    {
        rankUpBtn.AddListener(HorseRankUpgrade);
    }
 
    protected override void OnPreOpen()
    {
        Display();
    }
 
    void Display()
    {
        curLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV, HorseManager.Instance.horseLV);
        nextLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV + 1, 1);
 
        var nextConfig = HorseClassConfig.Get(HorseManager.Instance.classLV + 1);
 
        var keys = HorseManager.Instance.attrDic.Keys.ToList();
        keys.Sort();
        for (int i = 0; i < attrNameTexts.Length; i++)
        {
            if (i < keys.Count)
            {
                attrNameTexts[i].text = PlayerPropertyConfig.Get(keys[i]).Name;
                attrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(keys[i], HorseManager.Instance.attrDic[keys[i]]);
                nextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(keys[i], nextConfig.ClassAttrValueList[i]);
            }
        }
 
        var nextKeys = HorseManager.Instance.specialAttrDic.Keys.ToList();
        nextKeys.Sort();
        for (int i = 0; i < specialAttrRect.Length; i++)
        {
            if (i < nextConfig.ClassSpecAttrIDList.Length)
            {
                specialAttrRect[i].SetActive(true);
                specialAttrNameTexts[i].text = PlayerPropertyConfig.Get(nextKeys[i]).Name;
                if (i < nextKeys.Count)
                {
                    specialAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(nextConfig.ClassSpecAttrIDList[i], HorseManager.Instance.specialAttrDic[nextKeys[i]]);
                    specialNextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(nextConfig.ClassSpecAttrIDList[i], HorseManager.Instance.specialAttrDic[nextKeys[i]] + nextConfig.ClassSpecAttrValueList[i]);
                }
                else
                {
                    specialAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(nextKeys[i], 0);
                    specialNextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(nextKeys[i], nextConfig.ClassSpecAttrValueList[i]);
                }
            }
            else
            {
                specialAttrRect[i].SetActive(false);
            }
        }
 
        costText.text = UIHelper.ShowUseItem(PackType.Item, HorseManager.Instance.rankUPItemID, HorseClassConfig.Get(HorseManager.Instance.classLV).ClassUPItemCnt);
        costItemImg.SetItemSprite(HorseManager.Instance.rankUPItemID);
 
    }
 
    //升阶
    private void HorseRankUpgrade()
    {
        var config = HorseClassConfig.Get(HorseManager.Instance.classLV);
        if (!ItemLogicUtility.CheckItemCount(PackType.Item, HorseManager.Instance.rankUPItemID, config.ClassUPItemCnt, 2))
        {
            return;
        }
        var pack = new CB202_tagCSHorseClassUP();
        GameNetSystem.Instance.SendInfo(pack);
        CloseWindow();
    }
}