using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] 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(); } } public Transform flyPoint { get { return m_SkillIcon.transform; } } public Transform skillLock { get { return m_ContainerSkillLock; } } public void Display(int skillId) { m_ContainerSelect.gameObject.SetActive(skillId == model.selectSkill); m_Unlock.RemoveAllListeners(); m_ViewSkill.RemoveAllListeners(); var skillConfig = Config.Instance.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.gameObject.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].gameObject.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].gameObject.SetActive(false); } m_ContainerLock.gameObject.SetActive(skillState == JadeDynastySkillState.Lock); m_ContainerUnlockable.gameObject.SetActive(skillState == JadeDynastySkillState.Unlockable); m_ContainerUnlocked.gameObject.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); }); } } } }