Skip to content

Commit

Permalink
“保存设置”不再立刻触发,会有一个小延迟
Browse files Browse the repository at this point in the history
调整各种设置界面的unload细节条件
  • Loading branch information
MrZ626 committed Jul 15, 2024
1 parent 602216f commit 5b5238a
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 13 deletions.
11 changes: 9 additions & 2 deletions assets/gamefunc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,21 @@ function autoQuitInterior(disable)
end
end

function saveSettings()
local function _saveSettings()
DEBUG.yieldT(.626)
FILE.save({
system=SETTINGS._system,
game_brik=SETTINGS.game_brik,
game_gela=SETTINGS.game_gela,
game_acry=SETTINGS.game_acry,
},'conf/settings','-json')
showSaveIcon(CHAR.icon.settings..CHAR.icon.save)
if PROGRESS.get('main')>=3 then
showSaveIcon(CHAR.icon.settings..CHAR.icon.save)
end
end
function saveSettings()
TASK.removeTask_code(_saveSettings)
TASK.new(_saveSettings)
end
function saveKey()
FILE.save({
Expand Down
18 changes: 18 additions & 0 deletions assets/language/lang_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,24 @@ local L={
action= {"Action","Use both keyboard & mouse"},
},

-- Mode Task Texts
exteriorModeTasks={
sequence_mph_title="MPH",
sequence_mph_desc="Any clear in 4 pieces",
sequence_flood_title="Flood",
sequence_flood_desc="Clear with S or Z",
sequence_drought_title="Drought",
sequence_drought_desc="Clear with J or L",
sequence_saw_title="Saw",
sequence_saw_desc="Clear with T",
sequence_rect_title="Rect",
sequence_rect_desc="Clear with O",
sequence_rain_title="Rain",
sequence_rain_desc="Clear with I",
sequence_pento_title="Pento",
sequence_pento_desc="Clear with a Pento",
},

-- Achievement
---@enum (key) Techmino.Text.Achievement
achievementMessage={
Expand Down
18 changes: 18 additions & 0 deletions assets/language/lang_zh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,24 @@ local L={
action= {"动作","键鼠搭配更佳"},
},

-- Mode Task Texts
exteriorModeTasks={
sequence_mph_title="MPH",
sequence_mph_desc="4块内消除",
sequence_flood_title="Flood",
sequence_flood_desc="用S/Z消除",
sequence_drought_title="Drought",
sequence_drought_desc="用J/L消除",
sequence_saw_title="Saw",
sequence_saw_desc="用T消除",
sequence_rect_title="Rect",
sequence_rect_desc="用O消除",
sequence_rain_title="Rain",
sequence_rain_desc="用I消除",
sequence_pento_title="Pento",
sequence_pento_desc="用五连块消除",
},

-- Achievement
achievementMessage={
dict_shortcut="快捷键高手",
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/game_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function scene.load()
WIDGET._reset()
end
function scene.unload()
if SCN.state.target~='pause_in' then
if SCN.stackChange<0 then
GAME.unload()
end
end
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/game_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function scene.load()
WIDGET._reset()
end
function scene.unload()
if SCN.state.target~='pause_out' then
if SCN.stackChange<0 then
GAME.unload()
end
end
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/keyset_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function scene.load()
end
end
function scene.unload()
saveKey()
if SCN.stackChange<0 then
saveKey()
end
end

function scene.mouseDown(_,_,k) if k==2 then SCN.back('none') end end
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/keyset_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ function scene.load()
WIDGET._reset()
end
function scene.unload()
saveKey()
if SCN.stackChange<0 then
saveKey()
end
end

function scene.mouseDown(_,_,k) if k==2 then SCN.back('fadeHeader') end end
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/keyset_touch_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function scene.load()
end

function scene.unload()
saveTouch()
if SCN.stackChange<0 then
saveTouch()
end
end

function scene.keyDown(key,isRep)
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/lang_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function scene.load()
end

function scene.unload()
if changed then
if changed and SCN.stackChange<0 then
saveSettings()
end
end
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/lang_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function scene.load()
changed=false
end
function scene.unload()
if changed then
if changed and SCN.stackChange<0 then
saveSettings()
end
end
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/pause_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function scene.load()
end
function scene.unload()
FMOD.effect.keyOff('music_pause')
if not (SCN.state.target=='setting_in' or SCN.state.target=='game_in') then
if SCN.stackChange<0 then
GAME.unload()
end
end
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/pause_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function scene.load()
end
function scene.unload()
FMOD.effect.keyOff('music_pause')
if not (SCN.state.target=='setting_out' or SCN.state.target=='game_out') then
if SCN.stackChange<0 then
GAME.unload()
end
end
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/setting_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function scene.load()
settingHint=PROGRESS.get('main')<2 and PROGRESS.get('launchCount')<=3
end
function scene.unload()
saveSettings()
if SCN.stackChange<0 then
saveSettings()
end
end

function scene.mouseDown(_,_,k) if k==2 then SCN.back('none') end end
Expand Down
4 changes: 3 additions & 1 deletion assets/scene/setting_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function scene.load()
BG.set('none')
end
function scene.unload()
saveSettings()
if SCN.stackChange<0 then
saveSettings()
end
end

function scene.mouseDown(_,_,k) if k==2 then SCN.back('fadeHeader') end end
Expand Down
5 changes: 5 additions & 0 deletions assets/scene/zeta_input_method.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ function scene.load()
freshWidgetPos()
freshResult()
end
function scene.unload()
inputs=nil
results=nil
charQueue=nil
end

function scene.mouseDown(x,y,k)
if k==1 and not writing then
Expand Down

0 comments on commit 5b5238a

Please sign in to comment.