在alg UI下面 创建顶部按钮文件夹 ,



把main 函数复制过去
function main()
local function btn(layou,topbtn1,topbtn2)
stasus=not stasus
--设置隐藏容器显示或隐藏
--GUI:setVisible(layou,not stasus)
--SL:Print(stasus)
if stasus then
GUI:runAction(layou, GUI:ActionMoveBy(0.2, 450, 0))
else
GUI:runAction(layou, GUI:ActionMoveBy(0.2, -450, 0))
end
GUI:setVisible(topbtn1,stasus)
GUI:setVisible(topbtn2,not stasus)
--获取2的坐标 --把1的坐标设置成2的坐标
local pos=GUI:getPosition(topbtn2)
GUI:setPosition(topbtn1,pos)
end
GUI:addOnClickEvent(_uiDelegate.topbtn1,function ()
if not stasus then stasus=true end
btn(_uiDelegate.Layout_1,_uiDelegate.topbtn1,_uiDelegate.topbtn2)
end)
GUI:addOnClickEvent(_uiDelegate.topbtn2,function ()
stasus=false
btn(_uiDelegate.Layout_1,_uiDelegate.topbtn1,_uiDelegate.topbtn2)
end)
GUI:addOnClickEvent(_uiDelegate.wopbtn1,function ()
if not stasus then stasus=true end
btn(_uiDelegate.Layout_2,_uiDelegate.wopbtn1,_uiDelegate.wopbtn2)
end)
GUI:addOnClickEvent(_uiDelegate.wopbtn2,function ()
stasus=false
btn(_uiDelegate.Layout_2,_uiDelegate.wopbtn1,_uiDelegate.wopbtn2)
end)
GUI:setVisible(_uiDelegate.topbtn1,false)
GUI:setVisible(_uiDelegate.wopbtn1,false)
end
视频效果
|