local UIEquipStarAttrPreview = UIViewClass() function UIEquipStarAttrPreview:OnOpened(context) local isAdd = {} for i, v in DataSheetManager.EquipStarStage:GetEnumerator() do if not isAdd[v.EquipSkillLibID] then self.loop_Tab:AddData(v, 0) isAdd[v.EquipSkillLibID] = true end end self:SelectIndex(context.heroId, context.isShowNext) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_EquipStar_Tittle11) end function UIEquipStarAttrPreview:SelectIndex(heroId, isShowNext) local heroInfo = MDL.HeroSelect.GetHeroInfo(heroId) local skillStage = nil local _, skillData = DataSheetManager.EquipSkillLib:TryGetDataByEquipSkillID(heroInfo.equipStarSkillId) if skillData then for i, v in DataSheetManager.EquipStarStage:GetEnumerator() do if isShowNext and skillData.EquipSkillLibID < v.EquipSkillLibID or (not isShowNext and skillData.EquipSkillLibID == v.EquipSkillLibID) then skillStage = v break end end if skillStage then self.loop_Tab:SelectIndex(skillStage.EquipSkillLibID - 1) else self.loop_Tab:SelectIndex(self.loop_Tab.Count - 1) end else self.loop_Tab:SelectIndex(0) end end function UIEquipStarAttrPreview:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIEquipStarAttrPreview:OnCellSelect(scrollRect, index, cellTable, data) if scrollRect == self.loop_Tab then self.loop_AttrPreview:ClearCells() for i, v in DataSheetManager.EquipSkillLib:GetEnumerator() do if v.EquipSkillLibID == data.EquipSkillLibID then self.loop_AttrPreview:AddData(v, 0) end end end end function UIEquipStarAttrPreview:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Tab then UIUtils.SetActive(cellTable.group_Selected, false) UIUtils.SetActive(cellTable.group_UnSelected, false) cellTable.txt_Num.text = data.LibStarLevel UIUtils.SetImageByAssetBundle(cellTable.img_Star, data.Icon) else UIUtils.SetLabelText(cellTable.txt_AttrInfo, Const_IDS[data.EquipSkillDes]) UIUtils.SetImageByAssetBundle(cellTable.img_AttrLevel, data.SkillLevelIcon) end end return UIEquipStarAttrPreview