local UIGachaPoolSelect = UIViewClass() local EventSystem = require('Event/EventSystem') local CountryBgPath = ConstAssetPathConfig.CountryBgPath --1234分别对应魏蜀吴群 local CountryBgImg = { [1] = "ck_bg_wei", [2] = "ck_bg_shu", [3] = "ck_bg_wu", [4] = "ck_bg_qun", } function UIGachaPoolSelect:OnOpened(context) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.DrawCard, self.RefreshDrawCardRp) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_DrawCard) local goldenHeroInfo = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GoldenHero) if goldenHeroInfo then for i, v in pairs(goldenHeroInfo) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self.loop_DrawCardPool:AddData(v, 0) self:RegistSystemEvent(CTL.GoldenHeroMain.RpEventId[v.activityId].DrawCardAvailable, self.RefreshDrawCardRp) end end end local superGoldInfo = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.SuperGold) if superGoldInfo then for i, v in pairs(superGoldInfo) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self.loop_DrawCardPool:AddData(v, 0) self:RegistSystemEvent(CTL.SuperGoldMain.RpEventId[v.activityId].DrawCardAvailable, self.RefreshDrawCardRp) end end end if GameAppInfo.IsJapanesePackage() then -- 日服金将复刻 local goldHeroReprint = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GoldHeroReprint) if goldHeroReprint then for i, v in pairs(goldHeroReprint) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self.loop_DrawCardPool:AddData(v, 0) self:RegistSystemEvent(EventID.BagItem_Update, self.RefreshDrawCardRp) end end end end self:RefreshDrawCardRp() self:SetPushStyle(LuaConst.PushStyleEnum.HIDE) end function UIGachaPoolSelect:RefreshDrawCardRp() self.btn_NormalPool:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.DrawCard)) self.loop_DrawCardPool:RefreshCells() end function UIGachaPoolSelect:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIGachaPoolSelect:OnButtonClicked(comp) if comp == self.btn_NormalPool then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGachaMain) elseif comp == self.UITemplateTitlePanel.btn_close then self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() end end function UIGachaPoolSelect:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) end function UIGachaPoolSelect:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_DrawCardPool then if data.activityType == MDL.OperationActivity.ActivityType.GoldenHero then local modeData = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(MDL.GoldenHeroMain.GetHeroTypeByActivityId(data.activityId)) UIUtils.SetLabelText(cellTable.txt_PoolName, Const_IDS[modeData.TownName]) local heroId = modeData.SynergyBossHeroID local kingdom = DataSheetManager.HeroNum:GetDataByID(heroId).Kingdom cellTable.state_Color:SetState(kingdom - 1) UIUtils.SetImageByAssetBundle(cellTable.img_Bg, string.format(CountryBgPath, CountryBgImg[kingdom])) UTL.Item.SetHeroHalfCardImageByHeroId(cellTable.img_Hero, heroId) cellTable.txt_Time:SetCustomString(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildWar_Time2), 1, 1) cellTable.txt_Time:ResetAndBeginTimer(false, data.endTime - UTL.Time.GetServerTimestamp(), 0) cellTable.btn_Click:SetRedPoint(MDL.RedPoint.GetNodeStateByLogicParams(CTL.GoldenHeroMain.RpEventId[data.activityId].TownHome, CTL.GoldenHeroMain.RpEventId[data.activityId].DrawCardAvailable)) elseif data.activityType == MDL.OperationActivity.ActivityType.SuperGold then local modeData = DataSheetManager.SuperGoldActivityModeData:GetDataByHeroType(MDL.SuperGoldMain.GetHeroTypeByActivityId(data.activityId)) UIUtils.SetLabelText(cellTable.txt_PoolName, Const_IDS[modeData.TownName]) local heroId = modeData.HeroID local kingdom = DataSheetManager.HeroNum:GetDataByID(heroId).Kingdom cellTable.state_Color:SetState(kingdom - 1) UIUtils.SetImageByAssetBundle(cellTable.img_Bg, string.format(CountryBgPath, CountryBgImg[kingdom])) UTL.Item.SetHeroHalfCardImageByHeroId(cellTable.img_Hero, heroId) cellTable.txt_Time:SetCustomString(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildWar_Time2), 1, 1) cellTable.txt_Time:ResetAndBeginTimer(false, data.endTime - UTL.Time.GetServerTimestamp(), 0) cellTable.btn_Click:SetRedPoint(MDL.RedPoint.GetNodeStateByLogicParams(CTL.SuperGoldMain.RpEventId[data.activityId].TownHome, CTL.SuperGoldMain.RpEventId[data.activityId].DrawCardAvailable)) elseif data.activityType == MDL.OperationActivity.ActivityType.GoldHeroReprint then local heroId = MDL.OperationActivity.GoldHeroReprintShowHero:GetDataByActivityID_OrderID(data.activityId, 1).HeroShowID UIUtils.SetLabelText(cellTable.txt_PoolName, Const_IDS["IDS_JP_GoldHeroReprint_Title"]) local kingdom = DataSheetManager.HeroNum:GetDataByID(heroId).Kingdom cellTable.state_Color:SetState(kingdom - 1) UIUtils.SetImageByAssetBundle(cellTable.img_Bg, string.format(CountryBgPath, CountryBgImg[kingdom])) UTL.Item.SetHeroHalfCardImageByHeroId(cellTable.img_Hero, heroId) cellTable.txt_Time:SetCustomString(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildWar_Time2), 1, 1) cellTable.txt_Time:ResetAndBeginTimer(false, data.endTime - UTL.Time.GetServerTimestamp(), 0) cellTable.btn_Click:SetRedPoint(MDL.GoldHeroReprint.CheckCanDrawCardRedPoint()) end end end function UIGachaPoolSelect:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_DrawCardPool then if target == cellTable.btn_Click then if not CTL.OperationActivity.IsOperationActivityOpen(data) then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Monopoly_EndTips) return end if data.activityType == MDL.OperationActivity.ActivityType.GoldenHero then CTL.GoldenHeroMain.OpenDrawCardMainPanel(data.activityId) elseif data.activityType == MDL.OperationActivity.ActivityType.SuperGold then CTL.SuperGoldMain.OpenDrawCardMainPanel(data.activityId) elseif data.activityType == MDL.OperationActivity.ActivityType.GoldHeroReprint then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGoldHeroReprint) end end end end return UIGachaPoolSelect