require("Base/BasePanel") BattleWinPopup = Inherit(BasePanel) local this = BattleWinPopup local m_isBack local m_battlePanel local m_fightType local m_battleResult local m_notShowRecord = false local m_backPanel local orginLayer local m_callBack local hadClick = false --初始化组件(用于子类重写) function BattleWinPopup:InitComponent() orginLayer = 0 this.btnWin = Util.GetGameObject(self.gameObject, "Win") end --绑定事件(用于子类重写) function BattleWinPopup:BindEvent() Util.AddClick(this.btnWin, function () self:ClosePanel() -- self:NextStep() if m_fightType == BATTLE_TYPE.Test then if m_battlePanel then m_battlePanel:ClosePanel() end end end) end -- function BattleWinPopup:NextStep() if not hadClick then -- 避免重复结算 hadClick = true if m_isBack then if m_battlePanel then m_battlePanel:ClosePanel() end self:ClosePanel() return end if m_fightType == BATTLE_TYPE.MAP_FIGHT then --副本战斗结算 -- local bestData, allDamage= BattleRecordManager.GetBattleBestData() -- FightPointPassManager.oldLevel = PlayerManager.level -- if bestData then -- UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId, bestData.damage, allDamage, function(_BattleBestPopup) -- -- 打开关卡奖励界面 -- UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function() -- if _BattleBestPopup then -- _BattleBestPopup:ClosePanel() -- end -- if m_battlePanel then -- m_battlePanel:ClosePanel() -- end -- self:ClosePanel() -- Game.GlobalEvent:DispatchEvent(GameEvent.Bag.BagGold) -- end, 1, true, true) -- end) -- end -- end) elseif m_fightType == BATTLE_TYPE.ELITE_MONSTER then --限时怪战斗结算 UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function() m_battlePanel:ClosePanel() self:ClosePanel() end, 1, true) elseif m_fightType == BATTLE_TYPE.MONSTER_CAMP then -- 兽潮来袭 this.ShowBattleResultByMonsterCamp(m_battleResult.drop) elseif m_fightType == BATTLE_TYPE.STORY_FIGHT then -- 新关卡的战斗 this.ShowBattleResultByStoryFight(m_battleResult.drop) elseif m_fightType == BATTLE_TYPE.EXECUTE_FIGHT then -- 猎妖之路 this.ShowBattleResultByExpedition(m_battleResult.drop) elseif m_fightType == BATTLE_TYPE.DAILY_CHALLENGE then -- 日常副本 m_battlePanel:ClosePanel() self:ClosePanel(m_battleResult.drop) elseif m_fightType == BATTLE_TYPE.GUILD_CAR_DELAY then -- 车迟 this.ShowBattleResultByCarDeleayType(m_battleResult.drop) elseif m_fightType == BATTLE_TYPE.XIAOYAOYOU then if m_battlePanel then m_battlePanel:ClosePanel()end self:ClosePanel() --新回放功能 elseif m_fightType == BATTLE_TYPE.BACK_BATTLE then if BattleManager.GetLastBattleType() == BATTLE_TYPE.STORY_FIGHT then-- 新关卡战斗 this.ShowBattleResultByStoryFight(BattleManager.GetLastBattleResult().drop) elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.EXECUTE_FIGHT then--猎妖之路 this.ShowBattleResultByExpedition(BattleManager.GetLastBattleResult().drop) elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.GUILD_CAR_DELAY then--车迟 this.ShowBattleResultByCarDeleayType(BattleManager.GetLastBattleResult().drop) elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.MONSTER_CAMP then--兽潮来袭 this.ShowBattleResultByMonsterCamp(BattleManager.GetLastBattleResult().drop) elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.XIAOYAOYOU then if m_battlePanel then m_battlePanel:ClosePanel()end self:ClosePanel() end end end end -- 兽潮来袭结算界面特殊显示 function this.ShowBattleResultByMonsterCamp(drop) if m_battlePanel then m_battlePanel:ClosePanel() end this:ClosePanel() if m_backPanel then UIManager.OpenPanel(m_backPanel) end UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if m_callBack then m_callBack() end --内容优化 心魔试炼推送 Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend,FacePanelType.MonsterWave) end end, nil, not m_notShowRecord) end -- 新关卡战斗结算界面特殊显示 function this.ShowBattleResultByStoryFight(drop) FightPointPassManager.FightBattleEnd() FightPointPassManager.OnBattleEnd(m_battleResult) local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if _BattleBestPopup then _BattleBestPopup:ClosePanel() end if m_battlePanel then m_battlePanel:ClosePanel() end this:ClosePanel() -- 再刷新一便关卡信息 NetManager.InitFightPointLevelInfo() end end, 1, true, true) end) else -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function() if m_battlePanel then m_battlePanel:ClosePanel() end this:ClosePanel() end, 1, true) end end -- 车迟斗法结算界面特殊显示 function this.ShowBattleResultByCarDeleayType(drop) local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup,nil, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then --车迟抢夺cd计时 GuildCarDelayManager.SetCdTime(GuildCarDelayProType.Loot) if _BattleBestPopup then _BattleBestPopup:ClosePanel() end if m_battlePanel then m_battlePanel:ClosePanel() end this:ClosePanel() end end, 3,true,true) end) end end -- 猎妖之路结算界面特殊显示 function this.ShowBattleResultByExpedition(drop) this:ClosePanel() local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 local GetCurNodeInfo = ExpeditionManager.curAttackNodeInfo--ExpeditionManager.GetCurNodeInfo() local func2 = nil if GetCurNodeInfo.type == ExpeditionNodeType.Trail then--试炼节点 func2 = function() Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel) end end UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) --贪婪节点不弹领取圣物 if GetCurNodeInfo.type == ExpeditionNodeType.Greed then--贪婪节点 if drop.itemlist and #drop.itemlist > 0 then LogGreen("m_battleResult.drop.itemlist "..#m_battleResult.drop.itemlist) else LogGreen("贪婪节点无数据") end UIManager.OpenPanel(UIName.RewardItemPopup,drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if m_battlePanel then m_battlePanel:ClosePanel() end if _BattleBestPopup then _BattleBestPopup:ClosePanel() end Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel) end end, 0,true,true) elseif GetCurNodeInfo.type == ExpeditionNodeType.Trail then--试炼节点 if m_battleResult.drop and m_battleResult.drop.soulEquip and #m_battleResult.drop.soulEquip > 0 then for i = 1, #m_battleResult.drop.soulEquip do ExpeditionManager.InitSingleTreasureData(m_battleResult.drop.soulEquip[i]) end end if m_battleResult.drop and m_battleResult.drop.Hero and m_battleResult.drop.Hero[1] then ExpeditionManager.UpdateHeroDatas(m_battleResult.drop.Hero[1]) else LogError("试炼节点数据没有") end if m_battlePanel then m_battlePanel:ClosePanel() end PopupTipPanel.ShowTip(Language[11459]) Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel) else UIManager.OpenPanel(UIName.RewardItemPopup,drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if m_battlePanel then m_battlePanel:ClosePanel() end if _BattleBestPopup then _BattleBestPopup:ClosePanel() end if GetCurNodeInfo.holyEquipID and #GetCurNodeInfo.holyEquipID > 0 then UIManager.OpenPanel(UIName.ExpeditionSelectHalidomPanel,true,function () end) else --此时战斗了但没有圣物 所有直接刷新界面动画 后并刷新界面 Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel) end end end, 0,true,true) end end,func2) end end --添加事件监听(用于子类重写) function BattleWinPopup:AddListener() end --移除事件监听(用于子类重写) function BattleWinPopup:RemoveListener() end function BattleWinPopup:OnSortingOrderChange() Util.AddParticleSortLayer(this.btnWin, self.sortingOrder - orginLayer) orginLayer = self.sortingOrder end --界面打开时调用(用于子类重写) function BattleWinPopup:OnOpen(battlePanel, isBack, fightType, result, showRecord, backPanel, func) hadClick = false if battlePanel then m_battlePanel = battlePanel end if isBack ~= nil then m_isBack = isBack end if fightType then m_fightType = fightType end if result then m_battleResult = result end m_notShowRecord = false if showRecord then m_notShowRecord = showRecord end m_backPanel = nil if backPanel then m_backPanel = backPanel end m_callBack = nil if func then m_callBack = func end -- 闪闪闪,一闪而过,舒服的一批 Timer.New(function() self:NextStep() end, 0.1):Start() end --界面关闭时调用(用于子类重写) function BattleWinPopup:OnClose() end --界面销毁时调用(用于子类重写) function BattleWinPopup:OnDestroy() end return BattleWinPopup