三个音频模块升级不再依赖全局变量SETTING

但更新音量的时候必须需手动调用setVol
整理代码
This commit is contained in:
MrZ626
2021-10-16 23:10:15 +08:00
parent 9b6855b424
commit e6a8cf7a10
8 changed files with 59 additions and 36 deletions

View File

@@ -116,7 +116,7 @@ scene.widgetList={
code=function(v)BGM.seek(v*BGM.playing:getDuration())end,
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.freshVolume()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},