using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace vnxbqy.UI { public class ReikiRootPromoteBehaviour : MonoBehaviour { [SerializeField] Image m_Icon; [SerializeField] Text m_QualityName0; [SerializeField] Text m_QualityName1; [SerializeField] PropertyBehaviour[] m_Propertys; [SerializeField] Transform m_ContainerNewProperty; [SerializeField] Text m_NextQuality; [SerializeField] Text m_NewProperty; ReikiRootModel model { get { return ModelCenter.Instance.GetModel(); } } static List displayPropertys = new List(); public void Display(int id, int lastPoint, int point, bool isLastIndex) { m_Icon.SetSprite("XT_LGL_" + id); var quality = model.GetReikiRootQuality(id, lastPoint); var newQuality = model.GetReikiRootQuality(id, point); m_QualityName0.text = ReikiRootModel.GetQualityLabel(quality); m_QualityName0.color = UIHelper.GetUIColor(model.GetQualityColor(quality), true); m_QualityName1.text = ReikiRootModel.GetQualityLabel(newQuality); m_QualityName1.color = UIHelper.GetUIColor(model.GetQualityColor(newQuality), true); displayPropertys.Clear(); Int2 newProperty = Int2.zero; var qualityPropertys = model.GetReikiQualityProperties(id); for (int i = 0; i < m_Propertys.Length; i++) { m_Propertys[i].SetActive(i < qualityPropertys.Count); if (i < qualityPropertys.Count) { var lastPropertyValue = model.GetQualityProperty(quality, qualityPropertys[i].propertyValues); var propertyValue = model.GetQualityProperty(newQuality, qualityPropertys[i].propertyValues); m_Propertys[i].SetActive(propertyValue > lastPropertyValue); if (propertyValue > lastPropertyValue) { var config = ReikiRootConfig.Get(id); m_Propertys[i].DisplayAdd(qualityPropertys[i].property, lastPropertyValue, propertyValue); displayPropertys.Add(qualityPropertys[i].property); } } } var max = model.GetMaxReikiRootQuality(id); for (int i = 0; i < qualityPropertys.Count; i++) { if (displayPropertys.Contains(qualityPropertys[i].property)) { continue; } for (int j = newQuality; j <= max; j++) { if(model.GetQualityProperty(j, qualityPropertys[i].propertyValues) > 0) { newProperty.x = j; newProperty.y = qualityPropertys[i].property; break; } } if (newProperty.y != 0) { break; } } m_ContainerNewProperty.SetActive(newProperty.y != 0); if (newProperty.y != 0) { var qualityLabel = UIHelper.AppendColor(model.GetQualityColor(newProperty.x), ReikiRootModel.GetQualityLabel(newProperty.x)); m_NextQuality.text = Language.Get("ReikiRoot1", qualityLabel); var propertyConfig = PlayerPropertyConfig.Get(newProperty.y); m_NewProperty.text = propertyConfig.Name; } } } }