UI界面显示与隐藏,菜单按钮的实现
local panel = class.panel:builder
{
type = 'panel',
x = 0,
y = 0,
w = 1920,
h = 1080,
}
panel:hide() --通过脚本创建的UI,默认是显示的,因此需要在此调用 :hide() 使其隐藏。local btnA = class.button:builder
{
type = 'button',
x = 100,
y = 100,
w = 60,
h = 20,
m_text = {
type = 'text',
x = 0,
y = 0,
w = 60,
h = 20,
text = '显示'
},
on_button_clicked = function(self)
on_click_button(1)
end,
}
local btnB = class.button:builder
{
type = 'button',
x = 100,
y = 100,
w = 60,
h = 20,
m_text = {
type = 'text',
x = 0,
y = 0,
w = 60,
h = 20,
text = '隐藏'
},
on_button_clicked = function(self)
on_click_button(2)
end,
}Last updated