Save custom mode (#1007)

* first step to save custom game

* localize various settings in custom game

* rename fields to lower cases

* fix many bugs

* fixes #1014
This commit is contained in:
Imple Lee
2023-10-20 01:42:04 +08:00
committed by GitHub
parent 7ac2c282f6
commit 90c428cf44
13 changed files with 240 additions and 158 deletions

View File

@@ -138,13 +138,13 @@ function scene.keyDown(key,isRep)
SCN.swapTo('game','none')
end
elseif key=='p' then
if (GAME.result or GAME.replaying) and #PLAYERS==1 then
if (GAME.result or GAME.replaying) and GAME.initPlayerCount==1 then
resetGameData('r')
PLAYERS[1]:startStreaming(GAME.rep)
SCN.swapTo('game','none')
end
elseif key=='o' then
if (GAME.result or GAME.replaying) and #PLAYERS==1 and not GAME.saved then
if (GAME.result or GAME.replaying) and GAME.initPlayerCount==1 and not GAME.saved then
if DATA.saveReplay() then
GAME.saved=true
SFX.play('connected')
@@ -359,8 +359,8 @@ scene.widgetList={
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRRPol',37,35,32,3,6},{'fRRPol',25,35,32,3,6}}}},
hideF=function() return PLAYERS[1].frameRun<=180 end,
},
WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 end},
WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 or GAME.saved end},
WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function() return not (GAME.result or GAME.replaying) or GAME.initPlayerCount>1 end},
WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function() return not (GAME.result or GAME.replaying) or GAME.initPlayerCount>1 or GAME.saved end},
}
return scene