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

102 lines
3.0 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
require("Base/BasePanel")
2024-04-24 15:52:30 +08:00
SmallSoldierFailPop = Inherit(BasePanel)
local this = SmallSoldierFailPop
local m_battlePanel
local m_showRecord = true
local m_backPanel
local orginLayer
local fightType
local isBackBattle = false
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local soliderAutoTimer
2024-04-24 15:52:30 +08:00
--初始化组件(用于子类重写)
function SmallSoldierFailPop: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.btnGrowUp = Util.GetGameObject(this.btnClose, "btnGrowUp")
2024-04-28 11:28:05 +08:00
this.btn_go = Util.GetGameObject(this.btnClose, "btn_go")
2024-09-06 10:38:56 +08:00
this.btn_go:GetComponent("Image").sprite = this.spLoader:LoadSprite("l_lmmj_qianwanganniu")
this.tipTxt = Util.GetGameObject(self.gameObject, "tipTxt"):GetComponent("Text")
2024-04-24 15:52:30 +08:00
end
--绑定事件(用于子类重写)
function SmallSoldierFailPop:BindEvent()
2024-09-06 10:38:56 +08:00
Util.AddClick(this.btnClose, function()
2024-04-24 15:52:30 +08:00
self:ClosePanel()
end)
2024-09-06 10:38:56 +08:00
Util.AddClick(this.btnGrowUp, function()
2024-04-24 15:52:30 +08:00
-- 跳转到我要变强
JumpManager.GoJump(48001)
end)
2024-09-06 10:38:56 +08:00
Util.AddClick(this.btn_go, function()
2024-04-28 11:28:05 +08:00
self:ClosePanel()
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
end)
2024-04-24 15:52:30 +08:00
end
--添加事件监听(用于子类重写)
function SmallSoldierFailPop:AddListener()
end
--移除事件监听(用于子类重写)
function SmallSoldierFailPop:RemoveListener()
end
function SmallSoldierFailPop:OnSortingOrderChange()
Util.AddParticleSortLayer(this.btnClose, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
end
--界面打开时调用(用于子类重写)
2024-09-06 10:38:56 +08:00
function SmallSoldierFailPop:OnOpen(battlePanel, showRecord, backPanel, _fightType)
2024-04-24 15:52:30 +08:00
this.openTime = GetTimeStamp()
if _fightType then
fightType = _fightType
end
2024-09-06 10:38:56 +08:00
this.tipTxt.text = string.format(Language[12251], FightPointPassManager.soldierLayerId)
2024-04-25 17:35:19 +08:00
this.btnGrowUp:SetActive(true)
if SmallSoldierManager.isAuto then
2024-09-06 10:38:56 +08:00
soliderAutoTimer = Timer.New(function()
self:ClosePanel()
end, 3):Start()
end
2024-04-24 15:52:30 +08:00
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
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[10237])
2024-04-24 15:52:30 +08:00
end
end
--界面关闭时调用(用于子类重写)
function SmallSoldierFailPop:OnClose()
2024-09-06 10:38:56 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState, 0)
if soliderAutoTimer then
soliderAutoTimer:Stop()
2024-09-06 10:38:56 +08:00
soliderAutoTimer = nil
end
2024-04-24 15:52:30 +08:00
end
--界面销毁时调用(用于子类重写)
function SmallSoldierFailPop:OnDestroy()
this.spLoader:Destroy()
end
2024-09-06 10:38:56 +08:00
return SmallSoldierFailPop