local UIGuildEscortBattleOverPanel = UIViewClass() -- [[ -- 势力押镖-战斗结算 -- ]] local ResultTitle = { CutEscortSucceed = "ybjs_msz_ldcg.png", CutEscortFailure = "ybjs_msz_ldsb.png", EscortSucceed = "ybjs_msz_yycg.png", EscortFailure = "ybjs_msz_yysb.png", } -------------------- function UIGuildEscortBattleOverPanel:OnCreated() self.oneOnOneResultUIAutoCloseTime = DataSheetManager.ConstData:GetDataByID("EscortlSettleTime").IntValue self.timeStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_RankOptimization_AutoExit) end function UIGuildEscortBattleOverPanel:OnOpened(context) self:RegistSystemEvent(EventID.UI_UpdateFriendInfo, self.RefreshOtherSyncPVPTeamScroll) self.battleResult = context.BattleResult self:InitPanel() end function UIGuildEscortBattleOverPanel:OnButtonClicked(comp) if comp == self.FullScreenWindow then MDL.Level.SendRoleLeaveFuben() else for i, reward in ipairs(self.battleResult.personalRewards) do if self.Content[i].event_Click == comp then UTL.ItemTips.ShowCommonTipsById(reward.ItemId) end end end end function UIGuildEscortBattleOverPanel:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetLabel(cellTable.txt_RankTeam, index + 1) UTL.Item.SetHeroIconByHeroId(cellTable.heroIcon, data.heroId, data.isAwaken) UIUtils.SetLabel(cellTable.name, data.playerName) UIUtils.SetLabel(cellTable.killNum, data.killNum) UIUtils.SetLabel(cellTable.HurtValue, data.totalDamage) if cellTable.bg_Self ~= nil then UIUtils.SetActive(cellTable.bg_Self, data.isSelf) end if self.otherSyncPVPTeamScroll == scrollRect then if MDL.Friend.IsPlayerRival(data.acid) then if MDL.Friend.IsPlayerRivalSworn(data.acid) then cellTable.obj_RivalState:SetState(2) else cellTable.obj_RivalState:SetState(1) end else cellTable.obj_RivalState:SetState(0) end end end function UIGuildEscortBattleOverPanel:OnCellClicked(scrollRect, index, cellTable, target, data) if self.otherSyncPVPTeamScroll == scrollRect then if cellTable.Btn_Add == target then MDL.Rival.RivalOperationRequest(data.acid, MDL.Rival.RivalOperationType.RivalOptCommonEnemy) end end end -------------------- function UIGuildEscortBattleOverPanel:InitPanel() -- 设置劫镖还是护镖 self.obj_ResultState:SetState(self.battleResult.success and 0 or 1) UIUtils.SetActive(self.obj_Enemy, false) local personalRewards = self.battleResult.personalRewards if CTL.GuildEscort.IsTransport() then -- 护镖 -- 是否护镖成功 if self.battleResult.success then self.group_Bottom:SetState(3) UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, ResultTitle.EscortSucceed) else self.group_Bottom:SetState(2) UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, ResultTitle.EscortFailure) end else -- 劫镖 -- 是否劫镖成功 if self.battleResult.success then self.group_Bottom:SetState(0) UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, ResultTitle.CutEscortSucceed) if self.battleResult.success and #personalRewards > 0 then UIUtils.SetActive(self.obj_Enemy, self.battleResult.hasEnemy) end else self.group_Bottom:SetState(1) UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, ResultTitle.CutEscortFailure) end end -- 设置劫镖奖励(被劫镖、劫镖) if #personalRewards > 0 then for i, reward in ipairs(personalRewards) do local item = self.Content[i] if not item then item = self:InstantiateCollection(self.Content, self.itemTemplate_Reward.gameObject) end UTL.Item.SetItemCell(item, reward.ItemId, reward.ItemCount) UIUtils.SetActive(item.gameObject, true) end for i = #personalRewards + 1, #self.Content do UIUtils.SetActive(self.Content[i].gameObject, false) end end local myEntity = BattleDataGetter.GetCurEntity() local myTeamInfo = {} self.enemyTeamInfo = {} for i, info in ipairs(self.battleResult.allFighterRes) do local entity = BattleDataGetter.GetPlayerActiveEntity(info.playerID) local cellData = { acid = info.acid, isSelf = info.playerID == myEntity:GetPlayerID(), killNum = info.killNum, totalDamage = info.totalDamage, heroId = entity._logicInitData.CharacterID, isAwaken = BattleDataGetter.GetHeroIsAwaken(info.playerID), playerName = entity._logicInitData.Name} if BattleDataGetter.IsSameTeamByEntities(myEntity, entity) then table.insert(myTeamInfo, cellData) else table.insert(self.enemyTeamInfo, cellData) end end -- 设置我方阵容(蓝色) self.mySyncPVPTeamScroll:ReloadAll(myTeamInfo) -- 设置敌方阵容(红色) self.otherSyncPVPTeamScroll:ReloadAll(self.enemyTeamInfo) -- 设置倒计时 self.group_ExitTimer:ResetAndBeginCustomTimer(false, self.oneOnOneResultUIAutoCloseTime, 0, self.timeStr) self:StartRepeatFunc(self.CountdownEnd, self.oneOnOneResultUIAutoCloseTime) end function UIGuildEscortBattleOverPanel:RefreshOtherSyncPVPTeamScroll() self.otherSyncPVPTeamScroll:ReloadAll(self.enemyTeamInfo) end -- 倒计时结束执行退出逻辑 function UIGuildEscortBattleOverPanel:CountdownEnd(deltaTime, timeSinceUpdate) self:OnButtonClicked(self.FullScreenWindow) end return UIGuildEscortBattleOverPanel