local UIGuildWarHistoryPanel = UIViewClass() local ShowType = { SelfPage1 = 1, SelfPage2 = 2, EnemyPage1 = 3, EnemyPage2 = 4, } local StatisticsType = { score = 1; --积分 killNum = 2; --击杀数 continuousKilling = 4;--连杀数 assintNum = 5, --助攻数 seriousInjury = 6; --重伤数 occupycamp = 7, --占领营地 killBoss = 8, --击杀boss wallDemage = 9, --城墙伤害 handInResource = 10, --上交物资 } local MinScore = DataSheetManager.ConstData:GetDataByID("GuildWarPlayerRewardScoreLimit").IntValue function UIGuildWarHistoryPanel:OnOpened(context) local isWin = context.Result == 1 self.selfShowType = ShowType.SelfPage1 self.enemyShowType = ShowType.EnemyPage1 self.selfMaxValue = context.red.honorWallAcids self.enemyMaxValue = context.blue.honorWallAcids if isWin then self.img_TitleFlag_Win.gameObject:SetActive(true) self.img_TitleFlag_Lose.gameObject:SetActive(false) UIUtils.SetLocalizationImage(self.img_Win, "UI_GuildWar/slzjs_msz_sl.png") else UIUtils.SetLocalizationImage(self.img_Loss, "UI_GuildWar/slzjs_msz_sb.png") self.img_TitleFlag_Lose.gameObject:SetActive(true) self.img_TitleFlag_Win.gameObject:SetActive(false) end self.group_Bottom.gameObject:SetActive(false) self.txt_TimeSpent.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_TotalTime, UTL.Time.FormatTimeSeconds(context.red.timeSpend)) self:InitGuildInfo(self.group_GuildInfo_Teammate,context.guildRed,context.red) self:InitGuildInfo(self.group_GuildInfo_Enemy,context.guildBlue,context.blue) self.group_GuildInfo_Teammate.group_PlayerInfoBar.gameObject:SetActive(false) self.event_NextStep:SetText(Const_IDS.IDS_Btn_CloseWindow) UIUtils.SetActive(self.event_MyRecords, false) end function UIGuildWarHistoryPanel:InitGuildInfo(obj,data1,data2) local isSelf = self.group_GuildInfo_Teammate == obj UTL.Item.SetAtlasSprite( obj.img_GuildFrame, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data1.emblemFrame).Image) obj.txt_GuildName.text = data1.guildName obj.txt_GuildNameInitiate.text = data1.emblemContent -- 跨服信息 if CTL.GuildWar.IsShowCrossServerUI() then local serverId = data1.zoneInfo.serverId UIUtils.SetActive(obj.txt_CrossServer, true) UIUtils.SetLabel(obj.txt_CrossServer, string.FormatByIdsId(Const_IDS["IDS_CrossSever_SeverInfoText"], CTL.CrossServer.GetServerIDAndServerNameByServerID(serverId))) else UIUtils.SetActive(obj.txt_CrossServer, false) end obj.txt_DefencePoint.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_WallHP,data2.hp) obj.txt_Killed.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_TotalKill,data2.totolKillNum) for i,v in ipairs(data2.playerInfos) do obj.loop_PlayerInfo:AddData(v,0) end end function UIGuildWarHistoryPanel:OnButtonClicked(comp) if comp == self.event_NextStep then self:CloseView() elseif comp == self.group_GuildInfo_Teammate.btn_Unfold then self.group_GuildInfo_Teammate.page2.gameObject:SetActive(true) self.group_GuildInfo_Teammate.page1.gameObject:SetActive(false) self.selfShowType = ShowType.SelfPage2 self.group_GuildInfo_Teammate.loop_PlayerInfo:RefreshCells() self.group_GuildInfo_Teammate.btn_Unfold.gameObject:SetActive(false) self.group_GuildInfo_Teammate.btn_Close.gameObject:SetActive(true) elseif comp == self.group_GuildInfo_Enemy.btn_Unfold then self.enemyShowType = ShowType.EnemyPage2 self.group_GuildInfo_Enemy.loop_PlayerInfo:RefreshCells() self.group_GuildInfo_Enemy.page2.gameObject:SetActive(true) self.group_GuildInfo_Enemy.page1.gameObject:SetActive(false) self.group_GuildInfo_Enemy.btn_Unfold.gameObject:SetActive(false) self.group_GuildInfo_Enemy.btn_Close.gameObject:SetActive(true) elseif comp == self.group_GuildInfo_Teammate.btn_Close then self.group_GuildInfo_Teammate.page2.gameObject:SetActive(false) self.group_GuildInfo_Teammate.page1.gameObject:SetActive(true) self.selfShowType = ShowType.SelfPage1 self.group_GuildInfo_Teammate.loop_PlayerInfo:RefreshCells() self.group_GuildInfo_Teammate.btn_Unfold.gameObject:SetActive(true) self.group_GuildInfo_Teammate.btn_Close.gameObject:SetActive(false) elseif comp == self.group_GuildInfo_Enemy.btn_Close then self.enemyShowType = ShowType.EnemyPage1 self.group_GuildInfo_Enemy.loop_PlayerInfo:RefreshCells() self.group_GuildInfo_Enemy.page2.gameObject:SetActive(false) self.group_GuildInfo_Enemy.page1.gameObject:SetActive(true) self.group_GuildInfo_Enemy.btn_Unfold.gameObject:SetActive(true) self.group_GuildInfo_Enemy.btn_Close.gameObject:SetActive(false) end end function UIGuildWarHistoryPanel:OnCellInit(scrollRect, index, cellTable, data) cellTable.txt_PlayerName.text = data.playerName cellTable.txt_PersonalMark.text = data.score local isSelfGuild = scrollRect == self.group_GuildInfo_Teammate.loop_PlayerInfo local isShowPage1 = false self:InitCellText(data,cellTable.txt_PersonalMark,StatisticsType.score,isSelfGuild,data.score) if isSelfGuild then isShowPage1 = self.selfShowType == ShowType.SelfPage1 else isShowPage1 = self.enemyShowType == ShowType.EnemyPage1 end if isShowPage1 then self:InitCellText(data,cellTable.txt_Feature1Number,StatisticsType.killNum,isSelfGuild,data.killNum) self:InitCellText(data,cellTable.txt_Feature4Number,StatisticsType.continuousKilling,isSelfGuild, data.continuousKilling) self:InitCellText(data,cellTable.txt_Feature3Number,StatisticsType.assintNum,isSelfGuild, data.assiantNum) self:InitCellText(data,cellTable.txt_Feature2Number,StatisticsType.seriousInjury,isSelfGuild, data.seriousInjury) else self:InitCellText(data,cellTable.txt_Feature1Number,StatisticsType.occupycamp,isSelfGuild, data.occupycamp) self:InitCellText(data,cellTable.txt_Feature2Number,StatisticsType.killBoss,isSelfGuild, data.killBoss ) self:InitCellText(data,cellTable.txt_Feature4Number,StatisticsType.wallDemage,isSelfGuild, data.wallDemage) self:InitCellText(data,cellTable.txt_Feature3Number,StatisticsType.handInResource,isSelfGuild, data.handInResource) end if index <= 2 then cellTable.txt_Rank.text = nil cellTable.img_MedalIcon:SetState(index) cellTable.img_MedalIcon.gameObject:SetActive(true) else cellTable.txt_Rank.text = index + 1 cellTable.img_MedalIcon.gameObject:SetActive(false) end UIUtils.SetActive(cellTable.group_TheBest, index == 0 and MinScore < data.score) UIUtils.SetLocalizationImage(cellTable.img_TheBest,"slzjs_msz_zj.png"); end function UIGuildWarHistoryPanel:InitCellText(data,obj,typeId,isSelf,str) local list = isSelf and self.selfMaxValue or self.enemyMaxValue if list[typeId] and list[typeId] == data.acid then obj.text = UTL.Color.FormatTextByColor("ffcb88",str) else obj.text = UTL.Color.FormatTextByColor("B5BACE",str) end end return UIGuildWarHistoryPanel