using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class JadeDynastySkillCell : CellView
|
{
|
[SerializeField] Transform m_ContainerSelect;
|
[SerializeField] Button m_ViewSkill;
|
[SerializeField] Image m_SkillIcon;
|
[SerializeField] Text m_SkillName;
|
[SerializeField] Transform m_ContainerSkillLock;
|
[SerializeField] Text m_Condition;
|
[SerializeField] Text[] m_EquipPlaceNames;
|
[SerializeField] Transform m_ContainerLock;
|
[SerializeField] Transform m_ContainerUnlockable;
|
[SerializeField] Button m_Unlock;
|
[SerializeField] Transform m_ContainerUnlocked;
|
|
JadeDynastySkillModel model
|
{
|
get { return ModelCenter.Instance.GetModel<JadeDynastySkillModel>(); }
|
}
|
|
public Transform flyPoint
|
{
|
get
|
{
|
return m_SkillIcon.transform;
|
}
|
}
|
|
public Transform skillLock
|
{
|
get
|
{
|
return m_ContainerSkillLock;
|
}
|
}
|
|
public void Display(int skillId)
|
{
|
m_ContainerSelect.SetActive(skillId == model.selectSkill);
|
|
m_Unlock.RemoveAllListeners();
|
m_ViewSkill.RemoveAllListeners();
|
|
var skillConfig = SkillConfig.Get(skillId);
|
if (skillConfig != null)
|
{
|
m_SkillIcon.SetSprite(skillConfig.IconName);
|
m_SkillName.text = skillConfig.SkillName;
|
|
m_ViewSkill.AddListener(() =>
|
{
|
SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.JadeDynastySkill,
|
skillConfig.FightPower);
|
});
|
}
|
|
var skillState = model.GetSkillState(skillId);
|
m_ContainerSkillLock.SetActive(skillState != JadeDynastySkillState.Unlocked);
|
JadeDynastySkillCondition condition;
|
|
var index = 0;
|
if (model.TryGetSkillCondition(skillId, out condition))
|
{
|
m_Condition.text = Language.Get("JadeDynastySkillContition", condition.level);
|
foreach (var equipPlace in condition.equipPlaces)
|
{
|
if (index < m_EquipPlaceNames.Length)
|
{
|
m_EquipPlaceNames[index].SetActive(true);
|
m_EquipPlaceNames[index].text = Language.Get(((RoleEquipType)equipPlace).ToString());
|
m_EquipPlaceNames[index].color = skillState == JadeDynastySkillState.Unlocked || model.IsSatisfyEquipLevel(equipPlace, condition.level) ?
|
UIHelper.GetUIColor(TextColType.DarkGreen) : UIHelper.GetUIColor(TextColType.White, true);
|
}
|
index++;
|
}
|
}
|
|
for (int i = index; i < m_EquipPlaceNames.Length; i++)
|
{
|
m_EquipPlaceNames[i].SetActive(false);
|
}
|
|
m_ContainerLock.SetActive(skillState == JadeDynastySkillState.Lock);
|
m_ContainerUnlockable.SetActive(skillState == JadeDynastySkillState.Unlockable);
|
m_ContainerUnlocked.SetActive(skillState == JadeDynastySkillState.Unlocked);
|
|
if (skillState == JadeDynastySkillState.Unlockable)
|
{
|
m_Unlock.AddListener(() =>
|
{
|
C0304_tagCAddSkillPoint pak = new C0304_tagCAddSkillPoint();
|
pak.SkillID = (ushort)skillId;
|
GameNetSystem.Instance.SendInfo(pak);
|
});
|
}
|
}
|
}
|
}
|
|