local UIGuildMineReward = UIViewClass() function UIGuildMineReward:OnOpened(context) self:RegistSystemEvent(EventID.UI_GuildMine_CloseView, self.CloseView) -- GMS self:RegistSystemEvent(EventID.UI_GuildMine_Update_One_Record, self.UpdateOneRecord) -- 日志某一条刷新 self.finishMineInfo = MDL.GuildMine.GetBalanceMine() self.myMineData = DataSheetManager.MineQuality:GetDataByID(self.finishMineInfo.mineLevel) self.plunderNum = DataSheetManager.MineRewardRepeat:GetDataByID(self.myMineData.PlunderReward).Item_Table[1].ItemNum UIUtils.SetLabel(self.txt_Title, UIUtils.GetLocalizedTxt(Const_IDS[self.myMineData.Name]) .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_Mine_Gains)) self.state_Mine:SetState(self.finishMineInfo.mineLevel - 1) self.lootHistoryList = self.finishMineInfo.lootHistory self.state_Empty:SetState(#self.lootHistoryList > 0 and 1 or 0) if #self.lootHistoryList > 0 then self.loop_Info:ReloadAll(self.lootHistoryList) end local rewardData = DataSheetManager.MineRewardRepeat:GetDataByID(self.myMineData.MineReward).Item_Table self.loop_Reward:ReloadAll(rewardData) end function UIGuildMineReward:OnButtonClicked(comp) if comp == self.btn_Know then MDL.GuildMine.RemoveBalanceMineInfo() MDL.GuildMine.ReceiveMineRewardRequest() self:CloseView() end end function UIGuildMineReward:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Reward then UTL.Item.SetItemCell(cellTable.item, data.ItemID,data.ItemNum - self.plunderNum * #self.lootHistoryList) elseif scrollRect == self.loop_Info then local baseInfo = data.baseInfo local supplementInfo = data.supplementInfo UIUtils.SetLabel(cellTable.txt_Name, baseInfo.playerName) if not string.isNilOrEmpty(supplementInfo.AssName) then cellTable.state_Change:SetState(0) -- 已援助夺回 UIUtils.SetLabel(cellTable.txt_Time, string.FormatByIdsId(Const_IDS.IDS_Mine_Captured3, supplementInfo.AssName)) elseif supplementInfo.isFightBack then cellTable.state_Change:SetState(3) -- 已夺回 elseif supplementInfo.isOverdue then cellTable.state_Change:SetState(4) -- 被掠夺 elseif supplementInfo.isSeekHelp then cellTable.state_Change:SetState(1) -- 已求助 else cellTable.state_Change:SetState(2) -- 发起求助 end end end function UIGuildMineReward: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 elseif scrollRect == self.loop_Info then if target == cellTable.btn_Thank then if MDL.GuildMine.ThanksRefreshTime > 0 then local timer = UTL.Time.GetServerTimestamp() - MDL.GuildMine.ThanksRefreshTime if timer > 5 then MDL.GuildMine.MineAssThanksRequest(data.supplementInfo.AssName, data.supplementInfo.guildId) else CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS.IDS_Mine_ThankCD, 5 - timer)) -- %s秒后可再次感谢 end else MDL.GuildMine.MineAssThanksRequest(data.supplementInfo.AssName, data.supplementInfo.guildId) end elseif target == cellTable.btn_Help then if MDL.Guild.IsHasGuild() then local baseInfo = data.baseInfo MDL.GuildMine.GuildMineOptRequest(MDL.GuildMine.GuidMineOpType.SeekHelp, BattleDataGetter.GetAcID(), baseInfo.lootTime, baseInfo.lootAcid, baseInfo.mineBeginTime) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_Mine_UnableSeekHelp) -- 势力变更,无法发起本次求助 end end end end function UIGuildMineReward:UpdateOneRecord(lootTime) for i,v in ipairs(self.lootHistoryList) do if v.baseInfo.lootTime == lootTime then v.supplementInfo.isSeekHelp = true self.loop_Info:UpdateIndex(i-1, v) break end end end return UIGuildMineReward