游戏内再次封装saveFile和loadFile函数

原本的FILE模块更独立,不基于全局text变量和报错信息而是直接报错
This commit is contained in:
MrZ626
2021-11-25 17:38:09 +08:00
parent 720dc2131f
commit f3a88ef269
23 changed files with 206 additions and 111 deletions

View File

@@ -205,15 +205,15 @@ end
Z.setOnQuit(destroyPlayers)
--Load settings and statistics
TABLE.cover (FILE.load('conf/user')or{},USER)
TABLE.cover (FILE.load('conf/unlock')or{},RANKS)
TABLE.update(FILE.load('conf/settings')or{},SETTING)
TABLE.coverR(FILE.load('conf/data')or{},STAT)
TABLE.cover (FILE.load('conf/key')or{},KEY_MAP)
TABLE.cover (FILE.load('conf/virtualkey')or{},VK_ORG)
TABLE.cover (loadFile('conf/user')or{},USER)
TABLE.cover (loadFile('conf/unlock')or{},RANKS)
TABLE.update(loadFile('conf/settings')or{},SETTING)
TABLE.coverR(loadFile('conf/data')or{},STAT)
TABLE.cover (loadFile('conf/key')or{},KEY_MAP)
TABLE.cover (loadFile('conf/virtualkey')or{},VK_ORG)
--Initialize fields, sequence, missions, gameEnv for cutsom game
local fieldData=FILE.load('conf/customBoards','string')
local fieldData=loadFile('conf/customBoards','-string')
if fieldData then
fieldData=STRING.split(fieldData,"!")
for i=1,#fieldData do
@@ -222,15 +222,15 @@ if fieldData then
else
FIELD[1]=DATA.newBoard()
end
local sequenceData=FILE.load('conf/customSequence','string')
local sequenceData=loadFile('conf/customSequence','-string')
if sequenceData then
DATA.pasteSequence(sequenceData)
end
local missionData=FILE.load('conf/customMissions','string')
local missionData=loadFile('conf/customMissions','-string')
if missionData then
DATA.pasteMission(missionData)
end
local customData=FILE.load('conf/customEnv')
local customData=loadFile('conf/customEnv')
if customData and customData['version']==VERSION.code then
TABLE.complete(customData,CUSTOMENV)
end