local UIHeroAdvancedTips = UIViewClass() local AttrTipsKey = "AdvancedAttrTipsKey" function UIHeroAdvancedTips:OnOpened(context) self.tipsList = {} if context.heroId then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_HeroAdvanceTip2) local lastAdvanceId = MDL.Advanced.GetHeroAdvancedInfo(context.heroId) for i, v in ipairs(MDL.Advanced.GetLevelUpAttrTableById(context.heroId, lastAdvanceId)) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.LvupType).Name]).."+"..v.LvupNum self:AddAttrTips(attrStr) end elseif context.materialIndex then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_HeroAdvanceTip1) local attrTable = self:DealWithMultiMaterialAttr(context.materialIndex) for type, num in pairs(attrTable) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(type).Name]).."+"..num self:AddAttrTips(attrStr) end elseif context.isWeapon then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_MagicWeapon_SmallActivation) local attrData = DataSheetManager.MagicWeaponAttrRepeat:GetDataByAttrRepeatID(context.attr) for i, v in ipairs(attrData.Attr_Table) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.AttrType).Name]).."+"..v.AttrNum self:AddAttrTips(attrStr) end elseif context.isWeaponBreak then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_MagicWeapon_SmallStar) local attrData = DataSheetManager.MagicWeaponStarAttr:GetDataByAttrRepeatID(context.attr) for i, v in ipairs(attrData.Attr_Table) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.AttrType).Name]).."+"..v.AttrNum self:AddAttrTips(attrStr) end elseif context.isNobility then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_MagicWeapon_SmallStar) for i, v in ipairs(MDL.Nobility.GetAttribute(context.stage)) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.AttrType).Name]).."+"..v.AttrNum self:AddAttrTips(attrStr) end elseif context.isInlayGem then for k,v in pairs(context.attr) do self:AddAttrTips(k..v) end elseif context.isStratagem then UIUtils.SetLabelText(self.lab_TipsTitle, Const_IDS.IDS_Stratagem_LearnSucceed) for i, v in ipairs(context.attr) do local attrStr = UIUtils.GetLocalizedTxt(Const_IDS[DataSheetManager.AttrData:GetDataByID(v.AttrType).Name]).."+"..v.AttrNum self:AddAttrTips(attrStr) end end self:StartRepeatFunc(self.OnUpdateFun, 2) self:SetPushStyle(LuaConst.PushStyleEnum.CLOSENOTRECOVER) end function UIHeroAdvancedTips:DealWithMultiMaterialAttr(indexTable) local attrTable = {} local heroId = MDL.HeroSelect.curSelectHeroID local advanceId = MDL.Advanced.GetHeroAdvancedInfo(heroId) for i, v in ipairs(indexTable) do local attrList = MDL.Advanced.GetMaterialAttrTableById(heroId, advanceId, v + 1) for j, t in ipairs(attrList) do if attrTable[t.AttrType] then attrTable[t.AttrType] = attrTable[t.AttrType] + t.AttrNum else attrTable[t.AttrType] = t.AttrNum end end end return attrTable end function UIHeroAdvancedTips:OnUpdateFun(deltaTime, timeSinceUpdate) self:StopRepeatFunc(self.OnUpdateFun) self:CloseView() end function UIHeroAdvancedTips:AddAttrTips(attrStr) self:InstantiateCollection(self.group_HeroAdvancedTipsInfo, self.connect.gameObject) self.group_HeroAdvancedTipsInfo[#self.group_HeroAdvancedTipsInfo].gameObject:SetActive(true) UIUtils.SetLabel(self.group_HeroAdvancedTipsInfo[#self.group_HeroAdvancedTipsInfo].txt_Tips, attrStr) end return UIHeroAdvancedTips