local UIHeroIllustratedLevelUpTip = UIViewClass() ---------------------------------------------- 系统函数 ---------------------------------------------------------- function UIHeroIllustratedLevelUpTip:OnOpened(context) local oldCfg = context.oldLevelCfg local newCfg = context.newLevelCfg UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS["IDS_Handbook_Hero_LevelUp_Title"]) UIUtils.SetLabel(self.group_illustratedHandbook.txt_Before, string.FormatByIdsId(Const_IDS[oldCfg and oldCfg.Title or newCfg.Title], oldCfg and oldCfg.LevelID or 0, oldCfg and oldCfg.NeedScore or 0)) UIUtils.SetLabel(self.group_illustratedHandbook.txt_After, string.FormatByIdsId(Const_IDS[newCfg.Title], newCfg.LevelID, newCfg.NeedScore)) local group_Attrs = self.group_illustratedHandbook.group_Attrs --属性数量是动态变化的,所以先隐藏所有 for i=1,#group_Attrs do UIUtils.SetActive(group_Attrs[i].gameObject,false) end for i, v in ipairs (newCfg.Attr_Table) do local go = group_Attrs[i] UIUtils.SetActive(go.gameObject,true) local attrData = DataSheetManager.AttrData:GetDataByID(newCfg.Attr_Table[i].AttrType) UIUtils.SetLabelText(go.txt_Attr, Const_IDS[attrData.Name]) UTL.Item.SetAtlasSprite(go.img_AttrIcon,"UI_Common", attrData.Icon) if context.type == LuaConst.PictorialType.Hero then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.HeroLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.HeroLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.Weapon then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.WeaponLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.WeaponLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.Horse then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.HorseLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.HorseLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.Treasure then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.TreasureLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.TreasureLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.Stratagem then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.StratagemLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.StratagemLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.GodBeast then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.GodBeastLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.GodBeastLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.Dye then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.DyeLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.DyeLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) elseif context.type == LuaConst.PictorialType.LightEffect then UIUtils.SetLabel(go.txt_NumBefore, oldCfg and MDL.EffectLibrary.GetScoreAttrByLevel(oldCfg.LevelID, newCfg.Attr_Table[i].AttrType) or 0) UIUtils.SetLabel(go.txt_NumAfter, MDL.EffectLibrary.GetScoreAttrByLevel(newCfg.LevelID, newCfg.Attr_Table[i].AttrType)) end end CTL.Sound.PlayGameSound("UI_success_upgrade") end function UIHeroIllustratedLevelUpTip:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end ------------------------------------------------------------------------------------------------------------------- return UIHeroIllustratedLevelUpTip