淘汰sceneTemp技术
This commit is contained in:
@@ -5,17 +5,19 @@ local sin=math.sin
|
||||
|
||||
local scene={}
|
||||
|
||||
local selected--Music selected
|
||||
|
||||
local bgmList=BGM.getList()
|
||||
function scene.sceneInit()
|
||||
if BGM.nowPlay then
|
||||
for i=1,BGM.getCount()do
|
||||
if bgmList[i]==BGM.nowPlay then
|
||||
sceneTemp=i--Music selected
|
||||
selected=i
|
||||
return
|
||||
end
|
||||
end
|
||||
else
|
||||
sceneTemp=1
|
||||
selected=1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,15 +25,15 @@ function scene.wheelMoved(_,y)
|
||||
wheelScroll(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
local S=sceneTemp
|
||||
local S=selected
|
||||
if key=="down"then
|
||||
if S<BGM.getCount()then
|
||||
sceneTemp=S+1
|
||||
selected=S+1
|
||||
SFX.play("move",.7)
|
||||
end
|
||||
elseif key=="up"then
|
||||
if S>1 then
|
||||
sceneTemp=S-1
|
||||
selected=S-1
|
||||
SFX.play("move",.7)
|
||||
end
|
||||
elseif key=="return"or key=="space"then
|
||||
@@ -50,13 +52,13 @@ function scene.draw()
|
||||
gc.setColor(1,1,1)
|
||||
|
||||
setFont(50)
|
||||
gc.print(bgmList[sceneTemp],320,355)
|
||||
gc.print(bgmList[selected],320,355)
|
||||
setFont(35)
|
||||
if sceneTemp>1 then gc.print(bgmList[sceneTemp-1],320,350-30)end
|
||||
if sceneTemp<BGM.getCount()then gc.print(bgmList[sceneTemp+1],320,350+65)end
|
||||
if selected>1 then gc.print(bgmList[selected-1],320,350-30)end
|
||||
if selected<BGM.getCount()then gc.print(bgmList[selected+1],320,350+65)end
|
||||
setFont(20)
|
||||
if sceneTemp>2 then gc.print(bgmList[sceneTemp-2],320,350-50)end
|
||||
if sceneTemp<BGM.getCount()-1 then gc.print(bgmList[sceneTemp+2],320,350+110)end
|
||||
if selected>2 then gc.print(bgmList[selected-2],320,350-50)end
|
||||
if selected<BGM.getCount()-1 then gc.print(bgmList[selected+2],320,350+110)end
|
||||
|
||||
gc.draw(IMG.title,840,220,nil,1.5,nil,206,35)
|
||||
if BGM.nowPlay then
|
||||
@@ -77,9 +79,9 @@ scene.widgetList={
|
||||
WIDGET.newText{name="arrow", x=270, y=360,font=45,align="L"},
|
||||
WIDGET.newText{name="now", x=700, y=500,font=50,align="R",hide=function()return not BGM.nowPlay end},
|
||||
WIDGET.newSlider{name="bgm", x=760, y=80,w=400, font=35,disp=WIDGET.lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
|
||||
WIDGET.newButton{name="up", x=200, y=250,w=120, font=55,code=WIDGET.lnk_pressKey("up"),hide=function()return sceneTemp==1 end},
|
||||
WIDGET.newButton{name="up", x=200, y=250,w=120, font=55,code=WIDGET.lnk_pressKey("up"),hide=function()return selected==1 end},
|
||||
WIDGET.newButton{name="play", x=200, y=390,w=120, font=35,code=WIDGET.lnk_pressKey("space")},
|
||||
WIDGET.newButton{name="down", x=200, y=530,w=120, font=55,code=WIDGET.lnk_pressKey("down"),hide=function()return sceneTemp==BGM.getCount()end},
|
||||
WIDGET.newButton{name="down", x=200, y=530,w=120, font=55,code=WIDGET.lnk_pressKey("down"),hide=function()return selected==BGM.getCount()end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user