local UIHorseIllustratedPopUp = UIViewClass() local GRAY_COLOR = "93969c" ---------------------------------------------- 系统函数 ---------------------------------------------------------- function UIHorseIllustratedPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_Illustration_HorseLibrary_RefreshPopUp, self.RefreshPanel) self.horseData = context self:RefreshPanel() end function UIHorseIllustratedPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIHorseIllustratedPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Interactive then local isCanUpdate = MDL.HorseLibrary.IsHorseCanUpdate(self.horseData.HorseID) if not isCanUpdate then local heroLibraryLevel = MDL.HorseLibrary.GetHorseLevel(self.horseData.HorseID) if heroLibraryLevel == -1 then CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_Horse_Activate_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.horseData.HorseName]))) else CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_Handbook_Horse_LevelUp_NoCondition"], UIUtils.GetLocalizedTxt(Const_IDS[self.horseData.HorseName]))) end return end MDL.HorseLibrary.RequestUpdateLevel(self.horseData.HorseID) end end ------------------------------------------------------------------------------------------------------------------- function UIHorseIllustratedPopUp: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.horseData.HorseQuality, 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.horseData.HorsePicture) if isPlayEft then self.group_TreasureHorseCard.effect_Light:PlayUIEffect() end local isCanUpdate = MDL.HorseLibrary.IsHorseCanUpdate(self.horseData.HorseID) local horseLibraryLevel = MDL.HorseLibrary.GetHorseLevel(self.horseData.HorseID) local curCfg = horseLibraryLevel>=0 and DataSheetManager.HorsePictorialType:GetDataByHorsePictorialTypeID_PictorialLevel(self.horseData.HorsePrictorialType, horseLibraryLevel) or nil local __, nextCfg = DataSheetManager.HorsePictorialType:TryGetDataByHorsePictorialTypeID_PictorialLevel(self.horseData.HorsePrictorialType, horseLibraryLevel + 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 horseLibraryLevel == -1 then UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_Horse_ActivateCondition_Tip"], UIUtils.GetLocalizedTxt(Const_IDS[self.horseData.HorseName]))) else UIUtils.SetLabel(self.txt_Condition, string.FormatByIdsId(Const_IDS["IDS_Handbook_Horse_LevelUp_Tip"], nextCfg.StarLevel)) end end UIUtils.SetLabelText(self.txt_HeroScoreTitle,Const_IDS.IDS_Handbook_Horse_HorseScore) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_Name, horseLibraryLevel == -1 and UTL.Color.FormatTextByColor(GRAY_COLOR, UIUtils.GetLocalizedTxt(Const_IDS[self.horseData.HorseName])) or UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[self.horseData.HorseName]), self.horseData.HorseQuality)) UIUtils.SetLabelText(self.txt_ConditionTitle, horseLibraryLevel == -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, horseLibraryLevel == -1) UIUtils.SetGray(self.group_TreasureHorseCard.Horse, horseLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.img_Gray, horseLibraryLevel == -1) UIUtils.SetActive(self.group_TreasureHorseCard.group_Lv, horseLibraryLevel > -1) UIUtils.SetLabel(self.group_TreasureHorseCard.txt_LibraryLv, string.FormatByIdsId(Const_IDS["IDS_Handbook_Hero_LevelNum"], horseLibraryLevel)) --属性数量是动态变化的,所以先隐藏所有 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, horseLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Title"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Title"]) UIUtils.SetLabelText(self.txt_Btn, horseLibraryLevel == -1 and Const_IDS["IDS_Handbook_Hero_Activate_Button"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Button"]) end return UIHorseIllustratedPopUp