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

102 lines
3.0 KiB
Lua

require("Base/BasePanel")
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
--初始化组件(用于子类重写)
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")
this.btn_go = Util.GetGameObject(this.btnClose, "btn_go")
this.btn_go:GetComponent("Image").sprite = this.spLoader:LoadSprite("l_lmmj_qianwanganniu")
this.tipTxt = Util.GetGameObject(self.gameObject, "tipTxt"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function SmallSoldierFailPop:BindEvent()
Util.AddClick(this.btnClose, function()
self:ClosePanel()
end)
Util.AddClick(this.btnGrowUp, function()
-- 跳转到我要变强
JumpManager.GoJump(48001)
end)
Util.AddClick(this.btn_go, function()
self:ClosePanel()
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
end)
end
--添加事件监听(用于子类重写)
function SmallSoldierFailPop:AddListener()
end
--移除事件监听(用于子类重写)
function SmallSoldierFailPop:RemoveListener()
end
function SmallSoldierFailPop:OnSortingOrderChange()
Util.AddParticleSortLayer(this.btnClose, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
end
--界面打开时调用(用于子类重写)
function SmallSoldierFailPop:OnOpen(battlePanel, showRecord, backPanel, _fightType)
this.openTime = GetTimeStamp()
if _fightType then
fightType = _fightType
end
this.tipTxt.text = string.format(Language[12251], FightPointPassManager.soldierLayerId)
this.btnGrowUp:SetActive(true)
if SmallSoldierManager.isAuto then
soliderAutoTimer = Timer.New(function()
self:ClosePanel()
end, 3):Start()
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[10237])
end
end
--界面关闭时调用(用于子类重写)
function SmallSoldierFailPop:OnClose()
Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState, 0)
if soliderAutoTimer then
soliderAutoTimer:Stop()
soliderAutoTimer = nil
end
end
--界面销毁时调用(用于子类重写)
function SmallSoldierFailPop:OnDestroy()
this.spLoader:Destroy()
end
return SmallSoldierFailPop