local UITreasureIllustratedPopUp = UIViewClass() local GRAY_COLOR = "93969c" ---------------------------------------------- 系统函数 ---------------------------------------------------------- function UITreasureIllustratedPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_Illustration_TreasureLibrary_RefreshPopUp, self.RefreshPanel) self.treasureData = context self:RefreshPanel() end function UITreasureIllustratedPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UITreasureIllustratedPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Interactive then local isCanUpdate = MDL.TreasureLibrary.IsTreasureCanUpdate(self.treasureData.TreasureID) if not isCanUpdate then local treasureLibraryLevel = MDL.TreasureLibrary.GetTreasureLevel(self.treasureData.TreasureID) if treasureLibraryLevel == -1 then CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_Treasure_Activate_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.treasureData.TreasureName]))) else CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_Treasure_LevelUp_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.treasureData.TreasureName]))) end return end MDL.TreasureLibrary.RequestUpdateLevel(self.treasureData.TreasureID) end end ------------------------------------------------------------------------------------------------------------------- function UITreasureIllustratedPopUp: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.treasureData.TreasureQuality, UTL.Color.QualityType.Pictorial) UIUtils.SetActive(self.group_TreasureHorseCard.Treasure,true) UIUtils.SetActive(self.group_TreasureHorseCard.lightEffectPictorial, false) UIUtils.SetActive(self.group_TreasureHorseCard.Horse,false) UIUtils.SetImageByAssetBundle(self.group_TreasureHorseCard.Treasure, self.treasureData.TreasurePicture) self.group_TreasureHorseCard.Treasure:SetNativeSize() if isPlayEft then self.group_TreasureHorseCard.effect_Light:PlayUIEffect() end local isCanUpdate = MDL.TreasureLibrary.IsTreasureCanUpdate(self.treasureData.TreasureID) local treasureLibraryLevel = MDL.TreasureLibrary.GetTreasureLevel(self.treasureData.TreasureID) local curCfg = treasureLibraryLevel>=0 and DataSheetManager.TreasurePictorialType:GetDataByTreasurePictorialTypeID_PictorialLevel(self.treasureData.TreasurePictorialType, treasureLibraryLevel) or nil local __, nextCfg = DataSheetManager.TreasurePictorialType:TryGetDataByTreasurePictorialTypeID_PictorialLevel(self.treasureData.TreasurePictorialType, treasureLibraryLevel + 1) if not nextCfg 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 treasureLibraryLevel == -1 then UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_Treasure_ActivateCondition_Tip"], UIUtils.GetLocalizedTxt(Const_IDS[self.treasureData.TreasureName]))) else UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_Treasure_LevelUp_Tip"], nextCfg.StarLevel)) end end UIUtils.SetLabelText(self.txt_HeroScoreTitle,Const_IDS.IDS_Handbook_Treasure_TreasureScore) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_Name, treasureLibraryLevel == -1 and UTL.Color.FormatTextByColor(GRAY_COLOR, UIUtils.GetLocalizedTxt(Const_IDS[self.treasureData.TreasureName])) or UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[self.treasureData.TreasureName]), self.treasureData.TreasureQuality)) UIUtils.SetLabelText(self.txt_ConditionTitle, treasureLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_ActivateCondition"] or Const_IDS["IDS_GuildCultivation_LevelUpHint"]) UIUtils.SetLabel(self.txt_NumBefore, curCfg 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, treasureLibraryLevel == -1) UIUtils.SetGray(self.group_TreasureHorseCard.Treasure, treasureLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.img_Gray, treasureLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.group_Lv, treasureLibraryLevel > -1) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_LibraryLv, string.FormatByIdsId(Const_IDS["IDS_Handbook_Hero_LevelNum"], treasureLibraryLevel)) --属性数量是动态变化的,所以先隐藏所有 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, treasureLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Title"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Title"]) UIUtils.SetLabelText(self.txt_Btn, treasureLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Button"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Button"]) end return UITreasureIllustratedPopUp