Skip to content

Commit

Permalink
修复有两个音效关了声音开关也会响
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Aug 3, 2024
1 parent ea7c2f6 commit 5b517c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local DATA = {
for i = 1, 5 do DATA.tickMat[i] = TABLE.new(0, 5) end
local suc, res = pcall(FILE.load, 'data.json', '-json')
if suc then TABLE.update(DATA, res) end
SFX.setVol(DATA.sound and 1 or 0)

BGM.load('naive', 'naive.ogg')
TASK.new(function()
Expand Down Expand Up @@ -778,9 +779,7 @@ function scene.mouseMove(x, y)
end
dragging[cx .. cy] = true
DATA.tickMat[cy][cx] = 1 - DATA.tickMat[cy][cx]
if DATA.sound then
SFX.play(DATA.tickMat[cy][cx] == 1 and 'tick' or 'untick')
end
SFX.play(DATA.tickMat[cy][cx] == 1 and 'tick' or 'untick')
end
end
end
Expand Down Expand Up @@ -960,6 +959,7 @@ scene.widgetList = {
disp = TABLE.func_getVal(DATA, 'sound'),
code = function()
DATA.sound = not DATA.sound
SFX.setVol(DATA.sound and 1 or 0)
if DATA.sound then
BGM.play('naive')
if hardMode then
Expand Down

0 comments on commit 5b517c9

Please sign in to comment.