/// <summary> /// 更新指定技能ID的信息,技能列表中,技能索引减1即列表索引; /// </summary> /// <param name="skillId">Skill identifier.</param> void UpdateSkillInfo(int skillId) { if (!MySkillModule.IsLegalSkillID(skillId)) { return; } // if(skillId > skillsList.Count || skillId < 1) // return; SkillItemUI item = skillsList[skillId - 1] as SkillItemUI; if (item == null) { return; } int skillLv = MySkillModule.GetSkillLvBySkillID(skillId); bool canOpen = MySkillModule.canOpen(skillId); if (skillLv == 0 && !canOpen)//锁定状态; { item.SLockType = SkillLockType.Locked; item.IsShowEquiSlotNum = false; item.IsShowLv = false; int openLv = MySkillModule.GetSkillUnlockLvByID(skillId); item.SetShowHint(openLv.ToString() + "级解锁"); return; } else if (skillLv == 0 && canOpen)//可解锁状态; { item.SLockType = SkillLockType.Opened; item.IsShowEquiSlotNum = false; item.IsShowLv = false; item.SetShowHint("可解锁"); return; } else { item.SLockType = SkillLockType.UnLocked; item.SetShowLevel(skillLv); item.IsShowHint = false; int slotIdx = -1; if (MySkillModule.GetSlotIdxBySkillID(skillId, ref slotIdx)) { item.IsShowEquiSlotNum = true; item.SetShowEquipNum(slotIdx + 1); } else { item.IsShowEquiSlotNum = false; } } }
void SetEquipSlotAniActive(int skillID) { int idx = 0; bool isShow = !MySkillModule.GetSlotIdxBySkillID(skillID, ref idx); for (int i = 0, j = mEquiAnis.Length; i < j; i++) { if (isShow) { mEquiAnis[i].Reset(); } mEquiAnis[i].gameObject.SetActive(isShow); } }
/// <summary> /// 设置当前选中的技能id /// </summary> /// <param name="skillId">Skill identifier.</param> void SetSelect(int skillId) { if (skillId <= 0 || skillId > skillsList.Count) { return; } int pageNum = GetPageNumBySkillID(skillId); //打开到指定页,并将该技能ID对应的技能设置为选中状态; GoToPage(pageNum); for (int i = 0, j = skillsList.Count; i < j; i++) { skillsList[i].IsSelected = false; } skillsList[skillId - 1].IsSelected = true; for (int i = 0, j = jianTous.Length; i < j; i++) { jianTous[i].SetActive(false); } int jIdx = (skillId - 1) % mMaxShowSkillNum; jianTous[jIdx].SetActive(true); SetJianTousActive(pageNum == mCurPageNum); //如果该技能ID在技能槽中,也选中; int slotIdx = 0; for (int i = 0, j = equipSkills.Count; i < j; i++) { equipSkills[i].IsSelected = false; } if (MySkillModule.GetSlotIdxBySkillID(skillId, ref slotIdx)) { equipSkills[slotIdx].IsSelected = true; } }