miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/BattleWinPopup.lua

219 lines
8.2 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
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()
2020-06-03 19:09:01 +08:00
-- Util.AddClick(this.btnWin, function ()
-- self:NextStep()
-- 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 == 2 then --副本战斗结算
-- UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 2, function()
MapManager.DropAddShotTimeBag(m_battleResult.drop)
UIManager.OpenPanel(UIName.BattleEndPanel, m_battlePanel, m_battleResult.hpList, m_battleResult.drop, function() m_battlePanel:ClosePanel() self:ClosePanel() end, true)
-- end)
elseif m_fightType == 3 then --限时怪战斗结算
UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function() m_battlePanel:ClosePanel() self:ClosePanel() end, 1, true)
elseif m_fightType == 5 then -- 兽潮来袭
UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function()
2020-05-09 13:31:21 +08:00
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
2020-06-03 19:09:01 +08:00
if m_backPanel then
UIManager.OpenPanel(m_backPanel)
end
2020-05-09 13:31:21 +08:00
2020-06-03 19:09:01 +08:00
if m_callBack then m_callBack() end
end, nil, not m_notShowRecord)
elseif m_fightType == 6 then -- 新关卡的战斗
FightPointPassManager.FightBattleEnd()
FightPointPassManager.OnBattleEnd(m_battleResult)
local bestData, allDamage= BattleRecordManager.GetBattleBestData()
if bestData then
-- 胜利显示本场比赛的表现最好的英雄
UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId, bestData.damage, allDamage, function(_BattleBestPopup)
2020-05-09 13:31:21 +08:00
-- 打开关卡奖励界面
UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function()
2020-06-03 19:09:01 +08:00
if _BattleBestPopup then
_BattleBestPopup:ClosePanel()
end
2020-05-09 13:31:21 +08:00
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
2020-06-03 19:09:01 +08:00
end, 1, true, true)
end)
else
-- 打开关卡奖励界面
UIManager.OpenPanel(UIName.RewardItemPopup, m_battleResult.drop, 1,function()
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
end, 1, true)
end
elseif m_fightType == 8 then -- 远征
local GetCurNodeInfo = ExpeditionManager.curAttackNodeInfo--ExpeditionManager.GetCurNodeInfo()
local keys = GameDataBase.SheetBase.GetKeys(ConfigManager.GetConfig(ConfigName.ExpeditionFloorConfig))
--Log("GetCurNodeInfo.lay == #keys "..GetCurNodeInfo.lay .." ".. #keys.." "..GetCurNodeInfo.state)
if GetCurNodeInfo.lay == #keys and GetCurNodeInfo.state == ExpeditionNodeState.Finish then--打完最后一层
UIManager.OpenPanel(UIName.RewardItemPopup,m_battleResult.drop, 1,function()
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
if
UIManager.GetOpenPanel(UIName.ExpeditionMainPanel) then
UIManager.OpenPanel(UIName.ExpeditionMainPanel)
end
end)
else
--贪婪节点不弹领取圣物
--LogError("GetCurNodeInfo.type "..GetCurNodeInfo.type)
if GetCurNodeInfo.type == ExpeditionNodeType.Greed then--贪婪节点
2020-05-09 13:31:21 +08:00
UIManager.OpenPanel(UIName.RewardItemPopup,m_battleResult.drop, 1,function()
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
end)
2020-06-03 19:09:01 +08:00
elseif GetCurNodeInfo.type == ExpeditionNodeType.Trail then--试炼节点
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
self:ClosePanel()
2020-05-09 13:31:21 +08:00
else
2020-06-03 19:09:01 +08:00
UIManager.OpenPanel(UIName.RewardItemPopup,m_battleResult.drop, 1,function()
UIManager.OpenPanel(UIName.ExpeditionSelectHalidomPanel,true,function ()
2020-05-09 13:31:21 +08:00
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
end)
2020-06-03 19:09:01 +08:00
end)
end
end
elseif m_fightType==9 then
m_battlePanel:ClosePanel() self:ClosePanel()
elseif m_fightType == 10 then -- 新关卡的战斗
local bestData, allDamage= BattleRecordManager.GetBattleBestData()
if bestData then
-- 胜利显示本场比赛的表现最好的英雄
UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId, bestData.damage, allDamage, function(_BattleBestPopup)
-- 打开关卡奖励界面
UIManager.OpenPanel(UIName.RewardItemPopup,nil, 1,function()
--车迟抢夺cd计时
GuildCarDelayManager.SetCdTime(GuildCarDelayProType.Loot)
if _BattleBestPopup then
_BattleBestPopup:ClosePanel()
2020-05-25 19:16:23 +08:00
end
if m_battlePanel then
m_battlePanel:ClosePanel()
end
self:ClosePanel()
2020-06-03 19:09:01 +08:00
end, 3,true,true)
end)
2020-05-09 13:31:21 +08:00
end
end
2020-06-03 19:09:01 +08:00
end
2020-05-09 13:31:21 +08:00
end
--添加事件监听(用于子类重写)
function BattleWinPopup:AddListener()
end
--移除事件监听(用于子类重写)
function BattleWinPopup:RemoveListener()
end
function BattleWinPopup:OnSortingOrderChange()
Util.AddParticleSortLayer(this.btnWin, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
end
--界面打开时调用(用于子类重写)
2020-06-03 19:09:01 +08:00
function BattleWinPopup:OnOpen(battlePanel, isBack, fightType, result, showRecord, backPanel, func)
2020-05-09 13:31:21 +08:00
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
2020-06-03 19:09:01 +08:00
-- 闪闪闪,一闪而过,舒服的一批
Timer.New(function()
self:NextStep()
end, 0.1):Start()
2020-05-09 13:31:21 +08:00
end
--界面关闭时调用(用于子类重写)
function BattleWinPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function BattleWinPopup:OnDestroy()
end
return BattleWinPopup