local UIHeroAwakenBreakInfo = UIViewClass() local LockTextColor = "888b97" function UIHeroAwakenBreakInfo:OnOpened(context) self.heroId = context.heroId if context.type == 0 then self.state_title:SetState(0) self.starLevel = MDL.HeroAwaken.GetCurStar(self.heroId) local showNumLimit = DataSheetManager.HeroAwakenStar:GetDataByHeroID_Star(self.heroId, self.starLevel).PreDevelopEffectNum for i, v in DataSheetManager.HeroAwakenStar:GetDataByHeroID_Star(self.heroId) do if v.Star ~= 0 then self.loop_HeroBreakInfo:AddData(v, 0) end if i > showNumLimit then return end end else self.state_title:SetState(1) self.starLevel = MDL.HeroAwaken.GetCurWeaponStar(self.heroId) local showNumLimit = DataSheetManager.MagicWeaponAwakenStar:GetDataByMagicWeaponID_Star(self.heroId, self.starLevel).PreDevelopEffectNum for i, v in DataSheetManager.MagicWeaponAwakenStar:GetDataByMagicWeaponID_Star(self.heroId) do if v.Star ~= 0 then self.loop_HeroBreakInfo:AddData(v, 0) end if i > showNumLimit then return end end end end function UIHeroAwakenBreakInfo:OnBackButtonPressed() self:OnButtonClicked(self.BtnClose) end function UIHeroAwakenBreakInfo:OnButtonClicked(comp) if comp == self.BtnClose or comp == self.btn_Bottom then self:CloseView() end end function UIHeroAwakenBreakInfo:OnCellInit(scrollRect, index, cellTable, data) local isUnlock = self.starLevel >= data.Star local titleText = string.FormatByIdsId(Const_IDS.IDS_HeroAwaken_Level, data.Star) cellTable.txt_CellTitle.text = isUnlock and titleText or UTL.Color.FormatTextByColor(LockTextColor, titleText) UIUtils.SetActive(cellTable.img_Locked, not isUnlock) UIUtils.SetActive(cellTable.group_Locked.gameObject, not isUnlock) UIUtils.SetActive(cellTable.group_Aptitude.gameObject, false) UIUtils.SetActive(cellTable.group_Skill, false) UIUtils.SetActive(cellTable.group_Attr.gameObject, true) cellTable.state_Txt:SetState(isUnlock and 0 or 1) local attrTable local sumCount --天资点和灵识点需要读上一行的数据 if self.context.type == 0 then attrTable = DataSheetManager.HeroAwakenStarAttrRepeat:GetDataByAttrRepeatID(data.AttrSpecial).Attr_Table local cfg = DataSheetManager.HeroAwakenStar:GetDataByHeroID_Star(self.heroId, data.Star - 1) sumCount = cfg.Talent[#cfg.Talent] else attrTable = DataSheetManager.MagicWeaponAwakenStarAttr:GetDataByAttrRepeatID(data.AttrSpecial).Attr_Table local cfg = DataSheetManager.MagicWeaponAwakenStar:GetDataByMagicWeaponID_Star(self.heroId, data.Star - 1) sumCount = cfg.SkillPoint[#cfg.SkillPoint] end for i, v in ipairs(cellTable.group_Attr) do local attrData = attrTable[i] if attrData then local attrName = DataSheetManager.AttrData:GetDataByID(attrData.AttrType).Name UIUtils.SetLabelText(v.txt_AttrName, Const_IDS[attrName]) local attrNum = "+" .. attrData.AttrNum UIUtils.SetLabel(v.txt_AttrNum, isUnlock and UTL.Color.FormatGreenColor(attrNum) or attrNum) UIUtils.SetActive(v.gameObject, true) else UIUtils.SetActive(v.gameObject, false) end end --最后一个节点显示点数 local item = cellTable.group_Attr[#cellTable.group_Attr] UIUtils.SetActive(item.gameObject, true) if self.context.type == 0 then UIUtils.SetLabelText(item.txt_AttrName, Const_IDS.IDS_HeroAwaken_TianZiSkill) else UIUtils.SetLabelText(item.txt_AttrName, Const_IDS.IDS_HeroAwaken_LingShiSkill) end UIUtils.SetLabel(item.txt_AttrNum, isUnlock and "+" .. UTL.Color.FormatGreenColor(sumCount) or sumCount) end return UIHeroAwakenBreakInfo