规范代码,大量xxx=nil换成xxx=false
This commit is contained in:
@@ -7,11 +7,11 @@ local BGlist={
|
|||||||
}
|
}
|
||||||
local BG={
|
local BG={
|
||||||
cur="none",
|
cur="none",
|
||||||
init=nil,
|
init=false,
|
||||||
resize=nil,
|
resize=false,
|
||||||
update=NULL,
|
update=NULL,
|
||||||
draw=BGlist.none.draw,
|
draw=BGlist.none.draw,
|
||||||
event=nil,
|
event=false,
|
||||||
discard=NULL,
|
discard=NULL,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local ins,rem=table.insert,table.remove
|
|||||||
local SCR=SCR
|
local SCR=SCR
|
||||||
|
|
||||||
local mx,my,mouseShow=-20,-20,false
|
local mx,my,mouseShow=-20,-20,false
|
||||||
local touching=nil--First touching ID(userdata)
|
local touching--First touching ID(userdata)
|
||||||
local xOy=SCR.xOy
|
local xOy=SCR.xOy
|
||||||
joysticks={}
|
joysticks={}
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ function love.touchmoved(id,x,y,dx,dy)
|
|||||||
else
|
else
|
||||||
WIDGET.moveCursor(x,y)
|
WIDGET.moveCursor(x,y)
|
||||||
if not WIDGET.sel then
|
if not WIDGET.sel then
|
||||||
touching=nil
|
touching=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,9 +156,9 @@ function love.touchreleased(id,x,y)
|
|||||||
if id==touching then
|
if id==touching then
|
||||||
WIDGET.press(x,y)
|
WIDGET.press(x,y)
|
||||||
WIDGET.release(x,y)
|
WIDGET.release(x,y)
|
||||||
touching=nil
|
touching=false
|
||||||
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
||||||
WIDGET.sel=nil
|
WIDGET.sel=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if SCN.touchUp then SCN.touchUp(id,x,y)end
|
if SCN.touchUp then SCN.touchUp(id,x,y)end
|
||||||
|
|||||||
@@ -8,33 +8,33 @@ local SCN={
|
|||||||
cur="NULL",--Current scene name
|
cur="NULL",--Current scene name
|
||||||
swapping=false,--If Swapping
|
swapping=false,--If Swapping
|
||||||
stat={
|
stat={
|
||||||
tar=nil, --Swapping target
|
tar=false, --Swapping target
|
||||||
style=nil, --Swapping style
|
style=false,--Swapping style
|
||||||
mid=nil, --Loading point
|
mid=false, --Loading point
|
||||||
time=nil, --Full swap time
|
time=false, --Full swap time
|
||||||
draw=nil, --Swap draw func
|
draw=false, --Swap draw func
|
||||||
},
|
},
|
||||||
stack={"quit","slowFade"},--Scene stack
|
stack={"quit","slowFade"},--Scene stack
|
||||||
|
|
||||||
scenes=scenes,
|
scenes=scenes,
|
||||||
|
|
||||||
--Events
|
--Events
|
||||||
update=nil,
|
update=false,
|
||||||
draw=nil,
|
draw=false,
|
||||||
mouseClick=nil,
|
mouseClick=false,
|
||||||
touchClick=nil,
|
touchClick=false,
|
||||||
mouseDown=nil,
|
mouseDown=false,
|
||||||
mouseMove=nil,
|
mouseMove=false,
|
||||||
mouseUp=nil,
|
mouseUp=false,
|
||||||
wheelMoved=nil,
|
wheelMoved=false,
|
||||||
touchDown=nil,
|
touchDown=false,
|
||||||
touchUp=nil,
|
touchUp=false,
|
||||||
touchMove=nil,
|
touchMove=false,
|
||||||
keyDown=nil,
|
keyDown=false,
|
||||||
keyUp=nil,
|
keyUp=false,
|
||||||
gamepadDown=nil,
|
gamepadDown=false,
|
||||||
gamepadUp=nil,
|
gamepadUp=false,
|
||||||
socketRead=nil,
|
socketRead=false,
|
||||||
}--Scene datas, returned
|
}--Scene datas, returned
|
||||||
|
|
||||||
function SCN.add(name,scene)
|
function SCN.add(name,scene)
|
||||||
|
|||||||
@@ -499,13 +499,13 @@ function WIDGET.newSlider(D)--name,x,y,w[,unit][,smooth][,font][,change],disp,co
|
|||||||
},
|
},
|
||||||
|
|
||||||
unit= D.unit or 1,
|
unit= D.unit or 1,
|
||||||
smooth=nil,
|
smooth= false,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
change= D.change,
|
change= D.change,
|
||||||
disp= D.disp,
|
disp= D.disp,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
hide= D.hide,
|
hide= D.hide,
|
||||||
show= nil,
|
show= false,
|
||||||
}
|
}
|
||||||
if D.smooth~=nil then
|
if D.smooth~=nil then
|
||||||
_.smooth=D.smooth
|
_.smooth=D.smooth
|
||||||
@@ -534,7 +534,7 @@ local selector={
|
|||||||
type="selector",
|
type="selector",
|
||||||
ATV=8,--Activating time(0~4)
|
ATV=8,--Activating time(0~4)
|
||||||
select=0,--Selected item ID
|
select=0,--Selected item ID
|
||||||
selText=nil,--Selected item name
|
selText=false,--Selected item name
|
||||||
}
|
}
|
||||||
function selector:reset()
|
function selector:reset()
|
||||||
self.ATV=0
|
self.ATV=0
|
||||||
@@ -787,7 +787,7 @@ function WIDGET.newTextBox(D)--name,x,y,w[,h][,font][,secret][,regex],hide
|
|||||||
end
|
end
|
||||||
|
|
||||||
WIDGET.active={}--Table contains all active widgets
|
WIDGET.active={}--Table contains all active widgets
|
||||||
WIDGET.sel=nil--Selected widget
|
WIDGET.sel=false--Selected widget
|
||||||
|
|
||||||
function WIDGET.lnk_BACK() SCN.back()end
|
function WIDGET.lnk_BACK() SCN.back()end
|
||||||
function WIDGET.lnk_CUSval(k) return function() return CUSTOMENV[k] end end
|
function WIDGET.lnk_CUSval(k) return function() return CUSTOMENV[k] end end
|
||||||
@@ -813,7 +813,7 @@ WIDGET.indexMeta={
|
|||||||
}
|
}
|
||||||
function WIDGET.set(list)
|
function WIDGET.set(list)
|
||||||
kb.setTextInput(false)
|
kb.setTextInput(false)
|
||||||
WIDGET.sel=nil
|
WIDGET.sel=false
|
||||||
WIDGET.active=list or NONE
|
WIDGET.active=list or NONE
|
||||||
|
|
||||||
--Reset all widgets
|
--Reset all widgets
|
||||||
@@ -841,7 +841,7 @@ function WIDGET.moveCursor(x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
||||||
WIDGET.sel=nil
|
WIDGET.sel=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.press(x,y)
|
function WIDGET.press(x,y)
|
||||||
@@ -852,7 +852,7 @@ function WIDGET.press(x,y)
|
|||||||
elseif W.type=="slider"then
|
elseif W.type=="slider"then
|
||||||
WIDGET.drag(x,y)
|
WIDGET.drag(x,y)
|
||||||
end
|
end
|
||||||
if W.hide and W.hide()then WIDGET.sel=nil end
|
if W.hide and W.hide()then WIDGET.sel=false end
|
||||||
end
|
end
|
||||||
function WIDGET.drag(x,y)
|
function WIDGET.drag(x,y)
|
||||||
local W=WIDGET.sel
|
local W=WIDGET.sel
|
||||||
@@ -860,7 +860,7 @@ function WIDGET.drag(x,y)
|
|||||||
if W.type=="slider"then
|
if W.type=="slider"then
|
||||||
W:drag(x,y)
|
W:drag(x,y)
|
||||||
elseif not W:isAbove(x,y)then
|
elseif not W:isAbove(x,y)then
|
||||||
WIDGET.sel=nil
|
WIDGET.sel=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.release(x,y)
|
function WIDGET.release(x,y)
|
||||||
|
|||||||
2
main.lua
2
main.lua
@@ -24,7 +24,7 @@ LOADED=false
|
|||||||
NOGAME=false
|
NOGAME=false
|
||||||
LOGIN=false
|
LOGIN=false
|
||||||
EDITING=""
|
EDITING=""
|
||||||
WSCONN=nil
|
WSCONN=false
|
||||||
|
|
||||||
math.randomseed(os.time()*626)
|
math.randomseed(os.time()*626)
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
|
|||||||
@@ -51,6 +51,6 @@ function back.draw()
|
|||||||
gc.pop()
|
gc.pop()
|
||||||
end
|
end
|
||||||
function back.discard()
|
function back.discard()
|
||||||
video=nil
|
video=false
|
||||||
end
|
end
|
||||||
return back
|
return back
|
||||||
@@ -70,6 +70,6 @@ function back.draw()
|
|||||||
gc.pop()
|
gc.pop()
|
||||||
end
|
end
|
||||||
function back.discard()
|
function back.discard()
|
||||||
petal=nil
|
petal=false
|
||||||
end
|
end
|
||||||
return back
|
return back
|
||||||
@@ -43,6 +43,6 @@ function back.draw()
|
|||||||
gc.translate(10,10)
|
gc.translate(10,10)
|
||||||
end
|
end
|
||||||
function back.discard()
|
function back.discard()
|
||||||
stars=nil
|
stars=false
|
||||||
end
|
end
|
||||||
return back
|
return back
|
||||||
@@ -38,6 +38,6 @@ function back.draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function back.discard()
|
function back.discard()
|
||||||
ring=nil
|
ring=false
|
||||||
end
|
end
|
||||||
return back
|
return back
|
||||||
@@ -68,6 +68,6 @@ function back.event(level)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function back.discard()
|
function back.discard()
|
||||||
bar,crystal=nil
|
bar,crystal=false,false
|
||||||
end
|
end
|
||||||
return back
|
return back
|
||||||
@@ -44,7 +44,7 @@ function destroyPlayers()
|
|||||||
CC.free(P.bot_opt)
|
CC.free(P.bot_opt)
|
||||||
CC.free(P.bot_wei)
|
CC.free(P.bot_wei)
|
||||||
CC.destroy(P.AI_bot)
|
CC.destroy(P.AI_bot)
|
||||||
P.AI_mode=nil
|
P.AI_mode=false
|
||||||
end
|
end
|
||||||
PLAYERS[i]=nil
|
PLAYERS[i]=nil
|
||||||
end
|
end
|
||||||
@@ -137,7 +137,7 @@ function pasteSequence(str)
|
|||||||
for _=1,b-32 do
|
for _=1,b-32 do
|
||||||
ins(bag,reg)
|
ins(bag,reg)
|
||||||
end
|
end
|
||||||
reg=nil
|
reg=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -293,7 +293,7 @@ function pasteMission(str)
|
|||||||
for _=1,b-113 do
|
for _=1,b-113 do
|
||||||
ins(mission,reg)
|
ins(mission,reg)
|
||||||
end
|
end
|
||||||
reg=nil
|
reg=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -356,7 +356,7 @@ function randomTarget(P)--Return a random opponent for P
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function freshMostDangerous()
|
function freshMostDangerous()
|
||||||
GAME.mostDangerous,GAME.secDangerous=nil
|
GAME.mostDangerous,GAME.secDangerous=false,false
|
||||||
local m,m2=0,0
|
local m,m2=0,0
|
||||||
for i=1,#PLAYERS.alive do
|
for i=1,#PLAYERS.alive do
|
||||||
local h=#PLAYERS.alive[i].field
|
local h=#PLAYERS.alive[i].field
|
||||||
@@ -376,7 +376,7 @@ function freshMostDangerous()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function freshMostBadge()
|
function freshMostBadge()
|
||||||
GAME.mostBadge,GAME.secBadge=nil
|
GAME.mostBadge,GAME.secBadge=false,false
|
||||||
local m,m2=0,0
|
local m,m2=0,0
|
||||||
for i=1,#PLAYERS.alive do
|
for i=1,#PLAYERS.alive do
|
||||||
local P=PLAYERS.alive[i]
|
local P=PLAYERS.alive[i]
|
||||||
@@ -463,12 +463,12 @@ function applyCustomGame()
|
|||||||
if BAG[1]then
|
if BAG[1]then
|
||||||
GAME.modeEnv.bag=BAG
|
GAME.modeEnv.bag=BAG
|
||||||
else
|
else
|
||||||
GAME.modeEnv.bag=nil
|
GAME.modeEnv.bag=false
|
||||||
end
|
end
|
||||||
if MISSION[1]then
|
if MISSION[1]then
|
||||||
GAME.modeEnv.mission=MISSION
|
GAME.modeEnv.mission=MISSION
|
||||||
else
|
else
|
||||||
GAME.modeEnv.mission=nil
|
GAME.modeEnv.mission=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function loadGame(M,ifQuickPlay)--Load a mode and go to game scene
|
function loadGame(M,ifQuickPlay)--Load a mode and go to game scene
|
||||||
@@ -582,11 +582,11 @@ function resetGameData(args)
|
|||||||
for i=1,#PLAYERS do
|
for i=1,#PLAYERS do
|
||||||
PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i]))
|
PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i]))
|
||||||
end
|
end
|
||||||
GAME.stage=nil
|
GAME.stage=false
|
||||||
GAME.mostBadge=nil
|
GAME.mostBadge=false
|
||||||
GAME.secBadge=nil
|
GAME.secBadge=false
|
||||||
GAME.mostDangerous=nil
|
GAME.mostDangerous=false
|
||||||
GAME.secDangerous=nil
|
GAME.secDangerous=false
|
||||||
GAME.stage=1
|
GAME.stage=1
|
||||||
end
|
end
|
||||||
STAT.game=STAT.game+1
|
STAT.game=STAT.game+1
|
||||||
|
|||||||
@@ -206,42 +206,42 @@ GAME={--Global game data
|
|||||||
|
|
||||||
frame=0, --Frame count
|
frame=0, --Frame count
|
||||||
result=false, --Game result (string)
|
result=false, --Game result (string)
|
||||||
rank=nil, --Rank reached
|
rank=false, --Rank reached
|
||||||
pauseTime=0, --Time paused
|
pauseTime=0, --Time paused
|
||||||
pauseCount=0, --Pausing count
|
pauseCount=0, --Pausing count
|
||||||
warnLVL0=0, --Warning level
|
warnLVL0=0, --Warning level
|
||||||
warnLVL=0, --Warning level (show)
|
warnLVL=0, --Warning level (show)
|
||||||
|
|
||||||
seed=1046101471, --Game seed
|
seed=1046101471, --Game seed
|
||||||
curMode=nil, --Current gamemode object
|
curMode=false, --Current gamemode object
|
||||||
mod={}, --List of loaded mods
|
mod={}, --List of loaded mods
|
||||||
modeEnv=nil, --Current gamemode environment
|
modeEnv=false, --Current gamemode environment
|
||||||
setting={}, --Game settings
|
setting={}, --Game settings
|
||||||
rep={}, --Recording list, key,time,key,time...
|
rep={}, --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
|
saved=false, --If recording saved
|
||||||
|
|
||||||
prevBG=nil, --Previous background, for restore BG when quit setting page
|
prevBG=false, --Previous background, for restore BG when quit setting page
|
||||||
|
|
||||||
--Data for royale mode
|
--Data for royale mode
|
||||||
stage=nil, --Game stage
|
stage=false, --Game stage
|
||||||
mostBadge=nil, --Most badge owner
|
mostBadge=false, --Most badge owner
|
||||||
secBadge=nil, --Second badge owner
|
secBadge=false, --Second badge owner
|
||||||
mostDangerous=nil, --Most dangerous player
|
mostDangerous=false,--Most dangerous player
|
||||||
secDangerous=nil, --Second dangerous player
|
secDangerous=false, --Second dangerous player
|
||||||
}
|
}
|
||||||
|
|
||||||
--Userdata tables
|
--Userdata tables
|
||||||
RANKS=FILE.load("conf/unlock")or{sprint_10=0}--Ranks of modes
|
RANKS=FILE.load("conf/unlock")or{sprint_10=0}--Ranks of modes
|
||||||
USER=FILE.load("conf/user")or{--User infomation
|
USER=FILE.load("conf/user")or{--User infomation
|
||||||
email=nil,
|
email=false,
|
||||||
auth_token=nil,
|
auth_token=false,
|
||||||
access_token=nil,
|
access_token=false,
|
||||||
|
|
||||||
username=nil,
|
username=false,
|
||||||
motto=nil,
|
motto=false,
|
||||||
avatar=nil,
|
avatar=false,
|
||||||
xp=0,lv=1,
|
xp=0,lv=1,
|
||||||
}
|
}
|
||||||
SETTING={--Settings
|
SETTING={--Settings
|
||||||
@@ -319,7 +319,7 @@ else
|
|||||||
clear={},spin={},
|
clear={},spin={},
|
||||||
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
||||||
lastPlay="sprint_10",--Last played mode ID
|
lastPlay="sprint_10",--Last played mode ID
|
||||||
date=nil,
|
date=false,
|
||||||
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
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ return{
|
|||||||
drop=1e99,lock=1e99,
|
drop=1e99,lock=1e99,
|
||||||
holdCount=0,
|
holdCount=0,
|
||||||
dropPiece=function(P)P:lose()end,
|
dropPiece=function(P)P:lose()end,
|
||||||
task=nil,
|
|
||||||
bg="bg1",bgm="new era",
|
bg="bg1",bgm="new era",
|
||||||
},
|
},
|
||||||
pauseLimit=true,
|
pauseLimit=true,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ return{
|
|||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
local L=GAME.modeEnv.opponent
|
local L=GAME.modeEnv.opponent
|
||||||
if L~=0 then
|
if L~=0 then
|
||||||
GAME.modeEnv.target=nil
|
GAME.modeEnv.target=false
|
||||||
if L<6 then
|
if L<6 then
|
||||||
PLY.newAIPlayer(2,AIBUILDER("9S",2*L))
|
PLY.newAIPlayer(2,AIBUILDER("9S",2*L))
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ return{
|
|||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
local L=GAME.modeEnv.opponent
|
local L=GAME.modeEnv.opponent
|
||||||
if L~=0 then
|
if L~=0 then
|
||||||
GAME.modeEnv.target=nil
|
GAME.modeEnv.target=false
|
||||||
if L<6 then
|
if L<6 then
|
||||||
PLY.newAIPlayer(2,AIBUILDER("9S",2*L))
|
PLY.newAIPlayer(2,AIBUILDER("9S",2*L))
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local function check_LVup(P)
|
|||||||
--Stage 1: clear 3 techrash
|
--Stage 1: clear 3 techrash
|
||||||
if T==12 then--Stage 2: swap color of S/Z & J/L
|
if T==12 then--Stage 2: swap color of S/Z & J/L
|
||||||
P.waiting=30
|
P.waiting=30
|
||||||
P.curMission=nil
|
P.curMission=false
|
||||||
|
|
||||||
ENV.skin[1],ENV.skin[2]=ENV.skin[2],ENV.skin[1]
|
ENV.skin[1],ENV.skin[2]=ENV.skin[2],ENV.skin[1]
|
||||||
ENV.skin[3],ENV.skin[4]=ENV.skin[4],ENV.skin[3]
|
ENV.skin[3],ENV.skin[4]=ENV.skin[4],ENV.skin[3]
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.atker,P.atking,P.lastRecv={}
|
P.atker,P.atking,P.lastRecv={}
|
||||||
|
|
||||||
P.dropDelay,P.lockDelay=0,0
|
P.dropDelay,P.lockDelay=0,0
|
||||||
P.showTime=nil
|
P.showTime=false
|
||||||
P.keepVisible=true
|
P.keepVisible=true
|
||||||
|
|
||||||
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
||||||
@@ -165,7 +165,7 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.type="none"
|
P.type="none"
|
||||||
P.sound=false
|
P.sound=false
|
||||||
|
|
||||||
-- P.newNext=nil--Call prepareSequence()to get a function to get new next
|
-- P.newNext=false--Call prepareSequence()to get a function to get new next
|
||||||
|
|
||||||
P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end
|
P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end
|
||||||
P.movDir,P.moving,P.downing=0,0,0--Last move key,DAS charging,downDAS charging
|
P.movDir,P.moving,P.downing=0,0,0--Last move key,DAS charging,downDAS charging
|
||||||
@@ -184,7 +184,7 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.bonus={}--Text objects
|
P.bonus={}--Text objects
|
||||||
|
|
||||||
P.endCounter=0--Used after gameover
|
P.endCounter=0--Used after gameover
|
||||||
P.result=nil--String:"WIN"/"K.O."
|
P.result=false--String:"WIN"/"K.O."
|
||||||
|
|
||||||
return P
|
return P
|
||||||
end
|
end
|
||||||
@@ -272,23 +272,23 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
if ENV.nextCount==0 then ENV.nextPos=false end
|
if ENV.nextCount==0 then ENV.nextPos=false end
|
||||||
|
|
||||||
if P.mini then
|
if P.mini then
|
||||||
ENV.lockFX=nil
|
ENV.lockFX=false
|
||||||
ENV.dropFX=nil
|
ENV.dropFX=false
|
||||||
ENV.moveFX=nil
|
ENV.moveFX=false
|
||||||
ENV.clearFX=nil
|
ENV.clearFX=false
|
||||||
ENV.splashFX=nil
|
ENV.splashFX=false
|
||||||
ENV.shakeFX=nil
|
ENV.shakeFX=false
|
||||||
ENV.text=nil
|
ENV.text=false
|
||||||
else
|
else
|
||||||
if ENV.lockFX==0 then ENV.lockFX=nil end
|
if ENV.lockFX==0 then ENV.lockFX=false end
|
||||||
if ENV.dropFX==0 then ENV.dropFX=nil end
|
if ENV.dropFX==0 then ENV.dropFX=false end
|
||||||
if ENV.moveFX==0 then ENV.moveFX=nil end
|
if ENV.moveFX==0 then ENV.moveFX=false end
|
||||||
if ENV.clearFX==0 then ENV.clearFX=nil end
|
if ENV.clearFX==0 then ENV.clearFX=false end
|
||||||
if ENV.splashFX==0 then ENV.splashFX=nil end
|
if ENV.splashFX==0 then ENV.splashFX=false end
|
||||||
if ENV.shakeFX==0 then ENV.shakeFX=nil end
|
if ENV.shakeFX==0 then ENV.shakeFX=false end
|
||||||
end
|
end
|
||||||
if ENV.ghost==0 then ENV.ghost=nil end
|
if ENV.ghost==0 then ENV.ghost=false end
|
||||||
if ENV.center==0 then ENV.center=nil end
|
if ENV.center==0 then ENV.center=false end
|
||||||
end
|
end
|
||||||
--------------------------</Lib Func>--------------------------
|
--------------------------</Lib Func>--------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ function Player.changeAtk(P,R)
|
|||||||
P.atking=R
|
P.atking=R
|
||||||
ins(R.atker,P)
|
ins(R.atker,P)
|
||||||
else
|
else
|
||||||
P.atking=nil
|
P.atking=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.freshBlock(P,mode)--string mode: push/move/fresh/newBlock
|
function Player.freshBlock(P,mode)--string mode: push/move/fresh/newBlock
|
||||||
@@ -1332,7 +1332,7 @@ do--Player.drop(P)--Place piece
|
|||||||
P.curMission=P.curMission+1
|
P.curMission=P.curMission+1
|
||||||
SFX.play("reach")
|
SFX.play("reach")
|
||||||
if P.curMission>#ENV.mission then
|
if P.curMission>#ENV.mission then
|
||||||
P.curMission=nil
|
P.curMission=false
|
||||||
if not finish then finish="finish"end
|
if not finish then finish="finish"end
|
||||||
end
|
end
|
||||||
elseif ENV.missionKill then
|
elseif ENV.missionKill then
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local scene={}
|
|||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
heartBeatTimer=0
|
heartBeatTimer=0
|
||||||
remain=nil
|
remain=false
|
||||||
|
|
||||||
if #texts==0 then
|
if #texts==0 then
|
||||||
ins(texts,{COLOR.dG,text.chatStart})
|
ins(texts,{COLOR.dG,text.chatStart})
|
||||||
@@ -48,7 +48,7 @@ function scene.sceneInit()
|
|||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
wsWrite("/quit")
|
wsWrite("/quit")
|
||||||
WSCONN=nil
|
WSCONN=false
|
||||||
LOG.print(text.wsDisconnected,"warn")
|
LOG.print(text.wsDisconnected,"warn")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function scene.sceneInit()
|
|||||||
texts=require"parts/updateLog"
|
texts=require"parts/updateLog"
|
||||||
scrollPos=1
|
scrollPos=1
|
||||||
if newVersionLaunch then
|
if newVersionLaunch then
|
||||||
newVersionLaunch=nil
|
newVersionLaunch=false
|
||||||
scrollPos=3
|
scrollPos=3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ local scene={}
|
|||||||
local selected--Mod selected
|
local selected--Mod selected
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
selected=nil
|
selected=false
|
||||||
BG.set("tunnel")
|
BG.set("tunnel")
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.mouseMove(x,y)
|
function scene.mouseMove(x,y)
|
||||||
selected=nil
|
selected=false
|
||||||
for _,M in next,MODOPT do
|
for _,M in next,MODOPT do
|
||||||
if(x-M.x)^2+(y-M.y)^2<2000 then
|
if(x-M.x)^2+(y-M.y)^2<2000 then
|
||||||
selected=M
|
selected=M
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ local int,abs=math.floor,math.abs
|
|||||||
local sin=math.sin
|
local sin=math.sin
|
||||||
|
|
||||||
local mapCam={
|
local mapCam={
|
||||||
sel=nil,--Selected mode ID
|
sel=false,--Selected mode ID
|
||||||
xOy=mt.newTransform(0,0,0,1),--Transformation for map display
|
xOy=mt.newTransform(0,0,0,1),--Transformation for map display
|
||||||
keyCtrl=false,--If controlling with key
|
keyCtrl=false,--If controlling with key
|
||||||
|
|
||||||
--For auto zooming when enter/leave scene
|
--For auto zooming when enter/leave scene
|
||||||
zoomMethod=nil,
|
zoomMethod=false,
|
||||||
zoomK=nil,
|
zoomK=false,
|
||||||
}
|
}
|
||||||
local touchDist=nil
|
local touchDist
|
||||||
|
|
||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ function scene.mouseClick(x,y)
|
|||||||
mapCam.sel=SEL
|
mapCam.sel=SEL
|
||||||
SFX.play("click")
|
SFX.play("click")
|
||||||
else
|
else
|
||||||
mapCam.sel=nil
|
mapCam.sel=false
|
||||||
end
|
end
|
||||||
elseif _ then
|
elseif _ then
|
||||||
scene.keyDown("return")
|
scene.keyDown("return")
|
||||||
@@ -91,7 +91,7 @@ function scene.mouseClick(x,y)
|
|||||||
mapCam.keyCtrl=false
|
mapCam.keyCtrl=false
|
||||||
end
|
end
|
||||||
function scene.touchDown()
|
function scene.touchDown()
|
||||||
touchDist=nil
|
touchDist=false
|
||||||
end
|
end
|
||||||
function scene.touchMove(_,x,y,dx,dy)
|
function scene.touchMove(_,x,y,dx,dy)
|
||||||
local L=tc.getTouches()
|
local L=tc.getTouches()
|
||||||
@@ -124,7 +124,7 @@ function scene.keyDown(key)
|
|||||||
SCN.go("mod")
|
SCN.go("mod")
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
if mapCam.sel then
|
if mapCam.sel then
|
||||||
mapCam.sel=nil
|
mapCam.sel=false
|
||||||
else
|
else
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function scene.sceneInit()
|
|||||||
GAME.restartCount=0
|
GAME.restartCount=0
|
||||||
if GAME.init then
|
if GAME.init then
|
||||||
resetGameData()
|
resetGameData()
|
||||||
GAME.init=nil
|
GAME.init=false
|
||||||
end
|
end
|
||||||
noKey=GAME.replaying
|
noKey=GAME.replaying
|
||||||
noTouch=not SETTING.VKSwitch or noKey
|
noTouch=not SETTING.VKSwitch or noKey
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ local scene={}
|
|||||||
|
|
||||||
local defaultSetSelect
|
local defaultSetSelect
|
||||||
local snapUnit
|
local snapUnit
|
||||||
local select--Button selected
|
local selected--Button selected
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
BG.set("rainbow")
|
BG.set("rainbow")
|
||||||
defaultSetSelect=1
|
defaultSetSelect=1
|
||||||
snapUnit=1
|
snapUnit=1
|
||||||
select=nil
|
selected=false
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
FILE.save(VK_org,"conf/virtualkey")
|
FILE.save(VK_org,"conf/virtualkey")
|
||||||
@@ -36,34 +36,34 @@ local function onVK_org(x,y)
|
|||||||
end
|
end
|
||||||
function scene.mouseDown(x,y,k)
|
function scene.mouseDown(x,y,k)
|
||||||
if k==2 then SCN.back()end
|
if k==2 then SCN.back()end
|
||||||
select=onVK_org(x,y)or select
|
selected=onVK_org(x,y)or selected
|
||||||
end
|
end
|
||||||
function scene.mouseMove(_,_,dx,dy)
|
function scene.mouseMove(_,_,dx,dy)
|
||||||
if select and ms.isDown(1)and not WIDGET.sel then
|
if selected and ms.isDown(1)and not WIDGET.sel then
|
||||||
local B=VK_org[select]
|
local B=VK_org[selected]
|
||||||
B.x,B.y=B.x+dx,B.y+dy
|
B.x,B.y=B.x+dx,B.y+dy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.mouseUp()
|
function scene.mouseUp()
|
||||||
if select then
|
if selected then
|
||||||
local B=VK_org[select]
|
local B=VK_org[selected]
|
||||||
local k=snapUnit
|
local k=snapUnit
|
||||||
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
|
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.touchDown(_,x,y)
|
function scene.touchDown(_,x,y)
|
||||||
select=onVK_org(x,y)or select
|
selected=onVK_org(x,y)or selected
|
||||||
end
|
end
|
||||||
function scene.touchUp()
|
function scene.touchUp()
|
||||||
if select then
|
if selected then
|
||||||
local B=VK_org[select]
|
local B=VK_org[selected]
|
||||||
local k=snapUnit
|
local k=snapUnit
|
||||||
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
|
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.touchMove(_,_,_,dx,dy)
|
function scene.touchMove(_,_,_,dx,dy)
|
||||||
if select and not WIDGET.sel then
|
if selected and not WIDGET.sel then
|
||||||
local B=VK_org[select]
|
local B=VK_org[selected]
|
||||||
B.x,B.y=B.x+dx,B.y+dy
|
B.x,B.y=B.x+dx,B.y+dy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -73,7 +73,7 @@ local function VirtualkeyPreview()
|
|||||||
for i=1,#VK_org do
|
for i=1,#VK_org do
|
||||||
local B=VK_org[i]
|
local B=VK_org[i]
|
||||||
if B.ava then
|
if B.ava then
|
||||||
local c=select==i and .6 or 1
|
local c=selected==i and .6 or 1
|
||||||
gc.setColor(c,1,c,SETTING.VKAlpha)
|
gc.setColor(c,1,c,SETTING.VKAlpha)
|
||||||
gc.setLineWidth(B.r*.07)
|
gc.setLineWidth(B.r*.07)
|
||||||
gc.circle("line",B.x,B.y,B.r,10)
|
gc.circle("line",B.x,B.y,B.r,10)
|
||||||
@@ -190,7 +190,7 @@ scene.widgetList={
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
defaultSetSelect=defaultSetSelect%5+1
|
defaultSetSelect=defaultSetSelect%5+1
|
||||||
select=nil
|
selected=false
|
||||||
LOG.print("[ "..defaultSetSelect.." ]")
|
LOG.print("[ "..defaultSetSelect.." ]")
|
||||||
end},
|
end},
|
||||||
WIDGET.newSelector{name="snap", x=760,y=90,w=200,h=80,color="yellow",list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
|
WIDGET.newSelector{name="snap", x=760,y=90,w=200,h=80,color="yellow",list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
|
||||||
@@ -201,15 +201,15 @@ scene.widgetList={
|
|||||||
WIDGET.newButton{name="back", x=760,y=190,w=200,h=80,font=35,code=WIDGET.lnk_BACK},
|
WIDGET.newButton{name="back", x=760,y=190,w=200,h=80,font=35,code=WIDGET.lnk_BACK},
|
||||||
WIDGET.newSlider{name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize",
|
WIDGET.newSlider{name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize",
|
||||||
disp=function()
|
disp=function()
|
||||||
return VK_org[select].r/10-1
|
return VK_org[selected].r/10-1
|
||||||
end,
|
end,
|
||||||
code=function(v)
|
code=function(v)
|
||||||
if select then
|
if selected then
|
||||||
VK_org[select].r=(v+1)*10
|
VK_org[selected].r=(v+1)*10
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
hide=function()
|
hide=function()
|
||||||
return not select
|
return not selected
|
||||||
end},
|
end},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ function Tick.httpREQ_getAccessToken(task)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
LOGIN=false
|
LOGIN=false
|
||||||
USER.access_token=nil
|
USER.access_token=false
|
||||||
USER.auth_token=nil
|
USER.auth_token=false
|
||||||
local err=json.decode(response.body)
|
local err=json.decode(response.body)
|
||||||
if err then
|
if err then
|
||||||
LOG.print(text.loginFailed..": "..text.netErrorCode..response.code.."-"..err.message,"warn")
|
LOG.print(text.loginFailed..": "..text.netErrorCode..response.code.."-"..err.message,"warn")
|
||||||
@@ -54,7 +54,7 @@ local function tick_wsCONN_read()
|
|||||||
end
|
end
|
||||||
elseif readErr then
|
elseif readErr then
|
||||||
wsWrite("/quit")
|
wsWrite("/quit")
|
||||||
WSCONN=nil
|
WSCONN=false
|
||||||
LOG.print(text.wsDisconnected,"warn")
|
LOG.print(text.wsDisconnected,"warn")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user