静音按钮再次点击可以重新开启声音了

This commit is contained in:
MrZ626
2021-08-03 01:27:13 +08:00
parent 7407bbefdf
commit 1aa991f89f
2 changed files with 15 additions and 11 deletions

View File

@@ -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

View File

@@ -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},