local UIGuildMineEnemyPopUp = UIViewClass() function UIGuildMineEnemyPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_GuildMine_Enemy_Pop_Up_Refresh, self.RefreshAssCount) self:RegistSystemEvent(EventID.UI_GuildMine_CloseView, self.OnBackButtonPressed) -- GMS self:RegistSystemEvent(EventID.UI_Guild_BeKickOutRefresh, self.CloseView) -- 被踢出势力 UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Mine_EnemyLineup) self.sub_HeroInfo:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIGuildMineHeroInfoSub), context.info) self.selfFight = context.acid == BattleDataGetter.GetAcID() -- 反击夺回/援助夺回 self.lootTime = context.timestamp local historyList if self.selfFight then historyList = MDL.GuildMine.GetLootHistory() else historyList = MDL.GuildMine.GetAssHistory() end for i,v in ipairs(historyList) do if v.baseInfo.lootTime == self.lootTime then self.data = v break end end self:RefreshBtn() end function UIGuildMineEnemyPopUp:RefreshBtn() if self.selfFight then UIUtils.SetActive(self.txt_MiningTimes, false) UIUtils.SetLabelText(self.lab_Help, Const_IDS.IDS_Mine_Recapture) else self:RefreshAssCount() UIUtils.SetActive(self.txt_MiningTimes, true) UIUtils.SetLabelText(self.lab_Help, Const_IDS.IDS_Mine_AssistanceRecapture) end end function UIGuildMineEnemyPopUp:RefreshAssCount() if not self.selfFight then local limitTimes = DataSheetManager.ConstData:GetDataByID("MineDailyAssistanceNum").IntValue local times = limitTimes - MDL.GuildMine.GetAssCount() local str if times == 0 then str = UTL.Color.FormatRedColor(0).."/"..limitTimes else str = times.."/"..limitTimes end UIUtils.SetLabel(self.txt_MiningTimes, string.FormatByIdsId(Const_IDS.IDS_Mine_AssistanceFrequency, str)) end end function UIGuildMineEnemyPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildMineEnemyPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Help then local baseInfo = self.data.baseInfo local supplementInfo = self.data.supplementInfo if self.selfFight then MDL.GuildMine.EnterGuildMineFuBen(MDL.GuildMine.GuidMineOpType.FightBack, baseInfo.mineLevel, baseInfo.lootAcid, baseInfo.playerName, "", "", baseInfo.lootTime, baseInfo.mineBeginTime, baseInfo.lootPortraitId, baseInfo.lootFrameId) else MDL.GuildMine.EnterGuildMineFuBen(MDL.GuildMine.GuidMineOpType.Assist, baseInfo.mineLevel, baseInfo.lootAcid, baseInfo.playerName, supplementInfo.memberShowInfo.playerAcid, supplementInfo.memberShowInfo.playerName, baseInfo.lootTime, baseInfo.mineBeginTime, supplementInfo.memberShowInfo.playerPortraitId, supplementInfo.memberShowInfo.playerFrameId, baseInfo.lootPortraitId, baseInfo.lootFrameId) end self:CloseView() end end return UIGuildMineEnemyPopUp