//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, March 15, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
|
namespace Snxxz.UI
|
{
|
|
public class TipStarPropertyWidget : MonoBehaviour
|
{
|
[SerializeField] Image[] m_Stars;
|
[SerializeField] Text m_Property;
|
|
public void Display(ItemTipUtility.StarInfo starInfo)
|
{
|
for (int i = 0; i < m_Stars.Length; i++)
|
{
|
var behaviour = m_Stars[i];
|
if (i < starInfo.maxLevel)
|
{
|
behaviour.gameObject.SetActive(true);
|
behaviour.SetSprite(i < starInfo.starLevel ? "BJKM_6" : "BJKM_7");
|
}
|
else
|
{
|
behaviour.gameObject.SetActive(false);
|
}
|
}
|
|
var starConfigs = EquipStarConfig.GetConfigs(starInfo.equipPosition.x, starInfo.equipPosition.y);
|
var levelUpProperties = new Dictionary<int, Int2>();
|
var prePropertiesCount = 0;
|
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;
|
}
|
}
|
|
var lines = new List<string>();
|
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, string.Format("{0}({1}星激活)", description, star)));
|
}
|
}
|
|
m_Property.text = string.Join("\r\n", lines.ToArray());
|
}
|
|
|
}
|
|
}
|