整理代码

This commit is contained in:
MrZ626
2021-05-01 20:46:05 +08:00
parent 1fae1c9ba6
commit 11bb084d70
16 changed files with 32 additions and 32 deletions

View File

@@ -319,9 +319,9 @@ do
end
if needSave then
FILE.save(SETTING,"conf/settings",'q')
FILE.save(RANKS,"conf/unlock",'q')
FILE.save(STAT,"conf/data",'q')
FILE.save(SETTING,'conf/settings','q')
FILE.save(RANKS,'conf/unlock','q')
FILE.save(STAT,'conf/data','q')
end
if autoRestart then
love.event.quit('restart')

View File

@@ -383,7 +383,7 @@ do--function DATA.saveRecording()
love.filesystem.write(fileName,fileHead.."\n"..data.compress('string','zlib',fileBody))
ins(REPLAY,fileName)
FILE.save(REPLAY,"conf/replay")
FILE.save(REPLAY,'conf/replay')
return true
else
LOG.print("Save failed: File already exists")

View File

@@ -300,7 +300,7 @@ function NET.updateWS_user()
if res.uid then
USER.uid=res.uid
USER.authToken=res.authToken
FILE.save(USER,"conf/user",'q')
FILE.save(USER,'conf/user','q')
if SCN.cur=='login'then SCN.back()end
end
LOG.print(text.loginSuccessed)
@@ -350,7 +350,7 @@ function NET.updateWS_play()
--?
elseif res.action==2 then--Player join
if res.type=='Self'then
--Create room
--Enter new room
TABLE.cut(PLY_NET)
if d.players then
for _,p in next,d.players do
@@ -373,7 +373,7 @@ function NET.updateWS_play()
ready=d.ready,
config=d.config,
})
if SCN.socketRead then SCN.socketRead("Join",d)end
if SCN.socketRead then SCN.socketRead('Join',d)end
end
elseif res.action==3 then--Player leave
if not d.uid then
@@ -399,10 +399,10 @@ function NET.updateWS_play()
break
end
end
if SCN.socketRead then SCN.socketRead("Leave",d)end
if SCN.socketRead then SCN.socketRead('Leave',d)end
end
elseif res.action==4 then--Player talk
if SCN.socketRead then SCN.socketRead("Talk",d)end
if SCN.socketRead then SCN.socketRead('Talk',d)end
elseif res.action==5 then--Player change settings
if tostring(USER.uid)~=d.uid then
for i=1,#PLY_NET do
@@ -443,7 +443,7 @@ function NET.updateWS_play()
elseif res.action==9 then--Game finished
NET.allReady=false
NET.wsclose_stream()
if SCN.socketRead then SCN.socketRead("Finish",d)end
if SCN.socketRead then SCN.socketRead('Finish',d)end
end
else
WS.alert('play')
@@ -472,7 +472,7 @@ function NET.updateWS_stream()
if res.type=='Connect'then
NET.unlock('wsc_stream')
elseif res.action==0 then--Game start
SCN.socketRead("Go",d)
SCN.socketRead('Go',d)
elseif res.action==1 then--Game finished
--?
elseif res.action==2 then--Player join
@@ -487,7 +487,7 @@ function NET.updateWS_stream()
end
end
elseif res.action==5 then--Receive stream
SCN.socketRead("Stream",d)
SCN.socketRead('Stream',d)
end
else
WS.alert('stream')

View File

@@ -1609,7 +1609,7 @@ end
--------------------------<Events>--------------------------
local function gameOver()--Save record
if GAME.replaying then return end
FILE.save(STAT,"conf/data")
FILE.save(STAT,'conf/data')
local M=GAME.curMode
local R=M.getRank
if R then
@@ -1639,7 +1639,7 @@ local function gameOver()--Save record
end
end
if needSave then
FILE.save(RANKS,"conf/unlock",'q')
FILE.save(RANKS,'conf/unlock','q')
end
end
local D=M.score(P)
@@ -1658,7 +1658,7 @@ local function gameOver()--Save record
D.date=os.date("%Y/%m/%d %H:%M")
ins(L,p+1,D)
if L[11]then L[11]=nil end
FILE.save(L,"record/"..M.name..".rec",'lq')
FILE.save(L,('record/%s.rec'):format(M.name),'lq')
end
end
end

View File

@@ -493,7 +493,7 @@ function commands.unlockall(bool)
RANKS[name]=M.score and 0 or 6
end
end
FILE.save(RANKS,"conf/unlock")
FILE.save(RANKS,'conf/unlock')
log{C.lC,"\85\78\76\79\67\75\65\76\76"}
SFX.play('clear_2')
else

