using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; namespace vnxbqy.UI { public class SkillExpertBehaviour : MonoBehaviour { [SerializeField] ImageEx m_Bottom; [SerializeField] ImageEx m_Icon; [SerializeField] Text m_SkillName; [SerializeField] Text m_Active; //使用中 [SerializeField] RedpointBehaviour m_Redpoint; [SerializeField] Button m_Select; [SerializeField] UIEffect ActiveEffect; [SerializeField] Image SelectImg; [SerializeField] ImageEx m_ReikiBottom; const float dragDelay = 0.2f; public int skillId { get; private set; } bool isUnlock = false; bool onPress = false; float m_Time = 0.0f; public RectTransform flyContainer { get { return m_Icon.rectTransform; } } TreasureSkillModel model { get { return ModelCenter.Instance.GetModel(); } } ReikiRootModel reikiModel { get { return ModelCenter.Instance.GetModel(); } } private int GetLimitLV() { var skillConfig = SkillConfig.Get(skillId); var property = skillConfig.RequireProperty(); var condition = 0; if (!reikiModel.IsSatisfyReikiRootCondition(property, out condition)) { return condition == 1 ? reikiModel.resetReikiLimitLevel : reikiModel.afterReikiRootLimitLevel; } return 1; } public void Display(int skillId, int level) { this.skillId = skillId; this.isUnlock = level > 0; var skillConfig = SkillConfig.Get(skillId); m_Icon.SetSprite(PlayerDatas.Instance.baseData.LV < GetLimitLV() ? "UnKnowIcon" : skillConfig.IconName); string addLV = level > 0 ? " " + Language.Get("ExpertSkillLV", Language.Get("Num_CHS_" + level)) : string.Empty; m_SkillName.text = skillConfig.SkillName + addLV; var property = skillConfig.RequireProperty(); m_ReikiBottom.SetSprite("XT_LGDT_" + property); var selectExpertSkill = 0; model.TryGetExpertSkill(ExpertSkillSelectWin.skillId, out selectExpertSkill); TreasurePotential expert; model.TryGetPotential(skillId, out expert); int tmpSkillID = 0; model.TryGetExpertSkill(model.selectSkill, out tmpSkillID); ActiveEffect.Stop(); if (tmpSkillID == skillId) { m_Active.SetActive(true); ActiveEffect.Play(); } else { m_Active.SetActive(false); } SelectImg.SetActive(model.selecttExpertSkill == skillId); m_Bottom.gray = !isUnlock; m_Icon.gray = !isUnlock; m_ReikiBottom.gray = !isUnlock; m_Redpoint.redpointId = expert.activeRedpoint.id; m_Select.SetListener(OnSelect); } private void OnSelect() { var limitLV = GetLimitLV(); if (PlayerDatas.Instance.baseData.LV < limitLV) { SysNotifyMgr.Instance.ShowTip("RuneSpecialHoleLevelError", limitLV); return; } model.selecttExpertSkill = skillId; } } }