diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index 6281c307..4301b0af 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -43,16 +43,6 @@ do--function applyXxxSatur(mode) SHADER.fieldSatur:send('k',m[2]) end end -function muteAll() - SETTING.sfx=0 - SETTING.sfx_spawn=0 - SETTING.sfx_warn=0 - SETTING.bgm=0 - SETTING.vib=0 - SETTING.voc=0 - BGM.freshVolume() -end - --Royale mode function randomTarget(P)--Return a random opponent for P diff --git a/parts/scenes/setting_sound.lua b/parts/scenes/setting_sound.lua index 70740453..67fc9b27 100644 --- a/parts/scenes/setting_sound.lua +++ b/parts/scenes/setting_sound.lua @@ -4,6 +4,7 @@ local sin=math.sin local rnd=math.random local scene={} +local soundBeforeMute local last--Last touch time local jump--Animation timer(10 to 0) @@ -79,7 +80,20 @@ scene.widgetList={ WIDGET.newSlider{name="vib", x=300, y=540,w=420,color='lN',unit=10,change=function()VIB(2)end,disp=SETval("vib"),code=SETsto("vib")}, WIDGET.newSlider{name="voc", x=300, y=610,w=420,color='lN',change=function()VOC.play('test')end,disp=SETval("voc"),code=SETsto("voc")}, - WIDGET.newKey{name="mute", x=1160, y=180,w=80,color='lR',code=muteAll,fText=TEXTURE.mute}, + WIDGET.newKey{name="mute", x=1160, y=180,w=80,color='lR',fText=TEXTURE.mute, + code=function() + if SETTING.sfx+SETTING.sfx_spawn+SETTING.sfx_warn+SETTING.bgm+SETTING.vib+SETTING.voc==0 then + if not soundBeforeMute then soundBeforeMute={1,0,.4,.7,0,0}end + SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=unpack(soundBeforeMute) + soundBeforeMute=false + else + soundBeforeMute={ + SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc} + SETTING.sfx,SETTING.sfx_spawn,SETTING.sfx_warn,SETTING.bgm,SETTING.vib,SETTING.voc=0,0,0,0,0,0 + end + BGM.freshVolume() + end + }, WIDGET.newSwitch{name="fine", x=1150, y=270,disp=SETval("fine"),code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end}, WIDGET.newSelector{name="cv", x=1100, y=380,w=200,list={'miya','naki','xiaoya'},disp=function()return cv end,code=function(i)cv=i end},