整理代码
This commit is contained in:
@@ -97,20 +97,21 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.x,P.y,P.size=0,0,1
|
P.x,P.y,P.size=0,0,1
|
||||||
P.frameColor=0
|
P.frameColor=0
|
||||||
|
|
||||||
P.mini=mini--If draw in small mode
|
|
||||||
|
|
||||||
--Set these at Player:setPosition()
|
--Set these at Player:setPosition()
|
||||||
-- P.fieldX,P.fieldY=...
|
-- P.fieldX,P.fieldY=...
|
||||||
-- P.centerX,P.centerY=...
|
-- P.centerX,P.centerY=...
|
||||||
-- P.absFieldX,P.absFieldY=...
|
-- P.absFieldX,P.absFieldY=...
|
||||||
|
|
||||||
if P.mini then
|
--If draw in small mode
|
||||||
|
P.mini=mini
|
||||||
|
if mini then
|
||||||
P.canvas=love.graphics.newCanvas(60,120)
|
P.canvas=love.graphics.newCanvas(60,120)
|
||||||
P.frameWait=rnd(30,120)
|
P.frameWait=rnd(26,62)
|
||||||
P.draw=PLY.draw.small
|
P.draw=PLY.draw.small
|
||||||
else
|
else
|
||||||
P.draw=PLY.draw.norm
|
P.draw=PLY.draw.norm
|
||||||
end
|
end
|
||||||
|
|
||||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
|
||||||
P.alive=true
|
P.alive=true
|
||||||
@@ -323,7 +324,7 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
ENV.splashFX=false
|
ENV.splashFX=false
|
||||||
ENV.shakeFX=false
|
ENV.shakeFX=false
|
||||||
ENV.text=false
|
ENV.text=false
|
||||||
else
|
end
|
||||||
if ENV.lockFX==0 then ENV.lockFX=false end
|
if ENV.lockFX==0 then ENV.lockFX=false end
|
||||||
if ENV.dropFX==0 then ENV.dropFX=false end
|
if ENV.dropFX==0 then ENV.dropFX=false end
|
||||||
if ENV.moveFX==0 then ENV.moveFX=false end
|
if ENV.moveFX==0 then ENV.moveFX=false end
|
||||||
@@ -331,7 +332,6 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
if ENV.splashFX==0 then ENV.splashFX=false end
|
if ENV.splashFX==0 then ENV.splashFX=false end
|
||||||
if ENV.shakeFX==0 then ENV.shakeFX=false end
|
if ENV.shakeFX==0 then ENV.shakeFX=false end
|
||||||
if ENV.atkFX==0 then ENV.atkFX=false end
|
if ENV.atkFX==0 then ENV.atkFX=false end
|
||||||
end
|
|
||||||
if ENV.ghost==0 then ENV.ghost=false end
|
if ENV.ghost==0 then ENV.ghost=false end
|
||||||
if ENV.center==0 then ENV.center=false end
|
if ENV.center==0 then ENV.center=false end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -271,14 +271,16 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
textBox,
|
textBox,
|
||||||
WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space",hide=function()
|
WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space",
|
||||||
|
hide=function()
|
||||||
return
|
return
|
||||||
playing or
|
playing or
|
||||||
not textBox.hide or
|
not textBox.hide or
|
||||||
PLY_NET[1].ready or
|
PLY_NET[1].ready or
|
||||||
NET.getlock("ready")
|
NET.getlock("ready")
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color="grey",font=40,code=pressKey"space",hide=function()
|
WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color="grey",font=40,code=pressKey"space",
|
||||||
|
hide=function()
|
||||||
return
|
return
|
||||||
playing or
|
playing or
|
||||||
not textBox.hide or
|
not textBox.hide or
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ end
|
|||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,color="black",font=40,code=NULL},
|
WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,color="black",font=40,code=NULL},
|
||||||
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120, font=40,code=goScene"net_rooms"},
|
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=goScene"net_rooms"},
|
||||||
WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,color="black",font=40,code=NULL},
|
WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,color="black",font=40,code=NULL},
|
||||||
WIDGET.newButton{name="logout", x=1140, y=70,w=180,h=70,color="dR",code=function()
|
WIDGET.newButton{name="logout", x=1140, y=70,w=180,h=70,color="dR",
|
||||||
|
code=function()
|
||||||
if TIME()-lastLogoutTime<1 then
|
if TIME()-lastLogoutTime<1 then
|
||||||
if USER.uid then
|
if USER.uid then
|
||||||
NET.wsclose_play()
|
NET.wsclose_play()
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ scene.widgetList={
|
|||||||
WIDGET.newButton{name="exportSetting", x=790,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(SETTING)end},
|
WIDGET.newButton{name="exportSetting", x=790,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(SETTING)end},
|
||||||
WIDGET.newButton{name="exportVK", x=1090,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(VK_org)end},
|
WIDGET.newButton{name="exportVK", x=1090,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(VK_org)end},
|
||||||
|
|
||||||
WIDGET.newButton{name="importUnlock", x=190,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
WIDGET.newButton{name="importUnlock", x=190,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
|
code=function()
|
||||||
local D=parseCB()
|
local D=parseCB()
|
||||||
if D then
|
if D then
|
||||||
TABLE.update(D,RANKS)
|
TABLE.update(D,RANKS)
|
||||||
@@ -44,7 +45,8 @@ scene.widgetList={
|
|||||||
LOG.print(text.dataCorrupted,"warn")
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
end
|
end
|
||||||
end},
|
end},
|
||||||
WIDGET.newButton{name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
WIDGET.newButton{name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
|
code=function()
|
||||||
local D=parseCB()
|
local D=parseCB()
|
||||||
if D and D.version==STAT.version then
|
if D and D.version==STAT.version then
|
||||||
TABLE.update(D,STAT)
|
TABLE.update(D,STAT)
|
||||||
@@ -54,7 +56,8 @@ scene.widgetList={
|
|||||||
LOG.print(text.dataCorrupted,"warn")
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
end
|
end
|
||||||
end},
|
end},
|
||||||
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
|
code=function()
|
||||||
local D=parseCB()
|
local D=parseCB()
|
||||||
if D then
|
if D then
|
||||||
TABLE.update(D,SETTING)
|
TABLE.update(D,SETTING)
|
||||||
@@ -64,7 +67,8 @@ scene.widgetList={
|
|||||||
LOG.print(text.dataCorrupted,"warn")
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
end
|
end
|
||||||
end},
|
end},
|
||||||
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
|
code=function()
|
||||||
local D=parseCB()
|
local D=parseCB()
|
||||||
if D then
|
if D then
|
||||||
TABLE.update(D,VK_org)
|
TABLE.update(D,VK_org)
|
||||||
@@ -74,8 +78,8 @@ scene.widgetList={
|
|||||||
LOG.print(text.dataCorrupted,"warn")
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
end
|
end
|
||||||
end},
|
end},
|
||||||
|
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,
|
||||||
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()
|
code=function()
|
||||||
scene.widgetList.reset.hide=true
|
scene.widgetList.reset.hide=true
|
||||||
scene.widgetList.resetUnlock.hide=false
|
scene.widgetList.resetUnlock.hide=false
|
||||||
scene.widgetList.resetRecord.hide=false
|
scene.widgetList.resetRecord.hide=false
|
||||||
@@ -106,7 +110,6 @@ scene.widgetList={
|
|||||||
LOG.print("effected after restart game","message")
|
LOG.print("effected after restart game","message")
|
||||||
LOG.print("play one game to get data back","message")
|
LOG.print("play one game to get data back","message")
|
||||||
end,hide=true},
|
end,hide=true},
|
||||||
|
|
||||||
WIDGET.newButton{name="back", x=640,y=620,w=200,h=80,font=40,code=backScene},
|
WIDGET.newButton{name="back", x=640,y=620,w=200,h=80,font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ scene.widgetList={
|
|||||||
WIDGET.newSwitch{name="swap", x=1060, y=370, font=20,disp=SETval("swap"), code=SETrev("swap")},
|
WIDGET.newSwitch{name="swap", x=1060, y=370, font=20,disp=SETval("swap"), code=SETrev("swap")},
|
||||||
WIDGET.newSwitch{name="fine", x=1060, y=430, font=20,disp=SETval("fine"), code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play("finesseError",.6) end end},
|
WIDGET.newSwitch{name="fine", x=1060, y=430, font=20,disp=SETval("fine"), code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play("finesseError",.6) end end},
|
||||||
WIDGET.newSwitch{name="appLock", x=1060, y=490, font=20,disp=SETval("appLock"), code=SETrev("appLock")},
|
WIDGET.newSwitch{name="appLock", x=1060, y=490, font=20,disp=SETval("appLock"), code=SETrev("appLock")},
|
||||||
WIDGET.newSwitch{name="simpMode", x=1060, y=550, font=25,disp=SETval("simpMode"),code=function()
|
WIDGET.newSwitch{name="simpMode", x=1060, y=550, font=25,disp=SETval("simpMode"),
|
||||||
|
code=function()
|
||||||
SETTING.simpMode=not SETTING.simpMode
|
SETTING.simpMode=not SETTING.simpMode
|
||||||
for i=1,#SCN.stack,2 do
|
for i=1,#SCN.stack,2 do
|
||||||
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
||||||
|
|||||||
Reference in New Issue
Block a user