miduo_client/Assets/ManagedResources/~Lua/Modules/FightLevel/FightLevelOpenChapterPopup.lua

58 lines
2.1 KiB
Lua

require("Base/BasePanel")
FightLevelOpenChapterPopup = Inherit(BasePanel)
local this = FightLevelOpenChapterPopup
local orginLayer
local chapterDataId = 0
--初始化组件(用于子类重写)
function FightLevelOpenChapterPopup:InitComponent()
this.spLoader = SpriteLoader.New()
self.btnBack = Util.GetGameObject(self.gameObject, "CloseBtn")
this.titleImage = Util.GetGameObject(self.gameObject, "bg/titleImage"):GetComponent("Image")
this.chapterName = Util.GetGameObject(self.gameObject, "bg/ziImage/Text"):GetComponent("Text")
this.chapterImage = Util.GetGameObject(self.gameObject, "bg/chapterImage"):GetComponent("Image")
end
--绑定事件(用于子类重写)
function FightLevelOpenChapterPopup:BindEvent()
Util.AddClick(self.btnBack, function()
self:ClosePanel()
end)
end
function FightLevelOpenChapterPopup:OnSortingOrderChange()
orginLayer = self.sortingOrder
end
--界面打开时调用(用于子类重写)
function FightLevelOpenChapterPopup:OnOpen(_chapterDataid)
chapterDataId = _chapterDataid
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function FightLevelOpenChapterPopup:OnShow()
this.OnShowPanel()
end
function this.OnShowPanel()
local config = ConfigManager.GetConfigData(ConfigName.HardStageChapter,chapterDataId)
this.titleImage.sprite = this.spLoader:LoadSprite("j_jsxgq_biaoti")
this.chapterName.text = config.Name
this.chapterImage.sprite = this.spLoader:LoadSprite(config.Map)
end
--界面关闭时调用(用于子类重写)
function FightLevelOpenChapterPopup:OnClose()
FightLevelManager.SetisShowChapterOpenPopup(false)
-- if UIManager.IsOpen(UIName.FightLevelSingleChapterPanel) then
local curFightLevelSingleChapterPanel = UIManager.GetOpenPanel(UIName.FightLevelSingleChapterPanel)
if curFightLevelSingleChapterPanel then
curFightLevelSingleChapterPanel.LeftOrRightBtnClickEvent(2)
end
-- end
end
--界面销毁时调用(用于子类重写)
function FightLevelOpenChapterPopup:OnDestroy()
this.spLoader:Destroy()
end
return FightLevelOpenChapterPopup