整 理 代 码
(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
@@ -21,11 +21,11 @@ local playing
|
||||
local selected--Music selected
|
||||
|
||||
local bgmList=BGM.getList()
|
||||
if #bgmList==0 then bgmList={"[NO BGM]"}end
|
||||
if #bgmList==0 then bgmList={"[NO BGM]"} end
|
||||
|
||||
function scene.sceneInit()
|
||||
playing=BGM.getPlaying()[1]
|
||||
selected=TABLE.find(bgmList,playing)or 1
|
||||
selected=TABLE.find(bgmList,playing) or 1
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
@@ -33,31 +33,31 @@ 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('touch',.7)
|
||||
end
|
||||
elseif key=='up'then
|
||||
elseif key=='up' then
|
||||
if S>1 then
|
||||
selected=S-1
|
||||
SFX.play('touch',.7)
|
||||
end
|
||||
elseif not isRep then
|
||||
if key=='return'or key=='space'then
|
||||
if key=='return' or key=='space' then
|
||||
playing=BGM.getPlaying()[1]
|
||||
if playing~=bgmList[S]then
|
||||
if playing~=bgmList[S] then
|
||||
BGM.play(bgmList[S])
|
||||
SFX.play('click')
|
||||
else
|
||||
BGM.stop()
|
||||
SFX.play('click')
|
||||
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
|
||||
elseif #key==1 and key:find'[0-9a-z]' then
|
||||
for _=1,#bgmList do
|
||||
selected=selected%#bgmList+1
|
||||
if bgmList[selected]:sub(1,1)==key then break end
|
||||
@@ -91,11 +91,11 @@ function scene.draw()
|
||||
setFont(50)
|
||||
GC.print(bgmList[selected],320,355)
|
||||
setFont(35)
|
||||
if selected>1 then GC.print(bgmList[selected-1],322,350-30)end
|
||||
if selected<#bgmList then GC.print(bgmList[selected+1],322,350+65)end
|
||||
if selected>1 then GC.print(bgmList[selected-1],322,350-30) end
|
||||
if selected<#bgmList then GC.print(bgmList[selected+1],322,350+65) end
|
||||
setFont(20)
|
||||
if selected>2 then GC.print(bgmList[selected-2],322,350-50)end
|
||||
if selected<#bgmList-1 then GC.print(bgmList[selected+2],322,350+110)end
|
||||
if selected>2 then GC.print(bgmList[selected-2],322,350-50) end
|
||||
if selected<#bgmList-1 then GC.print(bgmList[selected+2],322,350+110) end
|
||||
|
||||
--Title
|
||||
if playing then
|
||||
@@ -113,7 +113,7 @@ function scene.draw()
|
||||
GC.print(playing,710,508)
|
||||
setFont(35)
|
||||
GC.setColor(1,sin(t*2.6)*.5+.5,sin(t*2.6)*.5+.5)
|
||||
GC.print(author[playing]or"MrZ",670,465)
|
||||
GC.print(author[playing] or "MrZ",670,465)
|
||||
|
||||
setFont(20)
|
||||
GC.setColor(COLOR.Z)
|
||||
@@ -126,17 +126,17 @@ end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name='title', x=30,y=30,font=80,align='L'},
|
||||
WIDGET.newText{name='arrow', x=270,y=360,font=45,align='L'},
|
||||
WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function()return not playing end},
|
||||
WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function() return not playing end},
|
||||
WIDGET.newSlider{name='slide',x=480,y=600,w=400,
|
||||
disp=function()return BGM.tell()/BGM.getDuration()%1 end,
|
||||
disp=function() return BGM.tell()/BGM.getDuration()%1 end,
|
||||
show=false,
|
||||
code=function(v)BGM.set('all','seek',v*BGM.getDuration())end,
|
||||
hideF=function()return not playing end
|
||||
code=function(v) BGM.set('all','seek',v*BGM.getDuration()) end,
|
||||
hideF=function() return not playing 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,sound=false,code=pressKey'up',hideF=function()return selected==1 end,font=60,fText=CHAR.key.up},
|
||||
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,sound=false,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,sound=false,font=65,fText=CHAR.icon.play_pause,code=pressKey'space'},
|
||||
WIDGET.newButton{name='down', x=200,y=530,w=120,sound=false,code=pressKey'down',hideF=function()return selected==#bgmList end,font=60,fText=CHAR.key.down},
|
||||
WIDGET.newButton{name='down', x=200,y=530,w=120,sound=false,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,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user