//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, March 12, 2019 //-------------------------------------------------------- using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; namespace Snxxz.UI { public class TipBasePropertyWidget : MonoBehaviour { [SerializeField] Text m_PropertyBehaviour; public void Display(EquipTipUtility.BaseProperty data) { var count = Mathf.Min(data.baseProperties.Count, data.starProperties.Count); var lines = new string[count]; for (int i = 0; i < count; i++) { var baseProperty = data.baseProperties[i]; var config = PlayerPropertyConfig.Get(baseProperty.x); var name = config.Name; var baseValue = PlayerPropertyConfig.GetPropertyDescription(baseProperty.x, baseProperty.y); if (data.star > 0) { var starProperty = data.starProperties[i]; var starValue = PlayerPropertyConfig.GetPropertyDescription(starProperty.x, starProperty.y); var starDescription = UIHelper.AppendColor(TextColType.Green, string.Format("({0}星+{1})", data.star, starValue)); lines[i] = string.Format("{0}:{1} {2}", name, baseValue, starDescription); } else { lines[i] = string.Format("{0}:{1} ", name, baseValue); } } m_PropertyBehaviour.text = string.Join("\r\n", lines); } } }