local UITreasureBreakDetail = UIViewClass() local LockTextColor = "888b97" function UITreasureBreakDetail:OnOpened(context) UIUtils.SetLabelText(self.Lab_Top, Const_IDS.IDS_Treasure_Star_1) local treasureId = context.treasureId self.onlyShowSkill = context.onlyShowSkill local activeInfo = MDL.Treasure.GetTreasureInfo(treasureId) self.starLevel = activeInfo and activeInfo.TreasureInfo.starLevel or 0 local showNumLimit = DataSheetManager.TreasureStar:GetDataByTreasureID_Star(treasureId, self.starLevel).PreDevelopEffectNum for i, v in DataSheetManager.TreasureStar:GetDataByTreasureID_Star(treasureId) do if v.StarType == 0 and string.isNilOrEmpty(v.StarText)then break end if i <= showNumLimit then if not self.onlyShowSkill or (self.onlyShowSkill and (v.StarType == LuaConst.UIBreakStarType.Skill or v.StarType == LuaConst.UIBreakStarType.Both)) then self.loop_DetailInfo:AddData(v, 2) end end end end function UITreasureBreakDetail:OnBackButtonPressed() self:OnButtonClicked(self.BtnClose) end function UITreasureBreakDetail:OnButtonClicked(comp) if comp == self.BtnClose or comp == self.btn_Bottom then self:CloseView() end end function UITreasureBreakDetail:OnCellInit(scrollRect, index, cellTable, data) local isUnlock = self.starLevel >= (data.Star + 1) local titleText = string.FormatByIdsId(Const_IDS.IDS_HeroStarLevel, (data.Star + 1)) UIUtils.SetLabel(cellTable.txt_CellTitle, isUnlock and titleText or UTL.Color.FormatTextByColor(LockTextColor, titleText)) UIUtils.SetActive(cellTable.group_Skill.gameObject, false) UIUtils.SetActive(cellTable.group_Attr.gameObject, false) if data.StarType == LuaConst.UIBreakStarType.Skill then UIUtils.SetActive(cellTable.group_Skill.gameObject, true) local skillText local skillData = DataSheetManager.TreasureSkillData:GetDataByTreasureSkill(data.TreasureSkill) if self.onlyShowSkill then skillText = UTL.String.FormatCombineTextByID(skillData.TreasureSkillDes) else skillText = UTL.String.FormatCombineTextByID(data.StarText) end if isUnlock then skillText = UTL.Color.FormatWhiteColor(skillText) else skillText = UTL.Color.FormatTextByColor(LockTextColor, skillText) end UIUtils.SetLabel(cellTable.txt_SkillInfo, skillText) UIUtils.SetImageByAssetBundle(cellTable.img_Skill, skillData.TreasureSkillIcon) elseif data.StarType == LuaConst.UIBreakStarType.Attrs then UIUtils.SetActive(cellTable.group_Attr.gameObject, true) if isUnlock then local attrText = CTL.Treasure.GetTreasureBreakAttrTextList(data.TreasureID, data.Star, UTL.Color.Green) for k,v in ipairs(cellTable.group_Attr) do UIUtils.SetLabel(v, UTL.Color.FormatWhiteColor(attrText[k])) end else local attrText = CTL.Treasure.GetTreasureBreakAttrTextList(data.TreasureID, data.Star, LockTextColor) for k,v in ipairs(cellTable.group_Attr) do UIUtils.SetLabel(v, UTL.Color.FormatTextByColor(LockTextColor, attrText[k])) end end elseif data.StarType == LuaConst.UIBreakStarType.Both then UIUtils.SetActive(cellTable.group_Attr.gameObject, not self.onlyShowSkill) UIUtils.SetActive(cellTable.group_Skill.gameObject, true) local skillText local skillData = DataSheetManager.TreasureSkillData:GetDataByTreasureSkill(data.TreasureSkill) if self.onlyShowSkill then skillText = UTL.String.FormatCombineTextByID(skillData.TreasureSkillDes) else skillText = UTL.String.FormatCombineTextByID(data.StarText) end if isUnlock then skillText = UTL.Color.FormatWhiteColor(skillText) local attrText = CTL.Treasure.GetTreasureBreakAttrTextList(data.TreasureID, data.Star, UTL.Color.Green) for k,v in ipairs(cellTable.group_Attr) do UIUtils.SetLabel(v, UTL.Color.FormatWhiteColor(attrText[k])) end else skillText = UTL.Color.FormatTextByColor(LockTextColor, skillText) local attrText = CTL.Treasure.GetTreasureBreakAttrTextList(data.TreasureID, data.Star, LockTextColor) for k,v in ipairs(cellTable.group_Attr) do UIUtils.SetLabel(v, UTL.Color.FormatTextByColor(LockTextColor, attrText[k])) end end UIUtils.SetLabel(cellTable.txt_SkillInfo, skillText) UIUtils.SetImageByAssetBundle(cellTable.img_Skill, skillData.TreasureSkillIcon) -- 宝物羁绊技能描述状态 local relationState = CTL.Treasure.GetTreasureHeroRelationState(data.TreasureID, MDL.Treasure.GetTreasureEquipHeroId(data.TreasureID)) UIUtils.SetActive(cellTable.group_Fetter, relationState > CTL.Treasure.RelationState.NoRelation) local isActiveRelation = relationState == CTL.Treasure.RelationState.ActiveRelation if relationState > CTL.Treasure.RelationState.NoRelation then -- 有羁绊技能 local relationSkillDesc = CTL.Treasure.GetRelationSkillDesc(data.TreasureID, data.Star + 1) UIUtils.SetLabel(cellTable.txt_SkillRelationDes, relationSkillDesc) if not isActiveRelation or not isUnlock then UIUtils.SetActive(cellTable.img_Active, false) UIUtils.SetActive(cellTable.img_Lock, true) else UIUtils.SetActive(cellTable.img_Active, true) UIUtils.SetActive(cellTable.img_Lock, false) end cellTable.state_DesFetter:SetState(isUnlock and 1 or 0) else UIUtils.SetActive(cellTable.group_Fetter, false) end end UIUtils.SetActive(cellTable.img_Locked, not isUnlock) UIUtils.SetActive(cellTable.img_SkillLocked, not isUnlock) end return UITreasureBreakDetail