View File

@@ -50,11 +50,11 @@ function scene.keyDown(key)
end
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
if initField then
FILE.save(CUSTOMENV,"conf/customEnv",'q')
FILE.save(CUSTOMENV,'conf/customEnv','q')
loadGame('custom_puzzle',true)
end
else
FILE.save(CUSTOMENV,"conf/customEnv",'q')
FILE.save(CUSTOMENV,'conf/customEnv','q')
loadGame('custom_clear',true)
end
elseif key=="f"then
@@ -102,7 +102,7 @@ function scene.keyDown(key)
do return end
::THROW_fail::LOG.print(text.dataCorrupted,COLOR.R)
elseif key=="escape"then
FILE.save(CUSTOMENV,"conf/customEnv",'q')
FILE.save(CUSTOMENV,'conf/customEnv','q')
SCN.back()
else
WIDGET.keyPressed(key)

View File

@@ -1,7 +1,7 @@
local scene={}
function scene.sceneBack()
FILE.save(SETTING,"conf/settings")
FILE.save(SETTING,'conf/settings')
end
local function setLang(n)return function()SETTING.lang=n LANG.set(n)end end

View File

@@ -170,7 +170,7 @@ local loadingThread=coroutine.wrap(function()
RANKS[name]=nil
end
end
FILE.save(RANKS,"conf/unlock",'q')
FILE.save(RANKS,'conf/unlock','q')
end
DAILYLAUNCH=freshDate'q'

View File

@@ -28,7 +28,7 @@ scene.widgetList={
USER.uid=false
USER.username=false
USER.authToken=false
FILE.save(USER,"conf/user",'q')
FILE.save(USER,'conf/user','q')
SCN.back()
end
else

View File

@@ -122,7 +122,7 @@ function scene.sceneBack()
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
mergeStat(STAT,PLAYERS[1].stat)
FILE.save(STAT,"conf/data")
FILE.save(STAT,'conf/data')
end
end

View File

@@ -39,7 +39,7 @@ scene.widgetList={
local D=parseCB()
if D then
TABLE.update(D,RANKS)
FILE.save(RANKS,"conf/unlock")
FILE.save(RANKS,'conf/unlock')
LOG.print(text.importSuccess,'message')
else
LOG.print(text.dataCorrupted,'warn')
@@ -50,7 +50,7 @@ scene.widgetList={
local D=parseCB()
if D and D.version==STAT.version then
TABLE.update(D,STAT)
FILE.save(STAT,"conf/data")
FILE.save(STAT,'conf/data')
LOG.print(text.importSuccess,'message')
else
LOG.print(text.dataCorrupted,'warn')
@@ -61,7 +61,7 @@ scene.widgetList={
local D=parseCB()
if D then
TABLE.update(D,SETTING)
FILE.save(SETTING,"conf/settings")
FILE.save(SETTING,'conf/settings')
LOG.print(text.importSuccess,'message')
else
LOG.print(text.dataCorrupted,'warn')
@@ -72,7 +72,7 @@ scene.widgetList={
local D=parseCB()
if D then
TABLE.update(D,VK_org)
FILE.save(VK_org,"conf/virtualkey")
FILE.save(VK_org,'conf/virtualkey')
LOG.print(text.importSuccess,'message')
else
LOG.print(text.dataCorrupted,'warn')

View File

@@ -6,7 +6,7 @@ function scene.sceneInit()
BG.set()
end
function scene.sceneBack()
FILE.save(SETTING,"conf/settings")
FILE.save(SETTING,'conf/settings')
end
function scene.draw()

View File

@@ -23,7 +23,7 @@ function scene.sceneInit()
BG.set('none')
end
function scene.sceneBack()
FILE.save(keyMap,"conf/key")
FILE.save(keyMap,'conf/key')
end
function scene.keyDown(key)

View File

@@ -15,7 +15,7 @@ function scene.sceneInit()
BG.set()
end
function scene.sceneBack()
FILE.save(SETTING,"conf/settings")
FILE.save(SETTING,'conf/settings')
end
function scene.mouseDown(x,y)

View File

@@ -15,7 +15,7 @@ function scene.sceneInit()
selected=false
end
function scene.sceneBack()
FILE.save(VK_org,"conf/virtualkey")
FILE.save(VK_org,'conf/virtualkey')
end
local function onVK_org(x,y)

View File

@@ -4,7 +4,7 @@ function scene.sceneInit()
BG.set()
end
function scene.sceneBack()
FILE.save(SETTING,"conf/settings")
FILE.save(SETTING,'conf/settings')
end
scene.widgetList={