涉及框架的设置项统一应用,不再细分时机
修改errData的获得方式 WIDGET新增setOnChange方法,不再依赖THEME
This commit is contained in:
@@ -109,23 +109,7 @@ end
|
||||
function saveSettings()
|
||||
return saveFile(SETTING,'conf/settings')
|
||||
end
|
||||
function applyLanguage()
|
||||
text=LANG.get(SETTING.locale)
|
||||
WIDGET.setLang(text.WidgetText)
|
||||
for k,v in next,TEXTOBJ do
|
||||
if rawget(text,k)then
|
||||
v:set(text[k])
|
||||
end
|
||||
end
|
||||
end
|
||||
function applyCursor()
|
||||
love.mouse.setVisible(SETTING.sysCursor)
|
||||
end
|
||||
function applyFullscreen()
|
||||
love.window.setFullscreen(SETTING.fullscreen)
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
end
|
||||
do--function applyBlockSatur,applyFieldSatur(mode)
|
||||
do--function applySettings()
|
||||
local saturateValues={
|
||||
normal={0,1},
|
||||
soft={.2,.7},
|
||||
@@ -133,58 +117,79 @@ do--function applyBlockSatur,applyFieldSatur(mode)
|
||||
light={.2,.8},
|
||||
color={-.2,1.2},
|
||||
}
|
||||
function applyBlockSatur(mode)
|
||||
local m=saturateValues[mode]or saturateValues.normal
|
||||
function applySettings()
|
||||
--Apply fullscreen
|
||||
love.window.setFullscreen(SETTING.fullscreen)
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
|
||||
--Apply Zframework setting
|
||||
Z.setClickFX(SETTING.clickFX)
|
||||
Z.setFrameMul(SETTING.frameMul)
|
||||
Z.setPowerInfo(SETTING.powerInfo)
|
||||
Z.setCleanCanvas(SETTING.cleanCanvas)
|
||||
|
||||
--Apply VK shape
|
||||
VK.setShape(SETTING.VKSkin)
|
||||
|
||||
--Apply sound
|
||||
love.audio.setVolume(SETTING.mainVol)
|
||||
BGM.setVol(SETTING.bgm)
|
||||
SFX.setVol(SETTING.sfx)
|
||||
VOC.setVol(SETTING.voc)
|
||||
|
||||
--Apply saturs
|
||||
local m
|
||||
m=saturateValues[SETTING.blockSatur]or saturateValues.normal
|
||||
SHADER.blockSatur:send('b',m[1])
|
||||
SHADER.blockSatur:send('k',m[2])
|
||||
end
|
||||
function applyFieldSatur(mode)
|
||||
local m=saturateValues[mode]or saturateValues.normal
|
||||
m=saturateValues[SETTING.fieldSatur]or saturateValues.normal
|
||||
SHADER.fieldSatur:send('b',m[1])
|
||||
SHADER.fieldSatur:send('k',m[2])
|
||||
end
|
||||
end
|
||||
function applyBG()
|
||||
if SETTING.bg=='on'then
|
||||
BG.unlock()
|
||||
BG.set()
|
||||
elseif SETTING.bg=='off'then
|
||||
BG.unlock()
|
||||
BG.set('gray')
|
||||
BG.send(SETTING.bgAlpha)
|
||||
BG.lock()
|
||||
elseif SETTING.bg=='custom'then
|
||||
if love.filesystem.getInfo('conf/customBG')then
|
||||
local res,image=pcall(gc.newImage,love.filesystem.newFile('conf/customBG'))
|
||||
if res then
|
||||
BG.unlock()
|
||||
BG.set('custom')
|
||||
gc.setDefaultFilter('linear','linear')
|
||||
BG.send(SETTING.bgAlpha,image)
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
BG.lock()
|
||||
else
|
||||
MES.new('error',text.customBGloadFailed)
|
||||
|
||||
--Apply language
|
||||
text=LANG.get(SETTING.locale)
|
||||
WIDGET.setLang(text.WidgetText)
|
||||
for k,v in next,TEXTOBJ do
|
||||
if rawget(text,k)then
|
||||
v:set(text[k])
|
||||
end
|
||||
end
|
||||
|
||||
--Apply cursor
|
||||
love.mouse.setVisible(SETTING.sysCursor)
|
||||
|
||||
--Apply BG
|
||||
if SETTING.bg=='on'then
|
||||
BG.unlock()
|
||||
BG.set()
|
||||
elseif SETTING.bg=='off'then
|
||||
BG.unlock()
|
||||
BG.set('gray')
|
||||
BG.send(SETTING.bgAlpha)
|
||||
BG.lock()
|
||||
elseif SETTING.bg=='custom'then
|
||||
if love.filesystem.getInfo('conf/customBG')then
|
||||
local res,image=pcall(gc.newImage,love.filesystem.newFile('conf/customBG'))
|
||||
if res then
|
||||
BG.unlock()
|
||||
BG.set('custom')
|
||||
gc.setDefaultFilter('linear','linear')
|
||||
BG.send(SETTING.bgAlpha,image)
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
BG.lock()
|
||||
else
|
||||
MES.new('error',text.customBGloadFailed)
|
||||
end
|
||||
else--Switch off when custom BG not found
|
||||
SETTING.bg='off'
|
||||
BG.unlock()
|
||||
BG.set('gray')
|
||||
BG.send(SETTING.bgAlpha)
|
||||
BG.lock()
|
||||
end
|
||||
else
|
||||
SETTING.bg='off'
|
||||
applyBG()
|
||||
end
|
||||
end
|
||||
end
|
||||
function applyAllSettings()
|
||||
applyFullscreen()
|
||||
love.audio.setVolume(SETTING.mainVol)
|
||||
VK.setShape(SETTING.VKSkin)
|
||||
BGM.setVol(SETTING.bgm)
|
||||
SFX.setVol(SETTING.sfx)
|
||||
VOC.setVol(SETTING.voc)
|
||||
applyBlockSatur(SETTING.blockSatur)
|
||||
applyFieldSatur(SETTING.fieldSatur)
|
||||
applyLanguage()
|
||||
applyCursor()
|
||||
applyBG()
|
||||
end
|
||||
|
||||
--Royale mode
|
||||
function randomTarget(P)--Return a random opponent for P
|
||||
|
||||
@@ -279,7 +279,7 @@ function NET.loadSavedData(sections)
|
||||
|
||||
TABLE.cover(NET.cloudData.SETTING,SETTING)
|
||||
success=success and saveSettings()
|
||||
applyAllSettings()
|
||||
applySettings()
|
||||
|
||||
TABLE.cover(NET.cloudData.keyMap,KEY_MAP)
|
||||
success=success and saveFile(KEY_MAP,'conf/key')
|
||||
|
||||
@@ -9,9 +9,9 @@ local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
|
||||
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.errData[#Z.errData].scene
|
||||
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.getErrData('#').scene
|
||||
errorText=LOADED and text.errorMsg or"An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author."
|
||||
errorShot,errorInfo=Z.errData[#Z.errData].shot,Z.errData[#Z.errData].mes
|
||||
errorShot,errorInfo=Z.getErrData('#').shot,Z.getErrData('#').mes
|
||||
NET.wsclose_app()
|
||||
NET.wsclose_user()
|
||||
NET.wsclose_play()
|
||||
|
||||
@@ -42,7 +42,7 @@ end
|
||||
|
||||
local function _setLang(lid)
|
||||
SETTING.locale=lid
|
||||
applyLanguage()
|
||||
applySettings()
|
||||
TEXT.clear()
|
||||
TEXT.show(langList[lid],640,360,100,'appear',.626)
|
||||
collectgarbage()
|
||||
|
||||
@@ -59,7 +59,7 @@ scene.widgetList={
|
||||
local D=_parseCB()
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
applyAllSettings()
|
||||
applySettings()
|
||||
saveSettings()
|
||||
MES.new('check',text.importSuccess)
|
||||
else
|
||||
|
||||
@@ -45,7 +45,7 @@ scene.widgetList={
|
||||
WIDGET.newSlider{name='reTime', x=330, y=320, w=300,lim=180,unit=10,disp=SETval('reTime'), code=SETsto('reTime'),show=function(S)return(.5+S.disp()*.25).."s"end},
|
||||
WIDGET.newSelector{name='RS', x=300, y=420, w=300,color='S', disp=SETval('RS'), code=SETsto('RS'),list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','DRS_weak','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'}},
|
||||
WIDGET.newSelector{name='menuPos',x=980, y=320, w=300,color='O', disp=SETval('menuPos'), code=SETsto('menuPos'),list={'left','middle','right'}},
|
||||
WIDGET.newSwitch{name='sysCursor',x=1060, y=390, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applyCursor()end},
|
||||
WIDGET.newSwitch{name='sysCursor',x=1060, y=390, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applySettings()end},
|
||||
WIDGET.newSwitch{name='autoPause',x=1060, y=450, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')},
|
||||
WIDGET.newSwitch{name='autoSave', x=1060, y=500, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')},
|
||||
WIDGET.newSwitch{name='autoLogin',x=960, y=580, lim=480, disp=SETval('autoLogin'),code=SETrev('autoLogin')},
|
||||
|
||||
@@ -11,7 +11,7 @@ function scene.fileDropped(file)
|
||||
if pcall(gc.newImage,file)then
|
||||
love.filesystem.write('conf/customBG',file:read('data'))
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
applySettings()
|
||||
else
|
||||
MES.new('error',text.customBGloadFailed)
|
||||
end
|
||||
@@ -79,18 +79,18 @@ scene.widgetList={
|
||||
WIDGET.newSwitch{name='highCam', x=450,y=1270,lim=360,disp=SETval('highCam'), code=SETrev('highCam')},
|
||||
WIDGET.newSwitch{name='warn', x=450,y=1340,lim=360,disp=SETval('warn'), code=SETrev('warn')},
|
||||
|
||||
WIDGET.newSwitch{name='clickFX', x=950,y=980,lim=360,disp=SETval('clickFX'), code=SETrev('clickFX')},
|
||||
WIDGET.newSwitch{name='power', x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=function()SETTING.powerInfo=not SETTING.powerInfo Z.setPowerInfo(SETTING.powerInfo)end},
|
||||
WIDGET.newSwitch{name='clean', x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=function()SETTING.cleanCanvas=not SETTING.cleanCanvas Z.setCleanCanvas(SETTING.cleanCanvas)end},
|
||||
WIDGET.newSwitch{name='fullscreen', x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function()SETTING.fullscreen=not SETTING.fullscreen applyFullscreen()end},
|
||||
WIDGET.newSwitch{name='clickFX', x=950,y=980,lim=360,disp=SETval('clickFX'), code=function()SETTING.clickFX=not SETTING.clickFX applySettings()end},
|
||||
WIDGET.newSwitch{name='power', x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=function()SETTING.powerInfo=not SETTING.powerInfo applySettings()end},
|
||||
WIDGET.newSwitch{name='clean', x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=function()SETTING.cleanCanvas=not SETTING.cleanCanvas applySettings()end},
|
||||
WIDGET.newSwitch{name='fullscreen', x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function()SETTING.fullscreen=not SETTING.fullscreen applySettings()end},
|
||||
|
||||
WIDGET.newKey{name='bg_on', x=680,y=1340,w=200,h=80,code=function()SETTING.bg='on'applyBG()end},
|
||||
WIDGET.newKey{name='bg_off', x=900,y=1340,w=200,h=80,code=function()SETTING.bg='off'applyBG()end},
|
||||
WIDGET.newKey{name='bg_on', x=680,y=1340,w=200,h=80,code=function()SETTING.bg='on'applySettings()end},
|
||||
WIDGET.newKey{name='bg_off', x=900,y=1340,w=200,h=80,code=function()SETTING.bg='off'applySettings()end},
|
||||
WIDGET.newKey{name='bg_custom', x=1120,y=1340,w=200,h=80,
|
||||
code=function()
|
||||
if love.filesystem.getInfo('conf/customBG')then
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
applySettings()
|
||||
else
|
||||
MES.new('info',text.customBGhelp)
|
||||
end
|
||||
@@ -105,12 +105,12 @@ scene.widgetList={
|
||||
WIDGET.newSelector{name='blockSatur', x=800,y=1440,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval('blockSatur'),
|
||||
code=function(v)SETTING.blockSatur=v;applyBlockSatur(SETTING.blockSatur)end
|
||||
code=function(v)SETTING.blockSatur=v;applySettings(SETTING.blockSatur)end
|
||||
},
|
||||
WIDGET.newSelector{name='fieldSatur', x=800,y=1540,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
disp=SETval('fieldSatur'),
|
||||
code=function(v)SETTING.fieldSatur=v;applyFieldSatur(SETTING.fieldSatur)end
|
||||
code=function(v)SETTING.fieldSatur=v;applySettings(SETTING.fieldSatur)end
|
||||
},
|
||||
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
|
||||
Reference in New Issue
Block a user