按钮侧滑栏的添加
2023-01-24 09:16:15 最后更新
t()
{
//背景墙id,用来当侧滑栏
s id=1
swh("h",h)
us(id,"x",0)
us(id,"h",h)
us(id,"w",0)
//设置默认侧滑栏不可视
us(id,"show",8)
us(id,"y",0)
//在侧滑栏里的控件id,多个用英文 YI 分割开
//注意:侧滑栏的控件一定要在背景墙之上才能显示
s Kong="3YI4"
//侧滑栏宽度
s kuan=100
f(Kong?"YI")
{
//设置控件x坐标为0
//设置控件宽度为侧滑栏宽度
sl(Kong,"YI",ls)
for(ss;ls)
{
us(ss,"w",kuan)
us(ss,"x",0)
us(ss,"show",8)
}
}
else
{
us(Kong,"w",kuan)
us(Kong,"x",0)
us(Kong,"show",8)
}
}
//按钮事件
t()
{
//背景墙id
s id=1
ug(id,"w",w)
ug(id,"show",a)
//侧滑栏弹出速度,越大越快
s su=10
s(kuan+su,js)
//加入判断,防止用户快速点击导致出错
f(w==0||w==js)
{
f(a==8)
{
us(id,"show",0)
w(w<=kuan)
{
ug(id,"w",w)
s(w+su,w)
us(id,"w",w)
}
f(Kong?"YI")
{
sl(Kong,"YI",ls)
for(ss;ls)
{
us(ss,"show",0)
}
}
else
{
us(Kong,"show",0)
}
}
else
{
f(Kong?"YI")
{
sl(Kong,"YI",ls)
for(ss;ls)
{
us(ss,"show",8)
}
}
else
{
us(Kong,"show",8)
}
w(w>0)
{
ug(id,"w",w)
s(w-su,w)
us(id,"w",w)
}
us(id,"show",8)
}
}
}