miduo_client/Assets/ManagedResources/~Lua/Modules/Map/TrialMiniGame/TrialMiniGamePanel.lua

71 lines
2.1 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-06-13 11:47:13 +08:00
local BuffChoosePanel = Inherit(BasePanel)
local this = BuffChoosePanel
local _LogicConfig = {
[13] = require("Modules/Map/TrialMiniGame/Logic/Game_13"),
2020-06-19 20:19:35 +08:00
[14] = require("Modules/Map/TrialMiniGame/Logic/Game_14"),
[15] = require("Modules/Map/TrialMiniGame/Logic/Game_15"),
[16] = require("Modules/Map/TrialMiniGame/Logic/Game_16"),
[17] = require("Modules/Map/TrialMiniGame/Logic/Game_17"),
2020-06-23 18:36:24 +08:00
[18] = require("Modules/Map/TrialMiniGame/Logic/Game_18"),
2020-06-13 11:47:13 +08:00
}
--初始化组件(用于子类重写)
function BuffChoosePanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-06-13 11:47:13 +08:00
this.btnBack = Util.GetGameObject(self.gameObject, "mask")
this._ViewConfig = {}
for type, _ in pairs(_LogicConfig) do
this._ViewConfig[type] = Util.GetGameObject(self.gameObject, "Game_"..type)
end
end
--绑定事件(用于子类重写)
function BuffChoosePanel:BindEvent()
Util.AddClick(this.btnBack, function()
2020-07-20 16:42:20 +08:00
-- this:ClosePanel()
2020-06-13 11:47:13 +08:00
end)
end
--添加事件监听(用于子类重写)
function BuffChoosePanel:AddListener()
end
--移除事件监听(用于子类重写)
function BuffChoosePanel:RemoveListener()
end
--界面打开时调用(用于子类重写)
function BuffChoosePanel:OnOpen(gameType, gameId, gameParams)
this.logic = _LogicConfig[gameType]
this.logic.Init(self, this._ViewConfig[gameType], gameType, gameId, gameParams)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function BuffChoosePanel:OnShow()
2020-06-19 20:19:35 +08:00
for index, value in pairs(this._ViewConfig) do
value:SetActive(false)
end
-- this._ViewConfig[gameType]--再打开
2020-06-13 11:47:13 +08:00
this.logic.Show()
end
--界面关闭时调用(用于子类重写)
function BuffChoosePanel:OnClose()
this.logic.Close()
TrialMiniGameManager.GameClose()
end
--界面销毁时调用(用于子类重写)
function BuffChoosePanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
for i, logic in pairs(_LogicConfig) do
if logic.Destroy then
logic.Destroy()
end
end
2020-06-13 11:47:13 +08:00
end
2020-06-23 18:36:24 +08:00
return BuffChoosePanel