整理代码,加载设置和统计的代码移至main.lua
This commit is contained in:
8
main.lua
8
main.lua
@@ -81,6 +81,14 @@ PLY= require'parts.player'
|
|||||||
netPLY= require'parts.netPlayer'
|
netPLY= require'parts.netPlayer'
|
||||||
MODES= require'parts.modes'
|
MODES= require'parts.modes'
|
||||||
|
|
||||||
|
--Load settings and statistics
|
||||||
|
TABLE.cover(FILE.load('conf/user'),USER)
|
||||||
|
TABLE.cover(FILE.load('conf/unlock')or{},RANKS)
|
||||||
|
TABLE.update(FILE.load('conf/settings')or{},SETTING)
|
||||||
|
TABLE.update(FILE.load('conf/data')or{},STAT)
|
||||||
|
TABLE.cover(FILE.load('conf/key')or{},keyMap)
|
||||||
|
TABLE.cover(FILE.load('conf/virtualkey')or{},VK_org)
|
||||||
|
|
||||||
--Initialize fields, sequence, missions, gameEnv for cutsom game
|
--Initialize fields, sequence, missions, gameEnv for cutsom game
|
||||||
local fieldData=FILE.load('conf/customBoards')
|
local fieldData=FILE.load('conf/customBoards')
|
||||||
if fieldData then
|
if fieldData then
|
||||||
|
|||||||
@@ -189,18 +189,6 @@ ROYALEDATA={
|
|||||||
powerUp=false,
|
powerUp=false,
|
||||||
stage=false,
|
stage=false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--Userdata tables
|
|
||||||
RANKS=FILE.load('conf/unlock')or{sprint_10l=0}--Ranks of modes
|
|
||||||
USER=FILE.load('conf/user')or{--User infomation
|
|
||||||
--Network infos
|
|
||||||
uid=false,
|
|
||||||
authToken=false,
|
|
||||||
|
|
||||||
--Local data
|
|
||||||
xp=0,lv=1,
|
|
||||||
}
|
|
||||||
|
|
||||||
CUSTOMENV={}
|
CUSTOMENV={}
|
||||||
ROOMENV={
|
ROOMENV={
|
||||||
--Room config
|
--Room config
|
||||||
@@ -238,6 +226,18 @@ ROOMENV={
|
|||||||
easyFresh=true,
|
easyFresh=true,
|
||||||
deepDrop=false,
|
deepDrop=false,
|
||||||
}
|
}
|
||||||
|
REPLAY={}--Replay objects (not include stream data)
|
||||||
|
|
||||||
|
--Userdata tables
|
||||||
|
USER={--User infomation
|
||||||
|
--Network infos
|
||||||
|
uid=false,
|
||||||
|
authToken=false,
|
||||||
|
|
||||||
|
--Local data
|
||||||
|
xp=0,lv=1,
|
||||||
|
}
|
||||||
|
|
||||||
SETTING={--Settings
|
SETTING={--Settings
|
||||||
--Tuning
|
--Tuning
|
||||||
das=10,arr=2,
|
das=10,arr=2,
|
||||||
@@ -313,28 +313,7 @@ SETTING={--Settings
|
|||||||
VKIcon=true,--If disp icon
|
VKIcon=true,--If disp icon
|
||||||
VKAlpha=.3,
|
VKAlpha=.3,
|
||||||
}
|
}
|
||||||
local S=FILE.load('conf/settings')
|
keyMap={--Key setting
|
||||||
if S then TABLE.update(S,SETTING)end
|
|
||||||
S=FILE.load('conf/data')
|
|
||||||
if S then--Statistics
|
|
||||||
STAT=S
|
|
||||||
else
|
|
||||||
STAT={
|
|
||||||
version=VERSION.code,
|
|
||||||
run=0,game=0,time=0,frame=0,
|
|
||||||
key=0,rotate=0,hold=0,
|
|
||||||
extraPiece=0,finesseRate=0,
|
|
||||||
piece=0,row=0,dig=0,
|
|
||||||
atk=0,digatk=0,
|
|
||||||
send=0,recv=0,pend=0,off=0,
|
|
||||||
clear={},spin={},
|
|
||||||
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
|
||||||
lastPlay='sprint_10l',--Last played mode ID
|
|
||||||
date=false,
|
|
||||||
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
|
|
||||||
end
|
|
||||||
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,
|
||||||
@@ -346,7 +325,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={--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
|
||||||
@@ -368,4 +347,19 @@ 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={}--Replay objects (not include stream data)
|
RANKS={sprint_10l=0}--Ranks of modes
|
||||||
|
STAT={
|
||||||
|
version=VERSION.code,
|
||||||
|
run=0,game=0,time=0,frame=0,
|
||||||
|
key=0,rotate=0,hold=0,
|
||||||
|
extraPiece=0,finesseRate=0,
|
||||||
|
piece=0,row=0,dig=0,
|
||||||
|
atk=0,digatk=0,
|
||||||
|
send=0,recv=0,pend=0,off=0,
|
||||||
|
clear=(function()local L={}for i=1,29 do L[i]={0,0,0,0,0,0}end return L end)(),
|
||||||
|
spin=(function()local L={}for i=1,29 do L[i]={0,0,0,0,0,0,0}end return L end)(),
|
||||||
|
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
||||||
|
lastPlay='sprint_10l',--Last played mode ID
|
||||||
|
date=false,
|
||||||
|
todayTime=0,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user