using UnityEngine;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
|
public class HeroAwakeCell : MonoBehaviour
|
{
|
[SerializeField] UIEffectPlayer fireEffect;
|
[SerializeField] Image selectImg;
|
[SerializeField] Image bgImg;
|
[SerializeField] Image attrTypeImg;
|
[SerializeField] Text attrText;
|
[SerializeField] UIEffectPlayer activeEffect;
|
[SerializeField] Text awakeLVText;
|
[SerializeField] Image lineImg;
|
|
|
public void Display(HeroInfo hero, int awakeLV)
|
{
|
var config = HeroAwakeConfig.GetHeroAwakeConfig(hero.heroId, awakeLV);
|
if (hero.awakeLevel < awakeLV)
|
{
|
//未激活
|
fireEffect.Stop();
|
selectImg.SetActive(hero.awakeLevel + 1 == awakeLV);
|
}
|
else
|
{
|
fireEffect.Play();
|
selectImg.SetActive(false);
|
}
|
|
//1 天赋 2技能 3属性
|
int type = config.UnlockTalentSlot != 0 ? 1 : config.SkillID != 0 ? 2 : 3;
|
attrTypeImg.SetSprite("heroattrtype" + type);
|
bgImg.SetSprite("heroawakebg" + type);
|
if (type == 1)
|
{
|
attrText.text = UIHelper.AppendColor(hero.awakeLevel >= awakeLV ? TextColType.Green : TextColType.NavyGray, Language.Get("HeroAwake4"), false);
|
}
|
else if (type == 2)
|
{
|
attrText.text = UIHelper.AppendColor(hero.awakeLevel >= awakeLV ? TextColType.Green : TextColType.NavyGray, Language.Get("herocard16"), false);
|
}
|
else
|
{
|
string attrStr = "";
|
for (int i = 0; i < config.AttrIDList.Length; i++)
|
{
|
attrStr += PlayerPropertyConfig.GetFullDescription(config.AttrIDList[i], config.AttrValueList[i]) +
|
(i == config.AttrIDList.Length - 1 ? "" : "\n");
|
}
|
attrText.text = UIHelper.AppendColor(hero.awakeLevel >= awakeLV ? TextColType.Green : TextColType.NavyGray, attrStr, false);
|
}
|
awakeLVText.text = awakeLV.ToString();
|
lineImg.SetActive(hero.awakeLevel >= awakeLV);
|
}
|
|
public void ShowActiveEffect(HeroInfo hero, int awakeLV)
|
{
|
var config = HeroAwakeConfig.GetHeroAwakeConfig(hero.heroId, awakeLV);
|
//1 天赋 2技能 3属性
|
int type = config.UnlockTalentSlot != 0 ? 1 : config.SkillID != 0 ? 2 : 3;
|
if (type != 3)
|
return;
|
|
if (hero.awakeLevel + 1 == awakeLV)
|
{
|
activeEffect.Play();
|
}
|
}
|
}
|