using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; /// /// 坐骑升阶 /// 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) { var curValue = HorseManager.Instance.attrDic[keys[i]]; attrNameTexts[i].text = PlayerPropertyConfig.Get(keys[i]).Name; attrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(keys[i], curValue, 2); nextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(keys[i], curValue + nextConfig.ClassAttrValueList[i] + nextConfig.PerLVAttrValueList[i], 2); } } 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); var id = nextConfig.ClassSpecAttrIDList[i]; specialAttrNameTexts[i].text = PlayerPropertyConfig.Get(id).Name; if (i < nextKeys.Count) { specialAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(id, HorseManager.Instance.specialAttrDic[nextKeys[i]], 2); specialNextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(id, HorseManager.Instance.specialAttrDic[nextKeys[i]] + nextConfig.ClassSpecAttrValueList[i], 2); } else { specialAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(id, 0); specialNextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(id, nextConfig.ClassSpecAttrValueList[i], 2); } } 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(); } }