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 local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) --初始化组件(用于子类重写) function BattleFailPopup:InitComponent() this.spLoader = SpriteLoader.New() orginLayer = 0 this.btnClose = Util.GetGameObject(self.gameObject, "Lose") this.failImg = Util.GetGameObject(self.gameObject, "Lose/image/ziti"):GetComponent("Image") this.failImg.sprite = this.spLoader:LoadSprite("UI_effect_JJC_JieSuan_ShiBai_png_zh") this.btn_record=Util.GetGameObject(this.btnClose, "layout/record") this.btnBattleBack = Util.GetGameObject(this.btnClose, "btnBattleBack") -- this.btnBattleBack:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_silingshilian_huifanganniu_zh") this.btnGrowUp = Util.GetGameObject(this.btnClose, "btnGrowUp") end --绑定事件(用于子类重写) function BattleFailPopup:BindEvent() Util.AddClick(this.btnClose, function () -- 三秒后才能关闭 if GetTimeStamp() - this.openTime < 1 then return end 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(this.btnGrowUp, function () -- 一秒后才能跳转 if GetTimeStamp() - this.openTime < 1 then return end this.ClosePanelRefreshData() if m_battlePanel then m_battlePanel:ClosePanel() end self:ClosePanel() -- 跳转到我要变强 JumpManager.GoJump(48001) 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) this.openTime = GetTimeStamp() --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 or fightType == BATTLE_TYPE.Test or fightType == BATTLE_TYPE.EndlessMpaFight then--地图 this.btnBattleBack:SetActive(false) this.btnGrowUp:SetActive(false) elseif fightType == BATTLE_TYPE.GodsWayTower then this.btnBattleBack:SetActive(false) this.btn_record:SetActive(false) else this.btnBattleBack:SetActive(true) this.btnGrowUp:SetActive(true) end if fightType == BATTLE_TYPE.GUILD_CAR_DELAY then--车迟 --车迟抢夺cd计时 GuildCarDelayManager.SetCdTime(GuildCarDelayProType.Loot) 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[10210]) end end function this.ClosePanelRefreshData() LogRed("fightType:"..tostring(fightType)) if fightType then if fightType == BATTLE_TYPE.EXECUTE_FIGHT then--远征 this.ShowBattleResultByExpedition() elseif fightType == BATTLE_TYPE.XIAOYAOYOU then--逍遥游 this.ShowBattleResultByXYY() elseif fightType == BATTLE_TYPE.FOURELEMENT then--四灵 this.ShowBattleResultByFOURELEMENT() --新回放功能 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() elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.FOURELEMENT then--四灵 this.ShowBattleResultByFOURELEMENT() 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.ShowBattleResultByJumpServerHightLadder() PopupTipPanel.ShowTip("挑战失败,罗浮争锋排行无变化!") if not isBackBattle and JumpServerManager.curBattleDrop.itemlist ~= nil and #JumpServerManager.curBattleDrop.itemlist > 0 then local content = {} for i = 1, #JumpServerManager.curBattleDrop.itemlist do local itemdata = {} itemdata.configData = itemConfig[JumpServerManager.curBattleDrop.itemlist[i].itemId] itemdata.name = GetLanguageStrById(itemdata.configData.Name) itemdata.icon = this.spLoader:LoadSprite(GetResourcePath(itemdata.configData.ResourceID)) itemdata.num = JumpServerManager.curBattleDrop.itemlist[i].itemNum table.insert(content, itemdata) end PopupText(content, 0.5, 2) 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[11455]) else MsgPanel.ShowTwo(Language[11456], function() Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)--刷新界面 end, function() NetManager.EndConfirmExpeditionBattleRequest(GetCurNodeInfo.sortId, function (msg) Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)--刷新界面 end) end,Language[10731],Language[11457]) -- Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)--刷新界面 end end end function this.ShowBattleResultByFOURELEMENT() if MonsterCampManager.fourMonsterData[MonsterCampManager.curType].openState ~= 0 then UIManager.OpenPanel(UIName.FourElementMonsterCampPanel,MonsterCampManager.curType) else UIManager.OpenPanel(UIName.MonsterCampMainPanel) end end --界面关闭时调用(用于子类重写) function BattleFailPopup:OnClose() Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState,0) end --界面销毁时调用(用于子类重写) function BattleFailPopup:OnDestroy() this.spLoader:Destroy() end return BattleFailPopup