local UIBaseOptional = require "View/Common/UIBaseOptional" local UIGodBeastActivityOptional = UIViewClass(UIBaseOptional) local GodBeastSort = function(a, b) return a.ID < b.ID end function UIGodBeastActivityOptional:Init() self:RegistSystemEvent(EventID.UI_GodBeastActivity_ChooseGodBeast, self.CloseView) self.curID = MDL.GodBeastActivity.GetGodBeastChooseId(self.activityId) self.isSuperGold = CTL.GodBeastActivity.IsSuperGold(self.activityId) self.noteID = LuaConst.NoteID.OptionalGodBeast local cardPoolList, selectPoolInfo = CTL.GodBeastActivity.GetActivitySameQualityGodBeast(self.activityId, self.curID) table.sort(cardPoolList, GodBeastSort) table.insert(cardPoolList, 1, selectPoolInfo) self.cardPoolList = cardPoolList self.group_Remind.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_OptionalHorseAndTreasure_Title16) self.lab_Title.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_OptionalHorseAndTreasure_Title15) end function UIGodBeastActivityOptional:OnButtonClicked(comp) if comp == self.btn_Confirm then if self.selectID == 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_OptionalHorseAndTreasure_Title15) else UIManager.OpenView(Const_UI_Lua.UIEnum.UIGodBeastActivityOptionalPopup, {activityId = self.activityId, leftID = self.curID, rightID = self.selectID}, Const_UI_Lua.UIEnum.UIGoldHeroOptionalPupup) end else UIBaseOptional.OnButtonClicked(self, comp) end end function UIGodBeastActivityOptional:RefreshCellInfo(cellTable, data) cellTable.state_Type:SetState(1) UIUtils.SetImageByAssetBundle(cellTable.img_Hero, data.GodBeastPicture) cellTable.img_Hero:SetNativeSize() local activeInfo = MDL.GodBeast.GetGodBeastInfoByID(data.ID) if activeInfo then cellTable.group_Break:SetState(1) UIUtils.SetLabel(cellTable.txt_BreakLevel, string.FormatByIdsId(Const_IDS.IDS_HeroStarLevel, "+" .. activeInfo.starLevel)) else cellTable.group_Break:SetState(0) end cellTable.txt_OtherName.text = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[data.GodBeastName]), data.GodBeastQuality) UIUtils.SetActive(cellTable.group_Now, self.curID == data.ID) end function UIGodBeastActivityOptional:CellClicked(data, index) if self.curID == data.ID then CTL.Tips.AddTipsMsg(Const_IDS.IDS_OptionalHorseAndTreasure_Title17) return else if self.selectID ~= data.ID then self.selectID = data.ID self:PlaySelectEffect(index) end end end return UIGodBeastActivityOptional