hch
1 天以前 6521aa56fbeba8d6509d5736bd35b1d42dcc4029
Main/System/Horse/HorseSuccessWin.cs
@@ -1,27 +1,94 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 坐骑
/// 坐骑进阶成功
/// </summary>
public class HorseSuccessWin : UIBase
{
    [SerializeField] Button bagBtn;
    [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] Button okBtn;
    protected override void InitComponent()
    {
        okBtn.AddListener(CloseWindow);
    }
    protected override void OnPreOpen()
    {
        Display();
    }
    protected override void OnPreClose()
    {
    }
    void Display()
    {
        var config = HorseClassConfig.Get(HorseManager.Instance.classLV - 1);
        curLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV - 1, config.MaxLV);
        nextLVText.text = Language.Get("Horse8", HorseManager.Instance.classLV, 1);
        var nextConfig = HorseClassConfig.Get(HorseManager.Instance.classLV);
        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 - nextConfig.ClassAttrValueList[i] - nextConfig.PerLVAttrValueList[i], 2);
                nextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(keys[i], curValue, 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]] - nextConfig.ClassSpecAttrValueList[i], 2);
                    specialNextAttrValueTexts[i].text = PlayerPropertyConfig.GetValueDescription(id,
                        HorseManager.Instance.specialAttrDic[nextKeys[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);
            }
        }
    }