local UIHorseSoulBreakSuccess = UIViewClass() function UIHorseSoulBreakSuccess:OnOpened(context) local horseSoulSuitID = context.suitID local horseSoulSkillLevel = context.skillLevel local oldSkillLevel = context.oldSkillLevel if horseSoulSkillLevel > 1 then self:InitBreak(horseSoulSuitID, horseSoulSkillLevel, oldSkillLevel) else self:InitActive(horseSoulSuitID, horseSoulSkillLevel) end end function UIHorseSoulBreakSuccess:InitActive(horseSoulSuitID, horseSoulSkillLevel) local newData = DataSheetManager.HorseSoulSuitData:GetDataByHorseSoulSuitID_HorseSoulSkillLevel(horseSoulSuitID, 1) UIUtils.SetLabelText(self.txt_TalentName, Const_IDS[newData.HorseSoulSkillName]) UIUtils.SetImageByAssetBundle(self.img_SoulSkill, newData.HorseSoulSkillIcon) self.txt_SkillDesc.text = UTL.String.FormatCombineTextByID(newData.HorseSoulSkillDes) UIUtils.SetActive(self.img_Line, false) UIUtils.SetActive(self.group_Type, false) UIUtils.SetActive(self.loop_SoulSkill, false) UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseSoul_PopoutHint1) end function UIHorseSoulBreakSuccess:InitBreak(horseSoulSuitID, horseSoulSkillLevel, oldSkillLevel) local newData = DataSheetManager.HorseSoulSuitData:GetDataByHorseSoulSuitID_HorseSoulSkillLevel(horseSoulSuitID, horseSoulSkillLevel) self.txt_Last.text = string.FormatByIdsId(Const_IDS.IDS_BreakThrough_Lv, oldSkillLevel) self.txt_Now.text = string.FormatByIdsId(Const_IDS.IDS_BreakThrough_Lv, horseSoulSkillLevel) UIUtils.SetLabelText(self.txt_TalentName, Const_IDS[newData.HorseSoulSkillName]) UIUtils.SetImageByAssetBundle(self.img_SoulSkill, newData.HorseSoulSkillIcon) self.oldSkillLevel = oldSkillLevel if oldSkillLevel == 1 then for i = oldSkillLevel + 1, horseSoulSkillLevel do local data = DataSheetManager.HorseSoulSuitData:GetDataByHorseSoulSuitID_HorseSoulSkillLevel(horseSoulSuitID, i) self.loop_SoulSkill:AddData(data, 0) end else for i = 2, horseSoulSkillLevel do local data = DataSheetManager.HorseSoulSuitData:GetDataByHorseSoulSuitID_HorseSoulSkillLevel(horseSoulSuitID, i) self.loop_SoulSkill:AddData(data, 0) end end self.loop_SoulSkill:MoveEnd() local firstLevelData = DataSheetManager.HorseSoulSuitData:GetDataByHorseSoulSuitID_HorseSoulSkillLevel(horseSoulSuitID, 1) self.txt_SkillDesc.text = UTL.String.FormatCombineTextByID(firstLevelData.HorseSoulSkillDes) UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseSoul_PopoutHint2) UIUtils.SetActive(self.img_Line, true) UIUtils.SetActive(self.loop_SoulSkill, true) end function UIHorseSoulBreakSuccess:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end function UIHorseSoulBreakSuccess:OnCellInit(scrollRect, index, cellTable, data) cellTable.txt_Talent.text = UTL.String.FormatCombineTextByID(data.HorseSoulSkillDes) cellTable.txt_Level.text = string.FormatByIdsId(Const_IDS.IDS_BreakThrough_Lv, data.HorseSoulSkillLevel) if self.oldSkillLevel < data.HorseSoulSkillLevel then UIUtils.SetActive(cellTable.img_New, true) cellTable.state_Talent:SetState(1) else UIUtils.SetActive(cellTable.img_New, false) cellTable.state_Talent:SetState(0) end end return UIHorseSoulBreakSuccess