--[[ 神兽图鉴弹窗 ]]-- local UIGodBeastIllustratedPopUp = UIViewClass() local GRAY_COLOR = "93969c" function UIGodBeastIllustratedPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_Illustration_GodBeastLibrary_RefreshPopUp, self.RefreshPanel) self.config = context self:RefreshPanel() end function UIGodBeastIllustratedPopUp:RefreshPanel(isPlayEft) UIUtils.SetActive(self.group_HeroCard.gameObject,false) UIUtils.SetActive(self.group_WeaponCard.gameObject,false) UIUtils.SetActive(self.group_TreasureHorseCard.gameObject,true) UIUtils.SetActive(self.group_LightEffectSuitCard.gameObject, false) UTL.Color.SetQualityImageByType(self.group_TreasureHorseCard.img_Quality, self.config.GodBeastQuality, UTL.Color.QualityType.Pictorial) UIUtils.SetActive(self.group_TreasureHorseCard.Treasure,false) UIUtils.SetActive(self.group_TreasureHorseCard.lightEffectPictorial, false) UIUtils.SetActive(self.group_TreasureHorseCard.Horse,true) UIUtils.SetImageByAssetBundle(self.group_TreasureHorseCard.Horse, self.config.GodBeastPicture) if isPlayEft then self.group_TreasureHorseCard.effect_Light:PlayUIEffect() end local isCanUpdate = MDL.GodBeastLibrary.CanUnlockOrUpdate(self.config.ID) local beastLibraryLevel = MDL.GodBeastLibrary.GetGodBeastLevel(self.config.ID) local isCurCfgOk, curCfg = DataSheetManager.GodBeastPictorialType:TryGetDataByGodBeastPictorialTypeID_PictorialLevel(self.config.PictorialID, beastLibraryLevel) local ok, nextCfg = DataSheetManager.GodBeastPictorialType:TryGetDataByGodBeastPictorialTypeID_PictorialLevel(self.config.PictorialID, beastLibraryLevel + 1) if not ok then UIUtils.SetLabelText(self.txt_Condition, Const_IDS["IDS_Handbook_Hero_LevelUp_Max"]) self.UIStateCondition:SetState(2) else self.UIStateCondition:SetState(isCanUpdate and 0 or 1) if beastLibraryLevel == -1 then UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_GodBeast_ActivateCondition_Tip"], UIUtils.GetLocalizedTxt(Const_IDS[self.config.GodBeastName]))) else UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_GodBeast_LevelUp_Tip"], nextCfg.StarLevel)) end end UIUtils.SetLabelText(self.txt_HeroScoreTitle,Const_IDS.IDS_Handbook_GodBeast_GodBeastScore) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_Name, beastLibraryLevel == -1 and UTL.Color.FormatTextByColor(GRAY_COLOR, UIUtils.GetLocalizedTxt(Const_IDS[self.config.GodBeastName])) or UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[self.config.GodBeastName]), self.config.GodBeastQuality)) UIUtils.SetLabelText(self.txt_ConditionTitle, beastLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_ActivateCondition"] or Const_IDS["IDS_GuildCultivation_LevelUpHint"]) UIUtils.SetLabel(self.txt_NumBefore, isCurCfgOk and curCfg.Score or 0) UIUtils.SetLabel(self.txt_NumAfter, nextCfg and nextCfg.Score or curCfg.Score) UIUtils.SetActive(self.img_NumberIcon, nextCfg ~= nil) UIUtils.SetActive(self.txt_NumAfter, nextCfg ~= nil) UIUtils.SetGray(self.group_TreasureHorseCard.img_Quality, beastLibraryLevel == -1) UIUtils.SetGray(self.group_TreasureHorseCard.Treasure, beastLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.img_Gray, beastLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.group_Lv, beastLibraryLevel > -1) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_LibraryLv, string.FormatByIdsId(Const_IDS["IDS_Handbook_Hero_LevelNum"], beastLibraryLevel)) --属性数量是动态变化的,所以先隐藏所有 for i=1,#self.group_Attr do UIUtils.SetActive(self.group_Attr[i].gameObject,false) end local showCfg = curCfg or nextCfg for i, v in ipairs (showCfg.Attr_Table) do UIUtils.SetActive(self.group_Attr[i].gameObject,true) local attrCfg = DataSheetManager.AttrData:GetDataByID(v.AttrType) local groupAttr = self.group_Attr[i] UIUtils.SetLabelText(groupAttr.txt_Attr, Const_IDS[attrCfg.Name]) UTL.Item.SetAtlasSprite(groupAttr.img_AttrIcon,"UI_Common", attrCfg.Icon) UIUtils.SetLabel(groupAttr.txt_NumBefore, curCfg and curCfg.Attr_Table[i].AttrNum or 0) UIUtils.SetLabel(groupAttr.txt_NumAfter, nextCfg and nextCfg.Attr_Table[i].AttrNum or curCfg.Attr_Table[i].AttrNum) UIUtils.SetActive(groupAttr.img_Icon, nextCfg ~= nil) UIUtils.SetActive(groupAttr.txt_NumAfter, nextCfg ~= nil) end self.btn_Interactive:SetGray(not isCanUpdate, true) UIUtils.SetActive(self.btn_Interactive, nextCfg ~= nil) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, beastLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Title"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Title"]) UIUtils.SetLabelText(self.txt_Btn, beastLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Button"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Button"]) end function UIGodBeastIllustratedPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGodBeastIllustratedPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Interactive then local isCanUpdate = MDL.GodBeastLibrary.CanUnlockOrUpdate(self.config.ID) if not isCanUpdate then local treasureLibraryLevel = MDL.GodBeastLibrary.GetGodBeastLevel(self.config.ID) if treasureLibraryLevel == -1 then CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_GodBeast_Activate_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.config.GodBeastName]))) else CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_GodBeast_LevelUp_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.config.GodBeastName]))) end return end MDL.GodBeastLibrary.RequestUpdateLevel(self.config.ID) end end return UIGodBeastIllustratedPopUp