resetGameData参数更高级

This commit is contained in:
MrZ626
2020-12-21 08:37:15 +08:00
parent a97fc8b53a
commit a38e1f201d
4 changed files with 10 additions and 9 deletions

View File

@@ -537,7 +537,8 @@ local function tick_showMods()
end
end
end
function resetGameData(replaying,ifQuick)
function resetGameData(args)
if not args then args=""end
if PLAYERS[1]and not GAME.replaying and(GAME.frame>400 or GAME.result)then
mergeStat(STAT,PLAYERS[1].stat)
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
@@ -546,7 +547,7 @@ function resetGameData(replaying,ifQuick)
GAME.result=false
GAME.warnLVL0=0
GAME.warnLVL=0
if replaying then
if args:find("r")then
GAME.frame=0
GAME.recording=false
GAME.replaying=1
@@ -566,7 +567,7 @@ function resetGameData(replaying,ifQuick)
destroyPlayers()
GAME.curMode.load()
initPlayerPosition(ifQuick)
initPlayerPosition(args:find("q"))
restoreVirtualKey()
if GAME.modeEnv.task then
for i=1,#PLAYERS do

View File

@@ -1839,9 +1839,9 @@ function Player.act_func(P)
end
function Player.act_restart()
if GAME.frame<240 then
resetGameData(false,true)
resetGameData("q")
elseif GAME.result then
resetGameData(false,false)
resetGameData()
else
LOG.print(text.holdR,20,COLOR.orange)
end

View File

@@ -137,11 +137,11 @@ function scene.keyDown(key)
GAME.prevBG=BG.cur
SCN.go("setting_sound")
elseif key=="r"then
resetGameData(false,false)
resetGameData()
SCN.swapTo("play","none")
elseif key=="p"then
if(GAME.result or GAME.replaying)and #PLAYERS==1 then
resetGameData(true,false)
resetGameData("r")
SCN.swapTo("play","none")
end
elseif key=="o"then

View File

@@ -30,7 +30,7 @@ function scene.sceneInit()
love.keyboard.setKeyRepeat(false)
GAME.restartCount=0
if GAME.init then
resetGameData(false,false)
resetGameData()
GAME.init=nil
end
noKey=GAME.replaying
@@ -204,7 +204,7 @@ function scene.update(dt)
elseif P1.keyPressing[10]then
GAME.restartCount=GAME.restartCount+1
if GAME.restartCount>20 then
resetGameData(false,false)
resetGameData()
return
end
elseif GAME.restartCount>0 then