diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index 2d446fc5..0a1b0dc5 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -57,8 +57,16 @@ function BGM.setChange(func) BGM.onChange=func end function BGM.setVol(v) - assert(type(v)=='number'and v>=0 and v<=1) + assert(type(v)=='number'and v>=0 and v<=1,'Wrong volume') volume=v + if BGM.playing then + if volume>0 then + BGM.playing:setVolume(volume) + BGM.playing:play() + elseif BGM.nowPlay then + BGM.playing:pause() + end + end end function BGM.init(list) BGM.init=nil @@ -92,18 +100,6 @@ function BGM.init(list) LOG("No BGM: "..name,5) end end - function BGM.setVol(v) - assert(type(v)=='number'and v>=0 and v<=1) - volume=v - if BGM.playing then - if volume>0 then - BGM.playing:setVolume(volume) - BGM.playing:play() - elseif BGM.nowPlay then - BGM.playing:pause() - end - end - end function BGM.play(name) name=name or BGM.default if not _tryLoad(name)then return end diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 1e068b58..5b507dc0 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -72,11 +72,11 @@ function SFX.getCount() return #sfxList end function SFX.setVol(v) - assert(type(v)=='number'and v>=0 and v<=1) + assert(type(v)=='number'and v>=0 and v<=1,'Wrong volume') volume=v end function SFX.setStereo(v) - assert(type(v)=='number'and v>=0 and v<=1) + assert(type(v)=='number'and v>=0 and v<=1,'Wrong stereo') stereo=v end diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index e3ac900b..97deb070 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -115,8 +115,9 @@ function scene.keyDown(key) for _=1,12 do scene.keyDown("up")end elseif key=="right"or key=="pagedown"then for _=1,12 do scene.keyDown("down")end - elseif key=="link"then - love.system.openURL(_getList()[selected].url) + elseif key=="application"then + local url=_getList()[selected].url + if url then love.system.openURL(url)end elseif key=="delete"then if inputBox:hasText()then _clearResult() @@ -213,7 +214,7 @@ scene.widgetList={ WIDGET.newText{name='book', x=20,y=15,font=70,align='L',fText=CHAR.icon.zBook}, WIDGET.newText{name='title', x=100,y=15,font=70,align='L'}, inputBox, - WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey"link",hideF=function()return not _getList()[selected].url end}, + WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey"application",hideF=function()return not _getList()[selected].url end}, WIDGET.newKey{name='copy', x=1210,y=655,w=80,font=50,fText=CHAR.icon.copy, code=pressKey"cC"}, WIDGET.newKey{name='up', x=1120,y=475,w=80,font=50,fText=CHAR.key.up, code=pressKey"up",hide=not MOBILE}, WIDGET.newKey{name='down', x=1120,y=565,w=80,font=50,fText=CHAR.key.down, code=pressKey"down",hide=not MOBILE},