local UIDyeIllustratedPopUp = UIViewClass() function UIDyeIllustratedPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_Illustration_DyeLibrary_RefreshPopUp, self.RefreshPanel) self.dyeData = context self.suitList = {} for i, v in ipairs(self.dyeData.SuitList) do local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(v) if suitCfg.Quality < CTL.DyeAppearance.SuitQuality_Middle then table.insert(self.suitList, v) end end self:RefreshPanel() end function UIDyeIllustratedPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIDyeIllustratedPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIDyeIllustratedPopUp:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Interactive then local canActive = MDL.DyeLibrary.IsSuitCanUpdate(data) if canActive then MDL.DyeLibrary.RequestUpdateLevel(data) else local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(data) CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_CollectionHandbook_Tip20, UIUtils.GetLocalizedTxt(Const_IDS[suitCfg.Name]))) end end end function UIDyeIllustratedPopUp:OnCellInit(scrollRect, index, cellTable, data) local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(data) UTL.Color.SetQualityImageByType(cellTable.img_Quality, 6, UTL.Color.QualityType.Pictorial) UIUtils.SetImageByAssetBundle(cellTable.img_Hero, suitCfg.SuitImage) local isActive = MDL.DyeAppearance.IsSuitActiveInDyeLibrary(suitCfg.ApperanceID, data) UIUtils.SetActive(cellTable.img_Gray, isActive == false) UIUtils.SetActive(cellTable.btn_Interactive, isActive == false) local canActive = MDL.DyeLibrary.IsSuitCanUpdate(data) cellTable.btn_Interactive:SetGray(canActive == false, true) cellTable.btn_Interactive:SetRedPoint(canActive) UIUtils.SetLabelText(cellTable.txt_Name, Const_IDS[suitCfg.Name]) for i, v in ipairs(suitCfg.PartList) do local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(v, i, suitCfg.ApperanceID) local isActive = MDL.DyeAppearance.IsColorActive(suitCfg.ApperanceID, i, v) CTL.DyeAppearance.SetColorItemTemplate(cellTable.group_Color[i], colorCfg, false, false, isActive == false) end end function UIDyeIllustratedPopUp:RefreshPanel() local dyeLevel = MDL.DyeLibrary.GetDyeLevel(self.dyeData.ID) local curCfg = dyeLevel > 0 and DataSheetManager.PhantomPictorialType:GetDataByPhantomPictorialTypeID_PictorialLevel(self.dyeData.PhantomPictorial, dyeLevel) or nil local __, nextCfg = DataSheetManager.PhantomPictorialType:TryGetDataByPhantomPictorialTypeID_PictorialLevel(self.dyeData.PhantomPictorial, dyeLevel + 1) 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) --属性数量是动态变化的,所以先隐藏所有 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 UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, dyeLevel == 0 and Const_IDS["IDS_Handbook_Hero_Activate_Title"] or Const_IDS["IDS_Handbook_Hero_LevelUp_Title"]) self.loop_HeroCard:ReloadAll(self.suitList) end return UIDyeIllustratedPopUp