local UIGuildMinePlunderPopUp = UIViewClass() function UIGuildMinePlunderPopUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_GuildMine_CloseView, self.OnBackButtonPressed) -- GMS self:RegistSystemEvent(EventID.UI_Guild_BeKickOutRefresh, self.OnBackButtonPressed) -- 被踢出势力 self:RegistSystemEvent(EventID.UI_FreeLineUp_RefreshUI, self.RefreshPlayerGs) -- 刷新战力 self:RegistSystemEvent(EventID.UI_GuildMine_Refresh_OtherMineList, self.RefreshPlunderView) -- 刷新矿区 self.mineInfo = context.mineInfo self.mineData = context.mineData UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Mine_Captured_Title) self:RefreshPlunderView(nil,true) end function UIGuildMinePlunderPopUp:RepeatFuncContinue(deltaTime, timeSinceUpdate) MDL.GuildMine.GetMineInterfaceInfoRequest(MDL.GuildMine.InterfaceType.Continue) self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildMinePlunderPopUp:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildMinePlunderPopUp:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Plunder then local curKingdom = MDL.GuildMine.GetMineCurKingdomId() if CTL.GuildMine.IsFormationFinished(curKingdom) then if MDL.GuildMine.MineDailyFreePlunderNum + MDL.GuildMine.GetMinePurchaseNum() - MDL.GuildMine.GetMineLootNum() <= 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Mine_NoPlundersTimes) -- 掠夺次数不足 else if self.mineInfo.mineBaseShowInfo.beLootTimes >= self.mineData.PlunderTimes then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Mine_NoPlunderedTimes) -- 该矿场被掠夺次数不足 else if self.mineInfo.mineBaseShowInfo.mineBeginTime + self.mineData.CollectTime * UTL.Time.TotalSecondsOneMinute - UTL.Time.GetServerTimestamp() <= 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Mine_Completed) -- 该矿场已收获完毕 else if self.mineInfo.mineBaseShowInfo.isInBattle then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Mine_BeingPlundered) -- 该矿场正在被掠夺 else MDL.GuildMine.EnterGuildMineFuBen(MDL.GuildMine.GuidMineOpType.Loot, self.mineInfo.mineBaseShowInfo.mineLevel, self.mineInfo.minePlayerShowInfo.playerAcid, self.mineInfo.minePlayerShowInfo.playerName, "", "", UTL.Time.GetServerTimestamp(), self.mineInfo.mineBaseShowInfo.mineBeginTime) end end end end else CTL.GuildMine.OpenSelectOfficerMessageBox() end end end function UIGuildMinePlunderPopUp:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Reward then UTL.Item.SetItemCell(cellTable.item, data.ItemID,data.ItemNum) end end function UIGuildMinePlunderPopUp:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_Reward then if target == cellTable.item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end end function UIGuildMinePlunderPopUp:RefreshPlunderView(acid, isInit) if not isInit then if self.mineInfo.minePlayerShowInfo.playerAcid == acid then self.mineInfo = MDL.GuildMine.GetOtherMineInfoByAcid(acid) if self.mineInfo == nil then self:OnButtonClicked(self.UICommonPopUp.btn_Close) return end end end self.state_Mine:SetState(self.mineInfo.mineBaseShowInfo.mineLevel - 1) local timer = (self.mineInfo.mineBaseShowInfo.mineBeginTime + self.mineData.CollectTime * UTL.Time.TotalSecondsOneMinute) - UTL.Time.GetServerTimestamp() if timer > 0 then self:StartRepeatFunc(self.RepeatFuncContinue, timer) self.txt_Time:ResetAndBeginTimer(false, timer, 0) else self:OnButtonClicked(self.UICommonPopUp.btn_Close) end self:RefreshPlayerGs() local hasCount = MDL.GuildMine.MineDailyFreePlunderNum + MDL.GuildMine.GetMinePurchaseNum() - MDL.GuildMine.GetMineLootNum() UIUtils.SetLabel(self.txt_MiningTimes, string.FormatByIdsId(Const_IDS.IDS_Mine_PlundersTimes, string.format("%s/%s", hasCount > 0 and UTL.Color.FormatGreenColor(hasCount) or UTL.Color.FormatRedColor(hasCount), MDL.GuildMine.MineDailyFreePlunderNum))) local rewardData = DataSheetManager.MineRewardRepeat:GetDataByID(self.mineData.PlunderReward).Item_Table self.loop_Reward:ReloadAll(rewardData) local enemyInfo = {enemyPlayerInfo = self.mineInfo.minePlayerShowInfo, enemyGuildInfo = self.mineInfo.mineGuildShowInfo, enemyLineUpInfo = self.mineInfo.mineLineUpShowInfo} if self.subView then self.sub_HeroInfo:CloseAll() end self.subView = self.sub_HeroInfo:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIGuildMineHeroInfoSub), enemyInfo) end function UIGuildMinePlunderPopUp:RefreshPlayerGs() self.curKingdom = MDL.GuildMine.GetMineCurKingdomId() UIUtils.SetLabel(self.txt_Num, MDL.GuildMine.GetLineUpGSTotal(self.curKingdom)) end return UIGuildMinePlunderPopUp