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();
|
}
|
}
|