73 lines
2.1 KiB
Lua
73 lines
2.1 KiB
Lua
require("Base/BasePanel")
|
|
TaiChuMiJuanPanel = Inherit(BasePanel)
|
|
local this = TaiChuMiJuanPanel
|
|
|
|
--初始化组件(用于子类重写)
|
|
function TaiChuMiJuanPanel:InitComponent()
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
-- 屏幕适配修改
|
|
this.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot")
|
|
|
|
this.itemPre = Util.GetGameObject(this.btnRoot, "itemPre")
|
|
|
|
this.title = Util.GetGameObject(this.btnRoot, "title")
|
|
this.grid = Util.GetGameObject(this.btnRoot, "bg/circle/root")
|
|
this.backBtn = Util.GetGameObject(this.btnRoot, "backBtn")
|
|
this.itemPres = {}
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function TaiChuMiJuanPanel:BindEvent()
|
|
Util.AddClick(this.backBtn,function()
|
|
this:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function TaiChuMiJuanPanel:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function TaiChuMiJuanPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
--副本类型 1 综合 2 万象
|
|
function TaiChuMiJuanPanel:OnOpen(data)
|
|
this.data = data
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function TaiChuMiJuanPanel:OnShow(...)
|
|
for i = 1, math.max(#this.itemPres,#this.data) do
|
|
if not this.data[i] then
|
|
this.itemPres[i].go.gameObject:SetActive(false)
|
|
else
|
|
if not this.itemPres[i] then
|
|
this.itemPres[i] = {}
|
|
this.itemPres[i].go = newObjToParent(this.itemPre,this.grid)
|
|
this.itemPres[i].bg = Util.GetGameObject(this.itemPres[i].go, "bg"):GetComponent("Image")
|
|
end
|
|
this.itemPres[i].go.gameObject:SetActive(true)
|
|
this.itemPres[i].bg.sprite = this.data[i].sprite
|
|
Util.AddOnceClick(this.itemPres[i].go,function()
|
|
SDKMgr:OpenWeb(this.data[i].linkAddress)
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function TaiChuMiJuanPanel:OnClose()
|
|
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function TaiChuMiJuanPanel:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
this.itemPres = {}
|
|
end
|
|
|
|
return TaiChuMiJuanPanel |