整理代码

This commit is contained in:
MrZ626
2021-06-06 12:26:30 +08:00
parent b7b630fc81
commit ef8bf5fc3e
6 changed files with 19 additions and 21 deletions

View File

@@ -86,7 +86,7 @@ MODES= require"parts.modes"
FIELD[1]=DATA.newBoard() FIELD[1]=DATA.newBoard()
--First start for phones --First start for phones
if not fs.getInfo("conf/settings")and MOBILE then if not fs.getInfo('conf/settings')and MOBILE then
SETTING.VKSwitch=true SETTING.VKSwitch=true
SETTING.swap=false SETTING.swap=false
SETTING.powerInfo=true SETTING.powerInfo=true
@@ -244,8 +244,8 @@ do
autoRestart=true autoRestart=true
end end
if STAT.version<1405 then if STAT.version<1405 then
fs.remove("conf/user") fs.remove('conf/user')
fs.remove("conf/key") fs.remove('conf/key')
needSave=true needSave=true
autoRestart=true autoRestart=true
end end

View File

@@ -183,8 +183,8 @@ ROYALEDATA={
} }
--Userdata tables --Userdata tables
RANKS=FILE.load("conf/unlock")or{sprint_10l=0}--Ranks of modes RANKS=FILE.load('conf/unlock')or{sprint_10l=0}--Ranks of modes
USER=FILE.load("conf/user")or{--User infomation USER=FILE.load('conf/user')or{--User infomation
--Network infos --Network infos
uid=false, uid=false,
authToken=false, authToken=false,
@@ -236,7 +236,7 @@ customEnv0={
bg='blockfall', bg='blockfall',
bgm='hang out', bgm='hang out',
} }
CUSTOMENV=FILE.load("conf/customEnv")--gameEnv for cutsom game CUSTOMENV=FILE.load('conf/customEnv')--gameEnv for cutsom game
if not CUSTOMENV or CUSTOMENV.version~=VERSION.code then if not CUSTOMENV or CUSTOMENV.version~=VERSION.code then
CUSTOMENV=TABLE.copy(customEnv0) CUSTOMENV=TABLE.copy(customEnv0)
else else
@@ -314,9 +314,9 @@ SETTING={--Settings
VKIcon=true,--If disp icon VKIcon=true,--If disp icon
VKAlpha=.3, VKAlpha=.3,
} }
local S=FILE.load("conf/settings") local S=FILE.load('conf/settings')
if S then TABLE.update(S,SETTING)end if S then TABLE.update(S,SETTING)end
S=FILE.load("conf/data") S=FILE.load('conf/data')
if S then--Statistics if S then--Statistics
STAT=S STAT=S
else else
@@ -335,7 +335,7 @@ else
todayTime=0, todayTime=0,
}for i=1,29 do STAT.clear[i]={0,0,0,0,0,0}STAT.spin[i]={0,0,0,0,0,0,0}end }for i=1,29 do STAT.clear[i]={0,0,0,0,0,0}STAT.spin[i]={0,0,0,0,0,0,0}end
end end
keyMap=FILE.load("conf/key")or{--Key setting keyMap=FILE.load('conf/key')or{--Key setting
keyboard={ keyboard={
left=1,right=2,x=3,z=4,c=5, left=1,right=2,x=3,z=4,c=5,
up=6,down=7,space=8,a=9,s=10, up=6,down=7,space=8,a=9,s=10,
@@ -347,7 +347,7 @@ keyMap=FILE.load("conf/key")or{--Key setting
leftshoulder=0, leftshoulder=0,
}, },
} }
VK_org=FILE.load("conf/virtualkey")or{--Virtualkey layout, refresh all VKs' position with this before each game VK_org=FILE.load('conf/virtualkey')or{--Virtualkey layout, refresh all VKs' position with this before each game
{ava=true, x=80, y=720-200, r=80},--moveLeft {ava=true, x=80, y=720-200, r=80},--moveLeft
{ava=true, x=320, y=720-200, r=80},--moveRight {ava=true, x=320, y=720-200, r=80},--moveRight
{ava=true, x=1280-80, y=720-200, r=80},--rotRight {ava=true, x=1280-80, y=720-200, r=80},--rotRight
@@ -369,4 +369,4 @@ VK_org=FILE.load("conf/virtualkey")or{--Virtualkey layout, refresh all VKs' posi
{ava=false, x=900, y=50, r=80},--addToLeft {ava=false, x=900, y=50, r=80},--addToLeft
{ava=false, x=1000, y=50, r=80},--addToRight {ava=false, x=1000, y=50, r=80},--addToRight
} }
REPLAY=FILE.load("conf/replay")or{} REPLAY=FILE.load('conf/replay')or{}

View File

@@ -92,7 +92,6 @@ function netPLY.clear()
end end
function netPLY.add(p) function netPLY.add(p)
p.connected=false p.connected=false
p.username=p.username
p.place=1e99 p.place=1e99
p.stat=false p.stat=false
local a=rnd()*6.2832 local a=rnd()*6.2832

View File

@@ -12,10 +12,10 @@ local function login()
end end
NET.wsconn_user_pswd(email,password) NET.wsconn_user_pswd(email,password)
if savePW then if savePW then
FILE.save({email,password},"conf/account",'q') FILE.save({email,password},'conf/account','q')
else else
if love.filesystem.getInfo("conf/account")then if love.filesystem.getInfo('conf/account')then
love.filesystem.remove("conf/account") love.filesystem.remove('conf/account')
end end
end end
end end
@@ -23,7 +23,7 @@ end
local scene={} local scene={}
function scene.sceneInit() function scene.sceneInit()
local data=FILE.load("conf/account") local data=FILE.load('conf/account')
if data then if data then
savePW=true savePW=true
emailBox:setText(data[1]) emailBox:setText(data[1])

View File

@@ -9,10 +9,10 @@ local snapUnit=1
local selected--Button selected local selected--Button selected
local function save1() local function save1()
FILE.save(VK_org,"conf/vkSave1") FILE.save(VK_org,'conf/vkSave1')
end end
local function load1() local function load1()
local D=FILE.load("conf/vkSave1") local D=FILE.load('conf/vkSave1')
if D then if D then
TABLE.update(D,VK_org) TABLE.update(D,VK_org)
else else
@@ -20,10 +20,10 @@ local function load1()
end end
end end
local function save2() local function save2()
FILE.save(VK_org,"conf/vkSave2") FILE.save(VK_org,'conf/vkSave2')
end end
local function load2() local function load2()
local D=FILE.load("conf/vkSave2") local D=FILE.load('conf/vkSave2')
if D then if D then
TABLE.update(D,VK_org) TABLE.update(D,VK_org)
else else

View File

@@ -3,7 +3,6 @@ local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_draw,gc_line=gc.draw,gc.line local gc_draw,gc_line=gc.draw,gc.line
local gc_print=gc.print local gc_print=gc.print
local abs,int,sin=math.abs,math.floor,math.sin local abs,int,sin=math.abs,math.floor,math.sin
local mStr=mStr local mStr=mStr