Fix Disable theme and Lock B.G.'s weird behaviors (#1091)

This commit is contained in:
SweetSea
2024-02-22 10:07:41 +07:00
committed by GitHub
parent 7e1a5805b3
commit 1859e5bb96
4 changed files with 10 additions and 6 deletions

View File

@@ -161,8 +161,12 @@ do-- function applySettings()
if SETTING.bg=='on' then
BG.unlock()
BG.setDefault(SETTING.defaultBG)
if SETTING.lockBG then
BG.lock()
elseif reason=='lockBG' then -- Don't load theme too soon!
THEME.set(THEME.calculate(),GAME.playing)
end
BG.set()
if SETTING.lockBG then BG.lock() end
elseif SETTING.bg=='off' then
BG.unlock()
BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha)

View File

@@ -350,7 +350,7 @@ scene.widgetList={
WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=CUSval('phyHold'),code=CUSrev('phyHold'),hideF=function() return CUSTOMGAME_LOCAL.customenv.holdCount==0 end},
-- BG & BGM
WIDGET.newSelector{name='bg', x=840, y=1100,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i) CUSTOMGAME_LOCAL.customenv.bg=i BG.set(i) end},
WIDGET.newSelector{name='bg', x=840, y=1100,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i) CUSTOMGAME_LOCAL.customenv.bg=i BG.set(i) end,hideF=SETval('lockBG')},
WIDGET.newSelector{name='bgm', x=1120,y=1100,w=250,color='Y',list=BGM.getList(),disp=CUSval('bgm'),code=function(i) CUSTOMGAME_LOCAL.customenv.bgm=i BGM.play(i) end},
}

View File

@@ -135,7 +135,7 @@ scene.widgetList={
disp=SETval('lockBG'),
code=function()
SETTING.lockBG=not SETTING.lockBG
applySettings()
applySettings('lockBG')
end,
hideF=function() return SETTING.bg~='on' end
},
@@ -150,7 +150,7 @@ scene.widgetList={
MES.new('warn',text.settingWarn2,6.26)
end
else
THEME.set(THEME.calculate())
THEME.set(THEME.calculate(),GAME.playing)
WIDGET.setWidgetList(scene.widgetList)
end
end

View File

@@ -58,7 +58,7 @@ function THEME.calculate(Y,M,D)
)
end
function THEME.set(theme)
function THEME.set(theme,keepBGM)
if type(theme)=='string' and theme:sub(1,6)=='season' then
BG.setDefault(SETTING.defaultBG)
BGM.setDefault(({season1='null',season2='nil',season3='vaccum',season4='space'})[theme])
@@ -99,7 +99,7 @@ function THEME.set(theme)
THEME.cur=theme
BG.set()
BGM.play()
if not keepBGM then BGM.play() end
return true
end