| //--------------------------------------------------------  | 
| //    [Author]:           第二世界  | 
| //    [  Date ]:           Friday, November 10, 2017  | 
| //--------------------------------------------------------  | 
|   | 
| using System;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
|   | 
| using UnityEngine;  | 
| using UnityEngine.UI;  | 
|   | 
| namespace vnxbqy.UI  | 
| {  | 
|   | 
|     public class SkillPassWin : Window  | 
|     {  | 
|         [SerializeField] FlipScroll flipScroll;  | 
|         [SerializeField] RectTransform m_ContainerSkillDetails;  | 
|         [SerializeField] RectTransform m_ContainerUnselect;  | 
|         [SerializeField] Text m_SkillNameTxt;  | 
|         [SerializeField] Text m_SkillSourceTxt;  | 
|         [SerializeField] Text m_SkillDescTxt;  | 
|         [SerializeField] Text m_CoolDownTxt;  | 
|         [SerializeField] Button m_LeftBtn;  | 
|         [SerializeField] Button m_RightBtn;  | 
|         [SerializeField] List<SkillCell> equipPassSkills = new List<SkillCell>();  | 
|         [SerializeField] List<UIEffect> equipPassEffects = new List<UIEffect>();  | 
|         [SerializeField] Image m_DragImg;  | 
|         [SerializeField] Image m_DragSkillImg;  | 
|         [SerializeField] List<Button> m_PageBtns = new List<Button>();  | 
|         [Header("GetWay")]  | 
|         [SerializeField]  | 
|         Button m_GetWayBtn;  | 
|         [SerializeField] Button m_ImmediatelyUnlock;  | 
|         [SerializeField] ScrollerController scrollerController;  | 
|         [SerializeField] RectTransform m_ContainerGetWay;  | 
|         [SerializeField] ClickScreenOtherSpace clickOtherSpace;  | 
|         [SerializeField, Header("特效时长")] float m_EffectDuration = 1f;  | 
|         private List<int> skillListPass = new List<int>();  | 
|         private int presentSltEquipIndex = -1;  | 
|   | 
|         Coroutine cacheCoroutine = null;  | 
|         SkillModel m_Model;  | 
|         SkillModel model  | 
|         {  | 
|             get  | 
|             {  | 
|                 return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<SkillModel>());  | 
|             }  | 
|         }  | 
|   | 
|         TaskModel task { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }  | 
|   | 
|         RolePromoteModel m_PromoteModel;  | 
|         RolePromoteModel promoteModel  | 
|         {  | 
|             get  | 
|             {  | 
|                 return m_PromoteModel ?? (m_PromoteModel = ModelCenter.Instance.GetModel<RolePromoteModel>());  | 
|             }  | 
|         }  | 
|   | 
|         VipModel m_VipModel;  | 
|         VipModel vipModel  | 
|         {  | 
|             get  | 
|             {  | 
|                 return m_VipModel ?? (m_VipModel = ModelCenter.Instance.GetModel<VipModel>());  | 
|             }  | 
|         }  | 
|   | 
|         PlayerMainDate taskMain { get { return ModelCenter.Instance.GetModel<PlayerMainDate>(); } }  | 
|         PackModel pack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }  | 
|   | 
|         static readonly Color equipHoleLimitColor = new Color32(250, 3, 3, 255);  | 
|         static readonly Color equipHoleUnLimitColor = new Color32(51, 8, 0, 255);  | 
|         #region Built-in  | 
|         protected override void BindController()  | 
|         {  | 
|   | 
|         }  | 
|   | 
|         protected override void AddListeners()  | 
|         {  | 
|             flipScroll.OnRefreshData += OnRefreshPassSkill;  | 
|             flipScroll.OnTweenCompt += OnTweenCompt;  | 
|             m_LeftBtn.onClick.AddListener(flipScroll.FlipLeft);  | 
|             m_RightBtn.onClick.AddListener(flipScroll.FlipRight);  | 
|             for (int i = 0; i < m_PageBtns.Count; i++)  | 
|             {  | 
|                 int index = i;  | 
|                 m_PageBtns[i].onClick.AddListener(() =>  | 
|                 {  | 
|                     OnClickPage(index);  | 
|                 });  | 
|             }  | 
|             for (int i = 0; i < equipPassSkills.Count; i++)  | 
|             {  | 
|                 int index = i;  | 
|                 equipPassSkills[i].skillData.m_SkillBtn.onClick.AddListener(() =>  | 
|                 {  | 
|                     OnClickEquipHole(index);  | 
|                 });  | 
|             }  | 
|             scrollerController.OnRefreshCell += OnRefreshCell;  | 
|             m_GetWayBtn.onClick.AddListener(OnGetWayBtn);  | 
|             m_ImmediatelyUnlock.onClick.AddListener(ImmediatelyUnlock);  | 
|             clickOtherSpace.AddListener(() =>  | 
|             {  | 
|                 m_ContainerGetWay.SetActive(false);  | 
|             });  | 
|         }  | 
|   | 
|         protected override void OnPreOpen()  | 
|         {  | 
|             m_DragImg.SetActive(false);  | 
|             m_ContainerGetWay.SetActive(false);  | 
|             m_GetWayBtn.SetActive(false);  | 
|             m_ImmediatelyUnlock.SetActive(false);  | 
|             flipScroll.locked = false;  | 
|             PlayerSkillDatas.OnRefreshSkill += OnRefreshSkill;  | 
|             model.OnRefreshSltSkill += OnRefreshSltSkill;  | 
|             model.UpdatePassEquipSkillEvent += UpdatePassEquipSkillEvent;  | 
|             PlayerDatas.Instance.playerDataRefreshEvent += OnRefreshPlayerInfo;  | 
|             model.presentSltPage = model.presentEquipPage;  | 
|             Input.multiTouchEnabled = false;  | 
|             GetSkillList();  | 
|             UpdatePassEquipPageBtn();  | 
|             OnUpdateSltSkillInfo();  | 
|             UpdateEquipPassSkill();  | 
|             SetEquipHoleSelect(GetEquipHoleIndex(model.presentSltSkillID));  | 
|             //DayRemind.Instance.SetDayRemind(DayRemind.PASS_SKILL_REDPOINT, true);  | 
|   | 
|             if (cacheCoroutine != null)  | 
|             {  | 
|                 StopCoroutine(cacheCoroutine);  | 
|                 cacheCoroutine = null;  | 
|             }  | 
|         }  | 
|   | 
|         protected override void OnActived()  | 
|         {  | 
|             base.OnActived();  | 
|             UpdatePageBtn();  | 
|   | 
|             if (taskMain.Skill_Index != 0)  | 
|             {  | 
|                 var hole = taskMain.Skill_Index - 1;  | 
|                 if (!model.IsPassSkillHoleOpen(hole))  | 
|                 {  | 
|                     OnClickEquipHole(hole, false);  | 
|                 }  | 
|             }  | 
|             //else if (model.taskHoleRedpoint.state == RedPointState.Simple)  | 
|             //{  | 
|             //    model.SetTaskHoleRemind();  | 
|             //    for (int i = 0; i < equipPassSkills.Count; i++)  | 
|             //    {  | 
|             //        PassSkillLimit limit;  | 
|             //        if (model.TryGetPassSkillLimit(i, out limit))  | 
|             //        {  | 
|             //            if (limit.OpenSkillSlots > 0 && model.IsImmediatelyUnlock(i))  | 
|             //            {  | 
|             //                OnClickEquipHole(i, false);  | 
|             //                return;  | 
|             //            }  | 
|             //        }  | 
|             //    }  | 
|             //}  | 
|         }  | 
|   | 
|         protected override void OnAfterOpen()  | 
|         {  | 
|             DisplayEffect();  | 
|             model.taskUnlockUpdate += TaskUnlockUpdate;  | 
|         }  | 
|   | 
|         protected override void OnPreClose()  | 
|         {  | 
|             Input.multiTouchEnabled = true;  | 
|             PlayerSkillDatas.OnRefreshSkill -= OnRefreshSkill;  | 
|             model.OnRefreshSltSkill -= OnRefreshSltSkill;  | 
|             model.UpdatePassEquipSkillEvent -= UpdatePassEquipSkillEvent;  | 
|             PlayerDatas.Instance.playerDataRefreshEvent -= OnRefreshPlayerInfo;  | 
|             model.taskUnlockUpdate -= TaskUnlockUpdate;  | 
|             model.SetDayRemind();  | 
|             model.UnlockPassHole = 0;  | 
|             taskMain.Skill_Index = 0;  | 
|         }  | 
|   | 
|         protected override void OnAfterClose()  | 
|         {  | 
|             model.SendEquipPage();  | 
|         }  | 
|   | 
|         private void TaskUnlockUpdate()  | 
|         {  | 
|             DisplayEffect();  | 
|         }  | 
|   | 
|         void DisplayEffect()  | 
|         {  | 
|             if (model.UnlockPassHole != 0)  | 
|             {  | 
|                 var index = 0;  | 
|                 for (int i = 0; i < model.passEquipCnt; i++)  | 
|                 {  | 
|                     PassSkillLimit limit;  | 
|                     if (model.TryGetPassSkillLimit(i, out limit))  | 
|                     {  | 
|                         if (limit.OpenSkillSlots != 0 && limit.OpenSkillSlots == model.UnlockPassHole)  | 
|                         {  | 
|                             index = i;  | 
|                             break;  | 
|                         }  | 
|                     }  | 
|                 }  | 
|                 model.UnlockPassHole = 0;  | 
|                 if (index >= 0 && index < equipPassEffects.Count)  | 
|                 {  | 
|                     equipPassEffects[index].Play();  | 
|                     cacheCoroutine = StartCoroutine(Co_UnlockEffectComplete());  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         IEnumerator Co_UnlockEffectComplete()  | 
|         {  | 
|             var duration = m_EffectDuration > 0f ? m_EffectDuration : 1.0f;  | 
|             yield return WaitingForSecondConst.GetWaitForSeconds(duration);  | 
|             SysNotifyMgr.Instance.ShowTip("PassNewHole");  | 
|             UpdateEquipPassSkill();  | 
|         }  | 
|   | 
|         protected override void LateUpdate()  | 
|         {  | 
|             base.LateUpdate();  | 
|             if (model.skillDraging)  | 
|             {  | 
|                 flipScroll.locked = true;  | 
|                 if (!m_DragImg.gameObject.activeSelf)  | 
|                 {  | 
|                     m_DragImg.SetActive(true);  | 
|                     SkillConfig cfg = SkillConfig.Get(model.skillDragId);  | 
|                     if (cfg != null)  | 
|                     {  | 
|                         m_DragSkillImg.SetSprite(cfg.IconName);  | 
|                     }  | 
|                 }  | 
|                 Vector2 _pos;  | 
|                 if (RectTransformUtility.ScreenPointToLocalPointInRectangle(this.transform as RectTransform,  | 
|                     Input.mousePosition, CameraManager.uiCamera, out _pos))  | 
|                 {  | 
|                     m_DragImg.rectTransform.localPosition = _pos;  | 
|                 }  | 
|   | 
|                 if (Input.GetMouseButtonUp(0))  | 
|                 {  | 
|                     model.skillDraging = false;  | 
|                     flipScroll.locked = false;  | 
|                     m_DragImg.SetActive(false);  | 
|                     CheckReplaceEquipSkill();  | 
|                 }  | 
|             }  | 
|         }  | 
|         #endregion  | 
|         private void OnRefreshSltSkill()  | 
|         {  | 
|             flipScroll.RefreshActive();  | 
|             var _equipIndex = GetEquipHoleIndex(model.presentSltSkillID);  | 
|             SetEquipHoleSelect(_equipIndex);  | 
|             m_GetWayBtn.SetActive(CheckOpenGetWays(_equipIndex) == 1);  | 
|             m_ImmediatelyUnlock.SetActive(CheckOpenGetWays(_equipIndex) == 2);  | 
|             OnUpdateSltSkillInfo();  | 
|         }  | 
|   | 
|         private int CheckOpenGetWays(int _index)  | 
|         {  | 
|             PassSkillLimit _limit;  | 
|             if (model.TryGetPassSkillLimit(_index, out _limit))  | 
|             {  | 
|                 if (_limit.level > 0 && PlayerDatas.Instance.baseData.LV < _limit.level)  | 
|                 {  | 
|                     return 1;  | 
|                 }  | 
|                 else if (_limit.vipLv > 0 && PlayerDatas.Instance.baseData.VIPLv < _limit.vipLv)  | 
|                 {  | 
|                     return 1;  | 
|                 }  | 
|                 else if (_limit.MountLv > 0 && promoteModel.GetMountTotallv() < _limit.MountLv)  | 
|                 {  | 
|                     return 1;  | 
|                 }  | 
|                 else if (_limit.OpenSkillSlots > 0 && !model.IsTaskHoleUnlock(_limit.OpenSkillSlots))  | 
|                 {  | 
|                     if (model.taskHoleDict.ContainsKey(_limit.OpenSkillSlots))  | 
|                     {  | 
|                         var taskId = model.taskHoleDict[_limit.OpenSkillSlots];  | 
|                         var config = PyTaskConfig.Get(taskId);  | 
|                         if (PlayerDatas.Instance.baseData.LV >= config.lv  | 
|                             && model.IsImmediatelyUnlock(_index))  | 
|                         {  | 
|                             return 2;  | 
|                         }  | 
|                     }  | 
|                     return 3;  | 
|                 }  | 
|             }  | 
|             return 0;  | 
|         }  | 
|   | 
|         private void OnRefreshPlayerInfo(PlayerDataType type)  | 
|         {  | 
|             switch (type)  | 
|             {  | 
|                 case PlayerDataType.LV:  | 
|                 case PlayerDataType.LV2:  | 
|                 case PlayerDataType.LVEx:  | 
|                 case PlayerDataType.VIPLv:  | 
|                     UpdateEquipPassSkill();  | 
|                     break;  | 
|             }  | 
|         }  | 
|   | 
|         private void OnRefreshSkill()  | 
|         {  | 
|             flipScroll.RefreshActive();  | 
|         }  | 
|         private void OnRefreshPassSkill(int page, RectTransform cell)  | 
|         {  | 
|             for (int i = 0; i < cell.childCount; i++)  | 
|             {  | 
|                 Transform skillTran = cell.GetChild(i);  | 
|                 int index = page * SkillModel.PASS_SKILL_NUM + i;  | 
|                 if (index < skillListPass.Count)  | 
|                 {  | 
|                     skillTran.SetActive(true);  | 
|                     skillTran.GetComponent<SkillCell>().Refresh(skillListPass[index]);  | 
|                 }  | 
|                 else  | 
|                 {  | 
|                     skillTran.SetActive(false);  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         private void OnTweenCompt()  | 
|         {  | 
|             UpdatePageBtn();  | 
|         }  | 
|   | 
|         void UpdatePageBtn()  | 
|         {  | 
|             if (flipScroll.Page == 0)  | 
|             {  | 
|                 m_LeftBtn.SetActive(false);  | 
|             }  | 
|             else  | 
|             {  | 
|                 m_LeftBtn.SetActive(true);  | 
|             }  | 
|             if (flipScroll.Page == flipScroll.pageCnt - 1)  | 
|             {  | 
|                 m_RightBtn.SetActive(false);  | 
|             }  | 
|             else  | 
|             {  | 
|                 m_RightBtn.SetActive(true);  | 
|             }  | 
|         }  | 
|   | 
|         void OnUpdateSltSkillInfo()  | 
|         {  | 
|             SkillConfig _cfg = SkillConfig.Get(model.presentSltSkillID);  | 
|             m_ContainerSkillDetails.SetActive(_cfg != null);  | 
|             m_ContainerUnselect.SetActive(_cfg == null);  | 
|             if (_cfg != null)  | 
|             {  | 
|                 m_SkillNameTxt.text = _cfg.SkillName;  | 
|                 m_SkillSourceTxt.text = _cfg.Skillsource;  | 
|                 m_SkillDescTxt.text = UIHelper.ReplaceNewLine(_cfg.Description);  | 
|                 m_CoolDownTxt.text = _cfg.CoolDownTime == 0 ? string.Empty : Language.Get("L1065", _cfg.CoolDownTime / 1000);  | 
|             }  | 
|         }  | 
|   | 
|         void GetSkillList()  | 
|         {  | 
|             Dictionary<int, List<int>> dic = SkillConfig.GetSkillWithOccpyAndType((int)Mathf.Pow(2, PlayerDatas.Instance.baseData.Job), SkillModel.PASS_SKILL_TYPE);  | 
|             Dictionary<int, PlayerSkillData> playerskills = PlayerDatas.Instance.skill.GetAllSkill();  | 
|             skillListPass.Clear();  | 
|             foreach (int key in dic.Keys)  | 
|             {  | 
|                 var skillId = dic[key][0];  | 
|                 foreach (var id in dic[key])  | 
|                 {  | 
|                     if (PlayerDatas.Instance.skill.GetSKillById(id) != null) { skillId = id; break; }  | 
|                 }  | 
|                 if (PlayerDatas.Instance.skill.GetFilterPlayerSkill(PlayerDatas.Instance.baseData.Job).Contains(skillId))  | 
|                     continue;  | 
|                 skillListPass.Add(skillId);  | 
|             }  | 
|             if (skillListPass.Count < 1) return;  | 
|             model.presentSltSkillID = skillListPass[0];  | 
|             flipScroll.pageCnt = Mathf.CeilToInt((float)skillListPass.Count / SkillModel.PASS_SKILL_NUM);  | 
|             flipScroll.RefreshActive();  | 
|         }  | 
|   | 
|         private void UpdatePassEquipSkillEvent()  | 
|         {  | 
|             UpdateEquipPassSkill();  | 
|             SetEquipHoleSelect(GetEquipHoleIndex(model.presentSltSkillID));  | 
|         }  | 
|   | 
|         private void UpdateEquipPassSkill()  | 
|         {  | 
|             for (int i = 0; i < equipPassSkills.Count; i++)  | 
|             {  | 
|                 equipPassSkills[i].SetActive(i < model.passEquipCnt);  | 
|                 if (i < model.passEquipCnt)  | 
|                 {  | 
|                     PassSkillLimit limit;  | 
|                     equipPassSkills[i].skillData.m_SkillNameTxt.color = equipHoleUnLimitColor;  | 
|                     if (model.TryGetPassSkillLimit(i, out limit))  | 
|                     {  | 
|                         if (limit.level > 0)  | 
|                         {  | 
|                             if (PlayerDatas.Instance.baseData.LV < limit.level)  | 
|                             {  | 
|                                 SetEquipSkillDeActive(i);  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.color = equipHoleLimitColor;  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.text = Language.Get("PassSkillHoleLimitLv", limit.level);  | 
|                                 continue;  | 
|                             }  | 
|                         }  | 
|                         else if (limit.vipLv > 0)  | 
|                         {  | 
|                             if (PlayerDatas.Instance.baseData.VIPLv < limit.vipLv)  | 
|                             {  | 
|                                 SetEquipSkillDeActive(i);  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.color = equipHoleLimitColor;  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.text = Language.Get("PassSkillHoleLimitVip", limit.vipLv);  | 
|                                 continue;  | 
|                             }  | 
|                         }  | 
|                         else if (limit.MountLv > 0)  | 
|                         {  | 
|                             if (promoteModel.GetMountTotallv() < limit.MountLv)  | 
|                             {  | 
|                                 SetEquipSkillDeActive(i);  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.color = equipHoleLimitColor;  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.text = Language.Get("PassSkillHoleLimitMount", limit.MountLv);  | 
|                                 continue;  | 
|                             }  | 
|                         }  | 
|                         else if (limit.OpenSkillSlots > 0)  | 
|                         {  | 
|                             if (!model.IsTaskHoleUnlock(limit.OpenSkillSlots) || model.UnlockPassHole == limit.OpenSkillSlots)  | 
|                             {  | 
|                                 SetEquipSkillDeActive(i);  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.color = equipHoleLimitColor;  | 
|   | 
|                                 if (model.taskHoleDict.ContainsKey(limit.OpenSkillSlots))  | 
|                                 {  | 
|                                     var taskId = model.taskHoleDict[limit.OpenSkillSlots];  | 
|                                     var config = PyTaskConfig.Get(taskId);  | 
|                                     if (PlayerDatas.Instance.baseData.LV < config.lv)  | 
|                                     {  | 
|                                         equipPassSkills[i].skillData.m_SkillNameTxt.text =  | 
|                                             UIHelper.ReplaceNewLine(Language.Get("PassSkillHoleLimitTask_6", config.lv));  | 
|                                         continue;  | 
|                                     }  | 
|                                 }  | 
|                                 equipPassSkills[i].skillData.m_SkillNameTxt.text =  | 
|                                     UIHelper.ReplaceNewLine(Language.Get(StringUtility.Contact("PassSkillHoleLimitTask_", limit.OpenSkillSlots)));  | 
|                                 continue;  | 
|                             }  | 
|                             else if (model.IsImmediatelyUnlock(i)  | 
|                                 && model.IsTaskHoleUnlock(limit.OpenSkillSlots))  | 
|                             {  | 
|                                 if (m_ImmediatelyUnlock.gameObject.activeSelf)  | 
|                                 {  | 
|                                     m_ImmediatelyUnlock.SetActive(false);  | 
|                                 }  | 
|                             }  | 
|                         }  | 
|                     }  | 
|                     int _skillId = 0;  | 
|                     equipPassSkills[i].skillData.m_SkillNameTxt.text = string.Empty;  | 
|                     equipPassSkills[i].skillData.m_LockImg.SetActive(false);  | 
|                     model.TryGetEquipPassSkills(model.presentSltPage, i, out _skillId);  | 
|                     equipPassSkills[i].skillData.SetSkillData(_skillId);  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         private void CheckReplaceEquipSkill()  | 
|         {  | 
|             for (int i = 0; i < model.passEquipCnt; i++)  | 
|             {  | 
|                 if (i < equipPassSkills.Count)  | 
|                 {  | 
|                     var rect = equipPassSkills[i].transform as RectTransform;  | 
|                     var des = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, rect);  | 
|                     var src = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, m_DragImg.rectTransform);  | 
|                     var dis = Vector3.Distance(des.center, src.center);  | 
|                     if (dis < rect.rect.width / 2)  | 
|                     {  | 
|                         if (CheckOpenGetWays(i) != 0)  | 
|                         {  | 
|                             //SoundPlayer.Instance.PlayUIAudio(2);  | 
|                             return;  | 
|                         }  | 
|                         model.SendEquipPassSkills(model.skillDragId, i);  | 
|                         //if (model.passSkillHoleRedpoints[i].state == RedPointState.Simple)  | 
|                         //{  | 
|                         //    model.SetDayRemind();  | 
|                         //}  | 
|                         break;  | 
|                     }  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         private void SetEquipSkillDeActive(int _hole)  | 
|         {  | 
|             equipPassSkills[_hole].skillData.m_LockImg.SetActive(true);  | 
|             equipPassSkills[_hole].skillData.SetSkillData(0);  | 
|         }  | 
|   | 
|         private void OnClickPage(int index)  | 
|         {  | 
|             if (index != model.presentSltPage)  | 
|             {  | 
|                 model.SetDayRemind();  | 
|             }  | 
|             model.presentSltPage = index;  | 
|             UpdateEquipPassSkill();  | 
|             UpdatePassEquipPageBtn();  | 
|             var _equipIndex = GetEquipHoleIndex(model.presentSltSkillID);  | 
|             SetEquipHoleSelect(_equipIndex);  | 
|             m_GetWayBtn.SetActive(CheckOpenGetWays(_equipIndex) == 1);  | 
|             m_ImmediatelyUnlock.SetActive(CheckOpenGetWays(_equipIndex) == 2);  | 
|         }  | 
|   | 
|         private void UpdatePassEquipPageBtn()  | 
|         {  | 
|             for (int i = 0; i < m_PageBtns.Count; i++)  | 
|             {  | 
|                 m_PageBtns[i].image.SetSprite(model.presentSltPage == i ? "SkillRightbtn_A" : "Skillbtnbtn_A");  | 
|             }  | 
|         }  | 
|   | 
|         private void OnClickEquipHole(int index, bool requireRemind = true)  | 
|         {  | 
|             PassSkillLimit limit;  | 
|             m_GetWayBtn.SetActive(false);  | 
|             m_ImmediatelyUnlock.SetActive(false);  | 
|             SetEquipHoleSelect(index);  | 
|             if (model.TryGetPassSkillLimit(index, out limit))  | 
|             {  | 
|                 if (limit.level > 0)  | 
|                 {  | 
|                     if (PlayerDatas.Instance.baseData.LV < limit.level)  | 
|                     {  | 
|                         if (requireRemind)  | 
|                         {  | 
|                             SysNotifyMgr.Instance.ShowTip("PassEquipLimitLevel", limit.level);  | 
|                         }  | 
|                         m_GetWayBtn.SetActive(true);  | 
|                     }  | 
|                 }  | 
|                 else if (limit.vipLv > 0)  | 
|                 {  | 
|                     if (PlayerDatas.Instance.baseData.VIPLv < limit.vipLv)  | 
|                     {  | 
|                         if (requireRemind)  | 
|                         {  | 
|                             SysNotifyMgr.Instance.ShowTip("PassEquipLimitVip", limit.vipLv);  | 
|                         }  | 
|                         m_GetWayBtn.SetActive(true);  | 
|                         return;  | 
|                     }  | 
|                 }  | 
|                 else if (limit.MountLv > 0)  | 
|                 {  | 
|                     if (promoteModel.GetMountTotallv() < limit.MountLv)  | 
|                     {  | 
|                         if (requireRemind)  | 
|                         {  | 
|                             SysNotifyMgr.Instance.ShowTip("PassEquipLimitMountLevel", limit.MountLv);  | 
|                         }  | 
|                         m_GetWayBtn.SetActive(true);  | 
|                     }  | 
|                 }  | 
|                 else if (limit.OpenSkillSlots > 0)  | 
|                 {  | 
|                     if (!model.IsTaskHoleUnlock(limit.OpenSkillSlots))  | 
|                     {  | 
|                         if (model.taskHoleDict.ContainsKey(limit.OpenSkillSlots))  | 
|                         {  | 
|                             var taskId = model.taskHoleDict[limit.OpenSkillSlots];  | 
|                             var config = PyTaskConfig.Get(taskId);  | 
|                             if (PlayerDatas.Instance.baseData.LV < config.lv)  | 
|                             {  | 
|                                 m_GetWayBtn.SetActive(false);  | 
|                                 return;  | 
|                             }  | 
|                             if (model.IsImmediatelyUnlock(index))  | 
|                             {  | 
|                                 m_ImmediatelyUnlock.SetActive(true);  | 
|                             }  | 
|                         }  | 
|                         if (requireRemind)  | 
|                         {  | 
|                             SysNotifyMgr.Instance.ShowTip(StringUtility.Contact("PassSkillHoleLimitTask_", limit.OpenSkillSlots));  | 
|                         }  | 
|                         m_GetWayBtn.SetActive(false);  | 
|                     }  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         private void OnRefreshCell(ScrollerDataType type, CellView cell)  | 
|         {  | 
|             Text _text = cell.GetComponentInChildren<Text>();  | 
|             _text.text = model.passEquipGetWayTxts[cell.index];  | 
|         }  | 
|   | 
|         private void OnGetWayBtn()  | 
|         {  | 
|             scrollerController.Refresh();  | 
|             if (model.passEquipGetWays.ContainsKey(presentSltEquipIndex))  | 
|             {  | 
|                 int[] intarray = model.passEquipGetWays[presentSltEquipIndex];  | 
|                 foreach (var key in intarray)  | 
|                 {  | 
|                     scrollerController.AddCell(ScrollerDataType.Header, key, OnClickFunc);  | 
|                 }  | 
|             }  | 
|             scrollerController.Restart();  | 
|             m_ContainerGetWay.SetActive(true);  | 
|         }  | 
|   | 
|         void ImmediatelyUnlock()  | 
|         {  | 
|             if (model.taskHoleDict.ContainsKey(presentSltEquipIndex))  | 
|             {  | 
|                 var taskId = model.taskHoleDict[presentSltEquipIndex];  | 
|                 task.TaskMove(taskId);  | 
|             }  | 
|         }  | 
|   | 
|         private void OnClickFunc(CellView cell)  | 
|         {  | 
|             WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)cell.index);  | 
|         }  | 
|   | 
|         private void SetEquipHoleSelect(int _index)  | 
|         {  | 
|             if (presentSltEquipIndex != -1)  | 
|             {  | 
|                 equipPassSkills[presentSltEquipIndex].skillData.m_SelectImg.SetActive(false);  | 
|             }  | 
|             presentSltEquipIndex = _index;  | 
|             if (_index == -1)  | 
|             {  | 
|                 return;  | 
|             }  | 
|             equipPassSkills[_index].skillData.m_SelectImg.SetActive(true);  | 
|             if (equipPassSkills[_index].skillData.skillId != 0)  | 
|             {  | 
|                 model.presentSltSkillID = equipPassSkills[_index].skillData.skillId;  | 
|                 flipScroll.RefreshActive();  | 
|                 OnUpdateSltSkillInfo();  | 
|             }  | 
|             //else  | 
|             //{  | 
|             //    equipPassSkills[_index].skillData.m_SelectImg.SetActive(false);  | 
|             //}  | 
|         }  | 
|   | 
|         private int GetEquipHoleIndex(int _skillId)  | 
|         {  | 
|             for (int i = 0; i < equipPassSkills.Count; i++)  | 
|             {  | 
|                 if (equipPassSkills[i].skillData.skillId == _skillId)  | 
|                 {  | 
|                     return i;  | 
|                 }  | 
|             }  | 
|             return -1;  | 
|         }  | 
|     }  | 
| }  | 
|   | 
|   | 
|   | 
|   |