修复数据保存到统计的时机错误
This commit is contained in:
@@ -244,6 +244,8 @@ function loadGame(M,ifQuickPlay,ifNet)--Load a mode and go to game scene
|
|||||||
end
|
end
|
||||||
function gameOver()--Save record
|
function gameOver()--Save record
|
||||||
if GAME.replaying then return end
|
if GAME.replaying then return end
|
||||||
|
trySave()
|
||||||
|
|
||||||
local M=GAME.curMode
|
local M=GAME.curMode
|
||||||
local R=M.getRank
|
local R=M.getRank
|
||||||
if R then
|
if R then
|
||||||
@@ -298,6 +300,15 @@ function gameOver()--Save record
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function trySave()
|
||||||
|
if not GAME.statSaved and PLAYERS[1]and(PLAYERS[1].frameRun>300 or GAME.result)then
|
||||||
|
GAME.statSaved=true
|
||||||
|
STAT.game=STAT.game+1
|
||||||
|
mergeStat(STAT,PLAYERS[1].stat)
|
||||||
|
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||||
|
FILE.save(STAT,'conf/data')
|
||||||
|
end
|
||||||
|
end
|
||||||
do--function freshPlayerPosition(sudden)
|
do--function freshPlayerPosition(sudden)
|
||||||
local posLists={
|
local posLists={
|
||||||
--1~5
|
--1~5
|
||||||
@@ -432,11 +443,7 @@ do--function resetGameData(args)
|
|||||||
end
|
end
|
||||||
function resetGameData(args,seed)
|
function resetGameData(args,seed)
|
||||||
if not args then args=""end
|
if not args then args=""end
|
||||||
if PLAYERS[1]and not GAME.replaying and(PLAYERS[1].frameRun>300 or GAME.result)then
|
trySave()
|
||||||
mergeStat(STAT,PLAYERS[1].stat)
|
|
||||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
|
||||||
FILE.save(STAT,'conf/data','q')
|
|
||||||
end
|
|
||||||
|
|
||||||
GAME.result=false
|
GAME.result=false
|
||||||
GAME.warnLVL0=0
|
GAME.warnLVL0=0
|
||||||
@@ -454,6 +461,7 @@ do--function resetGameData(args)
|
|||||||
GAME.setting=copyGameSetting()
|
GAME.setting=copyGameSetting()
|
||||||
GAME.rep={}
|
GAME.rep={}
|
||||||
GAME.recording=true
|
GAME.recording=true
|
||||||
|
GAME.statSaved=false
|
||||||
GAME.replaying=false
|
GAME.replaying=false
|
||||||
GAME.rank=0
|
GAME.rank=0
|
||||||
math.randomseed(TIME())
|
math.randomseed(TIME())
|
||||||
@@ -495,7 +503,6 @@ do--function resetGameData(args)
|
|||||||
GAME.secDangerous=false
|
GAME.secDangerous=false
|
||||||
GAME.stage=1
|
GAME.stage=1
|
||||||
end
|
end
|
||||||
STAT.game=STAT.game+1
|
|
||||||
FREEROW.reset(30*#PLAYERS)
|
FREEROW.reset(30*#PLAYERS)
|
||||||
TASK.removeTask_code(tick_showMods)
|
TASK.removeTask_code(tick_showMods)
|
||||||
if GAME.setting.allowMod then
|
if GAME.setting.allowMod then
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ GAME={--Global game data
|
|||||||
modeEnv=false, --Current gamemode environment
|
modeEnv=false, --Current gamemode environment
|
||||||
setting={}, --Game settings
|
setting={}, --Game settings
|
||||||
rep={}, --Recording list, key,time,key,time...
|
rep={}, --Recording list, key,time,key,time...
|
||||||
|
statSaved=false, --If recording saved
|
||||||
recording=false, --If recording
|
recording=false, --If recording
|
||||||
replaying=false, --If replaying
|
replaying=false, --If replaying
|
||||||
saved=false, --If recording saved
|
saved=false, --If recording saved
|
||||||
|
|||||||
@@ -120,10 +120,7 @@ end
|
|||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||||
if not GAME.replaying and(PLAYERS[1].frameRun>400 or GAME.result)and not GAME.result then
|
trySave()
|
||||||
mergeStat(STAT,PLAYERS[1].stat)
|
|
||||||
FILE.save(STAT,'conf/data','q')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user