整理代码

This commit is contained in:
MrZ626
2020-12-14 15:44:53 +08:00
parent 4d39924059
commit ca9565bb60

View File

@@ -1,3 +1,4 @@
--Complex tables
local function disableKey(P,key) local function disableKey(P,key)
table.insert(P.gameEnv.keyCancel,key) table.insert(P.gameEnv.keyCancel,key)
end end
@@ -135,7 +136,22 @@ for i=1,#MODOPT do
M.sel,M.time=0,0 M.sel,M.time=0,0
M.color=COLOR[M.color] M.color=COLOR[M.color]
end end
PATH={--Network API paths
api="/tech/api/v1",
socket="/tech/socket/v1",
appInfo="/app/info",
users="/users",
auth="/auth",
access="/auth/access",
versus="/online/versus",
chat="/chat",
}
--Game tables
PLAYERS={alive={}}--Players data
FIELD={}--Field(s) for custom game
BAG={}--Sequence for custom game
MISSION={}--Clearing mission for custom game
CUSTOMENV={--gameEnv for cutsom game CUSTOMENV={--gameEnv for cutsom game
--Basic --Basic
drop=60, drop=60,
@@ -181,11 +197,6 @@ CUSTOMENV={--gameEnv for cutsom game
bg="none", bg="none",
bgm="race", bgm="race",
} }
FIELD={}--Field(s) for custom game
BAG={}--Sequence for custom game
MISSION={}--Clearing mission for custom game
GAME={--Global game data GAME={--Global game data
init=false, --If need initializing game when enter scene-play init=false, --If need initializing game when enter scene-play
restartCount=0, --Keep +=1 if player hold restart button after game start restartCount=0, --Keep +=1 if player hold restart button after game start
@@ -205,6 +216,8 @@ GAME={--Global game data
rec={}, --Recording list, key,time,key,time... rec={}, --Recording list, key,time,key,time...
recording=false, --If recording recording=false, --If recording
replaying=false, --If replaying replaying=false, --If replaying
saved=false, --If recording saved
mod={}, --List of loaded mods mod={}, --List of loaded mods
rank=nil, --Rank reached rank=nil, --Rank reached
@@ -218,11 +231,18 @@ GAME={--Global game data
secDangerous=nil, --Second dangerous player secDangerous=nil, --Second dangerous player
} }
PLAYERS={alive={}}--Players data --Userdata tables
RANKS={sprint_10=0}--Ranks of modes
USER={--User infomation
email=nil,
auth_token=nil,
access_token=nil,
RANKS={sprint_10=0} username=nil,
motto=nil,
SETTING={ avatar=nil,
}
SETTING={--Settings
--Tuning --Tuning
das=10,arr=2,dascut=0, das=10,arr=2,dascut=0,
sddas=0,sdarr=2, sddas=0,sdarr=2,
@@ -282,8 +302,7 @@ SETTING={
VKIcon=true,--If disp icon VKIcon=true,--If disp icon
VKAlpha=.3, VKAlpha=.3,
} }
STAT={--Statistics
STAT={
version=VERSION_CODE, version=VERSION_CODE,
run=0,game=0,time=0,frame=0, run=0,game=0,time=0,frame=0,
key=0,rotate=0,hold=0, key=0,rotate=0,hold=0,
@@ -296,44 +315,14 @@ STAT={
lastPlay="sprint_10",--Last played mode ID lastPlay="sprint_10",--Last played mode ID
date=nil, date=nil,
todayTime=0, todayTime=0,
} }for i=1,25 do STAT.clear[i]={0,0,0,0,0,0}STAT.spin[i]={0,0,0,0,0,0,0}end
for i=1,25 do keyMap={--Key setting
STAT.clear[i]={0,0,0,0,0,0}
STAT.spin[i]={0,0,0,0,0,0,0}
end
USER={
email=nil,
auth_token=nil,
access_token=nil,
username=nil,
motto=nil,
avatar=nil,
}
PATH={
api="/tech/api/v1",
socket="/tech/socket/v1",
appInfo="/app/info",
users="/users",
auth="/auth",
access="/auth/access",
versus="/online/versus",
chat="/chat",
}
keyMap={
{"left","right","x","z","c","up","down","space","tab","r"},{}, {"left","right","x","z","c","up","down","space","tab","r"},{},
--Keyboard --Keyboard
{"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder"},{}, {"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder"},{},
--Joystick --Joystick
} }for i=1,#keyMap do for j=1,20 do if not keyMap[i][j]then keyMap[i][j]=""end end end
for i=1,#keyMap do for j=1,20 do VK_org={--Virtualkey layout, refresh all VKs' position with this before each game
if not keyMap[i][j]then keyMap[i][j]=""end
end end
VK_org={--Original virtualkey set,for restore VKs' position 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
@@ -355,4 +344,4 @@ VK_org={--Original virtualkey set,for restore VKs' position before each game
{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
} }
virtualkey={}for i=1,#VK_org do virtualkey[i]={}end virtualkey={}for i=1,#VK_org do virtualkey[i]={}end--In-game virtualkey layout