--[[ 神兽列表主界面 ]]-- local UIGodBeastMainPanel = UIViewClass() function UIGodBeastMainPanel:OnOpened(context) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Godbeast) self:RegistSystemEvent(EventID.UI_GodBeastRefresh, self.RefreshLoopScroll) self:RefreshLoopScroll() end function UIGodBeastMainPanel:RefreshLoopScroll() self.loop_MythicalAnimals:ReloadAll(MDL.GodBeast.GetSortedList()) end function UIGodBeastMainPanel:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIGodBeastMainPanel:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.GodBeast }) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() end end function UIGodBeastMainPanel:OnCellInit(scrollRect, index, cellTable, data) -- 图片 UIUtils.SetImageByAssetBundle(cellTable.img_MythicalAnimals, data.GodBeastPicture) -- 上阵标 UIUtils.SetActive(cellTable.img_Equipment.gameObject, MDL.GodBeast.IsBeastInLineup(data.ID)) -- 名字 CTL.GodBeast.SetGodBeastName(cellTable.lab_MythicalAnimalsName, data.ID) UTL.Color.SetQualityImageByType(cellTable.img_MythicalAnimalsQualityBg, data.GodBeastQuality, UTL.Color.QualityType.GodBeastFrame) local activeBeastInfo = MDL.GodBeast.GetGodBeastInfoByID(data.ID) local haveCount = MDL.Bag.GetItemCount(data.Item_Table[1].ItemID) local activeCount = data.Item_Table[1].ItemNum cellTable.effect_MythicalAnimalsQuality:StopUIEffect() UTL.Color.PlayQualityEffect(cellTable.effect_MythicalAnimalsQuality, data.GodBeastColorEffect, UTL.Color.EffectType.Main) if activeBeastInfo then -- 激活标签 UIUtils.SetActive(cellTable.img_Mask, false) cellTable.UIEffect_Activated:StopUIEffect() CTL.GodBeast.SetStarLevelText(cellTable.lab_MythicalAnimalsLevel, activeBeastInfo.starLevel) -- 碎片数量 UIUtils.SetLabel(cellTable.lab_Amount, haveCount) if CTL.GodBeast.IsBeastGodDevelopRed(data.ID) then cellTable.effect_RedPoint:PlayUIEffect() else cellTable.effect_RedPoint:StopUIEffect() end else UIUtils.SetActive(cellTable.lab_MythicalAnimalsLevel, false) if MDL.GodBeast.IsBeastCanActive(data.ID) then UIUtils.SetActive(cellTable.img_Mask, false) UIUtils.SetLabel(cellTable.lab_Amount, UTL.Color.FormatQualityText(haveCount, 1) .. "/" .. activeCount) cellTable.UIEffect_Activated:PlayUIEffect() cellTable.effect_RedPoint:PlayUIEffect() else UIUtils.SetActive(cellTable.img_Mask, true) UIUtils.SetLabel(cellTable.lab_Amount, UTL.Color.FormatRedColor(haveCount) .. "/" .. activeCount) cellTable.UIEffect_Activated:StopUIEffect() cellTable.effect_RedPoint:StopUIEffect() end end end function UIGodBeastMainPanel:OnCellClicked(scrollRect, index, cellTable, target, data) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGodBeastBasePanel, { id = data.ID }) CTL.Sound.PlayGameSound("UI_sound_Chapter") end return UIGodBeastMainPanel