local UIGVGFightWarReport = UIViewClass() local GVGFightReportRetain = DataSheetManager.ConstData:GetDataByID("GVGFightReportRetain").IntValue -- 战报最多保留数量 -------------------- function UIGVGFightWarReport:OnOpened(context) self:RegistSystemEvent(EventID.GVGFight_RefreshWarReportInfo, self.OnOnGVGWarReport) -- 设置标题 UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GVGFight_Report_Title) -- 取消红点 MDL.RedPoint.RemoveEnterWorldRedPoint(MDL.RedPoint.EnterWorldRedPointType.GVGFightWarReport) -- 请求数据 MDL.GVGFight.GVGWarReportReq() end function UIGVGFightWarReport:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGVGFightWarReport:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIGVGFightWarReport:OnCellInit(scrollRect, index, cellTable, data) if data.type == 2 then self:InitPlayerInfo(cellTable.group_PlayerInfo, data.defenderInfo) self:InitPlayerInfo(cellTable.group_EnemyInfo, data.attackerInfo) UIUtils.SetActive(cellTable.group_Attack, false) UIUtils.SetActive(cellTable.group_Defense, true) else self:InitPlayerInfo(cellTable.group_PlayerInfo, data.attackerInfo) self:InitPlayerInfo(cellTable.group_EnemyInfo, data.defenderInfo) UIUtils.SetActive(cellTable.group_Attack, true) UIUtils.SetActive(cellTable.group_Defense, false) end cellTable.state_Ending:SetState(data.isWin and 0 or 1) cellTable.txt_Time.text = os.date(UTL.Time.FormatDateEnum.YMDHM, data.time) UIUtils.SetActive(cellTable.group_New, data.isNotRead) local cityData = DataSheetManager.GVGFightCity:GetDataByCityID(data.cityId) UIUtils.SetLabelText(cellTable.txt_Coordinate, Const_IDS[cityData.CityName]) end -------------------- function UIGVGFightWarReport:OnOnGVGWarReport() local warReportInfoCount = MDL.GVGFight.GetWarReportInfoCount() self.Loop_WarReport:ClearCells() if warReportInfoCount > 0 then UIUtils.SetActive(self.Loop_WarReport, true) UIUtils.SetActive(self.img_Empty, false) for _, v in MDL.GVGFight.GetWarReportInfoIterator() do self.Loop_WarReport:AddData(v, 0) end else UIUtils.SetActive(self.Loop_WarReport, false) UIUtils.SetActive(self.img_Empty, true) end UIUtils.SetLabel(self.txt_CountDown, string.FormatByIdsId(Const_IDS.IDS_GVGFight_Report_Info6, MDL.GVGFight.GetWarReportInfoCount(), GVGFightReportRetain)) end function UIGVGFightWarReport:InitPlayerInfo(collection, memberInfo) local headInfo = memberInfo.info UIUtils.SetLabel(collection.txt_Server, string.FormatByIdsId(Const_IDS.IDS_CrossSever_SeverSuffixText2, headInfo.ShowServerId)) collection.txt_PlayerName.text = headInfo.name collection.txt_Name.text = headInfo.guildName collection.txt_ForceLoss.text = memberInfo.troopLoss collection.txt_SurplusForce.text = memberInfo.troopSurplus CTL.Guild.SetGuildEmblem(collection.img_GuildIcon, collection.txt_Guild, headInfo.EmblemFrame, headInfo.EmblemContent) CTL.Character.SetPortraitAndFrame(collection.template_PlayerHead, headInfo.PortraitId, headInfo.FrameId, headInfo.level) end return UIGVGFightWarReport