整理代码,表示键盘按键的字符串使用单引号
This commit is contained in:
@@ -40,18 +40,18 @@ function scene.wheelMoved(_,y)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
local S=selected
|
||||
if key=="down"then
|
||||
if key=='down'then
|
||||
if S<#bgmList then
|
||||
selected=S+1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif key=="up"then
|
||||
elseif key=='up'then
|
||||
if S>1 then
|
||||
selected=S-1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
elseif not isRep then
|
||||
if key=="return"or key=="space"then
|
||||
if key=='return'or key=='space'then
|
||||
if BGM.nowPlay~=bgmList[S]then
|
||||
BGM.play(bgmList[S])
|
||||
if SETTING.bgm>0 then
|
||||
@@ -60,9 +60,9 @@ function scene.keyDown(key,isRep)
|
||||
else
|
||||
BGM.stop()
|
||||
end
|
||||
elseif key=="tab"then
|
||||
elseif key=='tab'then
|
||||
SCN.swapTo('launchpad','none')
|
||||
elseif key=="escape"then
|
||||
elseif key=='escape'then
|
||||
SCN.back()
|
||||
elseif #key==1 and key:find'[0-9a-z]'then
|
||||
for _=1,#bgmList do
|
||||
@@ -124,10 +124,10 @@ scene.widgetList={
|
||||
hideF=function()return not BGM.nowPlay end
|
||||
},
|
||||
WIDGET.newSlider{name='bgm', x=760,y=80,w=400,disp=SETval('bgm'),code=function(v)SETTING.bgm=v BGM.setVol(SETTING.bgm)end},
|
||||
WIDGET.newButton{name='up', x=200,y=250,w=120,code=pressKey"up",hideF=function()return selected==1 end,font=60,fText=CHAR.key.up},
|
||||
WIDGET.newButton{name='play', x=200,y=390,w=120,code=pressKey"space",font=65,fText=CHAR.icon.play_pause},
|
||||
WIDGET.newButton{name='down', x=200,y=530,w=120,code=pressKey"down",hideF=function()return selected==#bgmList end,font=60,fText=CHAR.key.down},
|
||||
WIDGET.newButton{name='sound',x=1140,y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
||||
WIDGET.newButton{name='up', x=200,y=250,w=120,code=pressKey'up',hideF=function()return selected==1 end,font=60,fText=CHAR.key.up},
|
||||
WIDGET.newButton{name='play', x=200,y=390,w=120,code=pressKey'space',font=65,fText=CHAR.icon.play_pause},
|
||||
WIDGET.newButton{name='down', x=200,y=530,w=120,code=pressKey'down',hideF=function()return selected==#bgmList end,font=60,fText=CHAR.key.down},
|
||||
WIDGET.newButton{name='sound',x=1140,y=540,w=170,h=80,font=40,code=pressKey'tab'},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user