require("Base/BasePanel") BattleFailPopup = Inherit(BasePanel) local this = BattleFailPopup local m_battlePanel local m_showRecord = true local m_backPanel local orginLayer local fightType local isBackBattle = false --初始化组件(用于子类重写) function BattleFailPopup:InitComponent() orginLayer = 0 this.btnClose = Util.GetGameObject(self.gameObject, "Lose") this.btnBattleBack = Util.GetGameObject(this.btnClose, "btnBattleBack") end --绑定事件(用于子类重写) function BattleFailPopup:BindEvent() Util.AddClick(this.btnClose, function () this.ClosePanelRefreshData() if m_battlePanel then m_battlePanel:ClosePanel() end self:ClosePanel() if m_backPanel then UIManager.OpenPanel(m_backPanel) end -- this.ClosePanelRefreshData() end) Util.AddClick(Util.GetGameObject(this.btnClose, "tip/zhaomu"), function () FightManager.curIsInFightArea = 0 this:LoseJump(1001) this.ClosePanelRefreshData() end) Util.AddClick(Util.GetGameObject(this.btnClose, "tip/chengyuan"), function () FightManager.curIsInFightArea = 0 this:LoseJump(22001) this.ClosePanelRefreshData() end) Util.AddClick(Util.GetGameObject(this.btnClose, "record"), function () UIManager.OpenPanel(UIName.DamageResultPanel, 0) --this.ClosePanelRefreshData() end) Util.AddClick(this.btnBattleBack, function () LogGreen("isBackBattle = true") isBackBattle = true BattleManager.BattleBackFun() end) end --添加事件监听(用于子类重写) function BattleFailPopup:AddListener() end --移除事件监听(用于子类重写) function BattleFailPopup:RemoveListener() end function BattleFailPopup:OnSortingOrderChange() Util.AddParticleSortLayer(this.btnClose, self.sortingOrder - orginLayer) orginLayer = self.sortingOrder end --界面打开时调用(用于子类重写) function BattleFailPopup:OnOpen(battlePanel, showRecord, backPanel,_fightType) LogGreen("isBackBattle = false") isBackBattle = false if battlePanel then m_battlePanel = battlePanel end m_showRecord = true -- 默认显示 if showRecord == false then m_showRecord = showRecord end m_backPanel = nil if backPanel then m_backPanel = backPanel end if _fightType then fightType = _fightType end FightPointPassManager.FightBattleEnd() Util.GetGameObject(this.btnClose, "record"):SetActive(m_showRecord) Util.GetGameObject(this.btnClose,"tip"):SetActive(not fightType ==12)--副本内无法点击招募 if fightType == BATTLE_TYPE.MAP_FIGHT or GuideManager.IsInMainGuide() or MapManager.Mapping then--地图 this.btnBattleBack:SetActive(false) else this.btnBattleBack:SetActive(true) end end function this:LoseJump(id) if not MapManager.Mapping then if JumpManager.CheckJump(id) then if m_battlePanel then m_battlePanel:ClosePanel() end self:ClosePanel() JumpManager.GoJumpWithoutTip(id) end else PopupTipPanel.ShowTip(Language[10250]) end end function this.ClosePanelRefreshData() if fightType then if fightType == BATTLE_TYPE.EXECUTE_FIGHT then--远征 this.ShowBattleResultByExpedition() elseif fightType == BATTLE_TYPE.GUILD_CAR_DELAY then--车迟 --车迟抢夺cd计时 GuildCarDelayManager.SetCdTime(GuildCarDelayProType.Loot) elseif fightType == BATTLE_TYPE.XIAOYAOYOU then--逍遥游 this.ShowBattleResultByXYY() --新回放功能 elseif fightType == BATTLE_TYPE.BACK_BATTLE then if BattleManager.GetLastBattleType() == BATTLE_TYPE.EXECUTE_FIGHT then-- 猎妖之路 this.ShowBattleResultByExpedition() elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.XIAOYAOYOU then-- 逍遥游 this.ShowBattleResultByXYY() end end end end -- 逍遥游结算界面特殊显示 function this.ShowBattleResultByXYY() if not isBackBattle then XiaoYaoManager.OpenXiaoYaoMap(XiaoYaoManager.curMapId,function() this.fightBossIndex = XiaoYaoManager.fightBossOldIndex UIManager.OpenPanel(UIName.XiaoYaoLuckyBossPopup) end) end end -- 猎妖之路结算界面特殊显示 function this.ShowBattleResultByExpedition() if not isBackBattle then local GetCurNodeInfo = ExpeditionManager.curAttackNodeInfo if GetCurNodeInfo.type == ExpeditionNodeType.Greed then--贪婪节点 Timer.New(function () Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel) -- Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)--刷新界面 end,0.3):Start() PopupTipPanel.ShowTip( Language[12194]) else MsgPanel.ShowTwo(Language[11540], function() end, function() NetManager.EndConfirmExpeditionBattleRequest(GetCurNodeInfo.sortId, function (msg) end) end,Language[10719],Language[12201]) Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)--刷新界面 end end end --界面关闭时调用(用于子类重写) function BattleFailPopup:OnClose() Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState,0) end --界面销毁时调用(用于子类重写) function BattleFailPopup:OnDestroy() end return BattleFailPopup