//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Friday, March 15, 2019 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; namespace vnxbqy.UI { public class TipStarPropertyWidget : MonoBehaviour { [SerializeField] Image[] m_Stars; [SerializeField] Text m_Property; public void Display(ItemTipUtility.StarInfo starInfo) { var iconCnt = m_Stars.Length; for (int i = 0; i < iconCnt; i++) { var behaviour = m_Stars[i]; if (i < starInfo.maxLevel) { behaviour.gameObject.SetActive(true); var loop = (starInfo.starLevel - 1) / iconCnt; var starIndex = loop * iconCnt + i < starInfo.starLevel ? loop : loop - 1; behaviour.SetSprite(i < starInfo.starLevel ? "ImgStar_" + starIndex : "BJKM_7"); } else { behaviour.SetActive(false); } } var starConfigs = EquipStarConfig.GetConfigs(starInfo.equipPosition.x, starInfo.equipPosition.y); var levelUpProperties = new Dictionary(); var prePropertiesCount = 0; if (starConfigs != null) { this.transform.SetActive(true); foreach (var config in starConfigs) { if (config.StarAttrInfo.Length > prePropertiesCount) { var length = config.StarAttrInfo.Length; levelUpProperties[config.Star] = config.StarAttrInfo[length - 1]; prePropertiesCount = config.StarAttrInfo.Length; } } } else { this.transform.SetActive(false); } var lines = new List(); foreach ( var item in levelUpProperties ) { var star = item.Key; var property = item.Value; var actived = starInfo.starLevel >= item.Key; var description = PlayerPropertyConfig.GetFullDescription(property.x, property.y); if (actived) { lines.Add(UIHelper.AppendColor(TextColType.Green, description)); } else { lines.Add(UIHelper.AppendColor(TextColType.Gray, Language.Get("EquipStar16", description, star))); } } m_Property.text = string.Join("\r\n", lines.ToArray()); } } }