local UIGuildWarSummaryPanel = 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 CountDownTime = DataSheetManager.ConstData:GetDataByID("GuildWarResultUIAutoCloseTime").IntValue local MinScore = DataSheetManager.ConstData:GetDataByID("GuildWarPlayerRewardScoreLimit").IntValue function UIGuildWarSummaryPanel:OnOpened(context) self.selfShowType = ShowType.SelfPage1 self.enemyShowType = ShowType.EnemyPage1 local data = MDL.GuildWar.GetBattleInfo() local selfData = nil local enemyData = nil local isWin = false if data.selfIsRed then selfData = context.red enemyData = context.blue isWin = context.winCameId == 1 else selfData = context.blue enemyData = context.red isWin = context.winCameId == 2 end self.selfMaxValue = selfData.honorWallAcids self.enemyMaxValue = enemyData.honorWallAcids local rewardCfg = nil 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") rewardCfg = DataSheetManager.GuildWarSigleVictoryReward:GetDataByID(context.tagId) 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) rewardCfg = DataSheetManager.GuildWarSigleFailedReward:GetDataByID(context.tagId) end self.txt_TimeSpent.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_TotalTime, UTL.Time.FormatTimeSeconds(selfData.timeSpend)) self:InitGuildInfo(self.group_GuildInfo_Teammate, selfData, true) self:InitGuildInfo(self.group_GuildInfo_Enemy, enemyData, false) self.labLocal_NextStep:ResetAndBeginCustomTimer(false, CountDownTime, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_BackToTownCountdown)) self:StartRepeatFunc(self.OnUpdateFun, CountDownTime) if MinScore < self.selfData.score then for i, v in ipairs(rewardCfg.Item_Table) do self.ScrollView:AddData(v, 0) end else self.emptyText.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_BattleRewardIntroTip, MinScore) self.group_Bottom.gameObject:SetActive(false) end end function UIGuildWarSummaryPanel:OnUpdateFun() self:CloseView() MDL.Level.SendRoleLeaveFuben() end function UIGuildWarSummaryPanel:InitGuildInfo(obj, data, isSelf) local battleInfo = MDL.GuildWar.GetBattleInfo() local guildInfo = nil if isSelf then guildInfo = battleInfo.selfCamp.guildInfo else guildInfo = battleInfo.enemyCamp.guildInfo end local selfFrame = guildInfo.emblemFrame UTL.Item.SetAtlasSprite(obj.img_GuildFrame, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(selfFrame).Image) obj.txt_GuildName.text = guildInfo.guildName -- 跨服信息 if CTL.GuildWar.IsShowCrossServerUI() then local serverId = guildInfo.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_GuildNameInitiate.text = guildInfo.emblemContent obj.txt_DefencePoint.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_WallHP, data.hp) obj.txt_Killed.text = string.FormatByIdsId(Const_IDS.IDS_GuildWar_TotalKill, data.totolKillNum) for i, v in ipairs(data.playerInfos) do obj.loop_PlayerInfo:AddData(v, 0) if isSelf and v.acid == BattleDataGetter.GetAcID() then self:SetMyInfo(self.group_GuildInfo_Teammate.group_PlayerInfoBar, v, i) self.selfData = v end end if self.selfData == nil then --只有进了战场才能上榜 但是玩家有可能在loading过程中结算了 客户端人为的放到最后一名并且所有数据都是0 self.selfData = { acid = BattleDataGetter.GetAcID(), playerName = BattleDataGetter.GetPlayerName(), score = 0, killNum = 0, continuousKilling = 0, assiantNum = 0, seriousInjury = 0, occupycamp = 0, killBoss = 0, wallDemage = 0, handInResource = 0, guildId = MDL.Guild.GetMyGuildInfo().guildId } obj.loop_PlayerInfo:AddData(self.selfData, 0) self:SetMyInfo(self.group_GuildInfo_Teammate.group_PlayerInfoBar, self.selfData, #data.playerInfos + 1) end end function UIGuildWarSummaryPanel:SetMyInfo(obj, data, index) obj.txt_PlayerName.text = data.playerName obj.txt_PersonalRank.text = data.score if self.selfShowType == ShowType.SelfPage1 then obj.txt_Feature1Number.text = data.killNum obj.txt_Feature4Number.text = data.continuousKilling obj.txt_Feature3Number.text = data.assiantNum obj.txt_Feature2Number.text = data.seriousInjury else obj.txt_Feature1Number.text = data.occupycamp obj.txt_Feature2Number.text = data.killBoss obj.txt_Feature3Number.text = data.handInResource obj.txt_Feature4Number.text = data.wallDemage end if index then obj.txt_Rank.text = index end end function UIGuildWarSummaryPanel:OnButtonClicked(comp) if comp == self.event_NextStep then if LogicUpdateManager.FightBegin then -- 做一个保护 ,等玩家真正的结束后,才离开战斗 ;但是有可能战斗不一致了,需要有报错提示 logging.error(LTAG.ERROR, "[GWS] : 结算界面出来了 ,但是战斗没结束 !如果要退出 ,强制stoplevel 。原因:服务器和客户端战斗代码不同版本,或 战斗程序bug导致结果不一致。 ") NotSyncBattleSetter.StopCurLevel() end self:CloseView() MDL.Level.SendRoleLeaveFuben() 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:SetMyInfo(self.group_GuildInfo_Teammate.group_PlayerInfoBar, self.selfData, nil) 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:SetMyInfo(self.group_GuildInfo_Teammate.group_PlayerInfoBar, self.selfData, nil) 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) elseif comp == self.event_MyRecords then CTL.GuildWar.OpenPersonalDataView(self.selfData, self.context.tagId) end end function UIGuildWarSummaryPanel:OnCellInit(scrollRect, index, cellTable, data) if self.ScrollView == scrollRect then UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) else cellTable.txt_PlayerName.text = data.playerName cellTable.txt_PersonalMark.text = data.score local isSelfGuild = data.guildId == MDL.Guild.GetMyGuildInfo().guildId self:InitCellText(data, cellTable.txt_PersonalMark, StatisticsType.score, isSelfGuild, data.score) local isShowPage1 = false 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 if cellTable.group_TheBest then cellTable.group_TheBest.gameObject:SetActive(index == 0 and MinScore < data.score) UIUtils.SetLocalizationImage(cellTable.img_TheBest, "slzjs_msz_zj.png"); end end end function UIGuildWarSummaryPanel:OnCellClicked(scrollRect, index, cellTable, target, data) if self.ScrollView == scrollRect then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end function UIGuildWarSummaryPanel: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 UIGuildWarSummaryPanel