整理代码
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,15 +324,14 @@ 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
|
|
||||||
if ENV.lockFX==0 then ENV.lockFX=false end
|
|
||||||
if ENV.dropFX==0 then ENV.dropFX=false end
|
|
||||||
if ENV.moveFX==0 then ENV.moveFX=false end
|
|
||||||
if ENV.clearFX==0 then ENV.clearFX=false end
|
|
||||||
if ENV.splashFX==0 then ENV.splashFX=false end
|
|
||||||
if ENV.shakeFX==0 then ENV.shakeFX=false end
|
|
||||||
if ENV.atkFX==0 then ENV.atkFX=false end
|
|
||||||
end
|
end
|
||||||
|
if ENV.lockFX==0 then ENV.lockFX=false end
|
||||||
|
if ENV.dropFX==0 then ENV.dropFX=false end
|
||||||
|
if ENV.moveFX==0 then ENV.moveFX=false end
|
||||||
|
if ENV.clearFX==0 then ENV.clearFX=false end
|
||||||
|
if ENV.splashFX==0 then ENV.splashFX=false end
|
||||||
|
if ENV.shakeFX==0 then ENV.shakeFX=false end
|
||||||
|
if ENV.atkFX==0 then ENV.atkFX=false 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,19 +271,21 @@ 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",
|
||||||
return
|
hide=function()
|
||||||
playing or
|
return
|
||||||
not textBox.hide or
|
playing or
|
||||||
PLY_NET[1].ready or
|
not textBox.hide or
|
||||||
NET.getlock("ready")
|
PLY_NET[1].ready or
|
||||||
|
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",
|
||||||
return
|
hide=function()
|
||||||
playing or
|
return
|
||||||
not textBox.hide or
|
playing or
|
||||||
not PLY_NET[1].ready or
|
not textBox.hide or
|
||||||
NET.getlock("ready")
|
not PLY_NET[1].ready or
|
||||||
|
NET.getlock("ready")
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"\\"},
|
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"\\"},
|
||||||
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"},
|
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"},
|
||||||
|
|||||||
@@ -12,24 +12,25 @@ 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",
|
||||||
if TIME()-lastLogoutTime<1 then
|
code=function()
|
||||||
if USER.uid then
|
if TIME()-lastLogoutTime<1 then
|
||||||
NET.wsclose_play()
|
if USER.uid then
|
||||||
NET.wsclose_user()
|
NET.wsclose_play()
|
||||||
USER.username=false
|
NET.wsclose_user()
|
||||||
USER.uid=false
|
USER.username=false
|
||||||
USER.authToken=false
|
USER.uid=false
|
||||||
FILE.save(USER,"conf/user","q")
|
USER.authToken=false
|
||||||
SCN.back()
|
FILE.save(USER,"conf/user","q")
|
||||||
|
SCN.back()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
LOG.print(text.sureQuit,COLOR.orange)
|
||||||
|
lastLogoutTime=TIME()
|
||||||
end
|
end
|
||||||
else
|
end},
|
||||||
LOG.print(text.sureQuit,COLOR.orange)
|
|
||||||
lastLogoutTime=TIME()
|
|
||||||
end
|
|
||||||
end},
|
|
||||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,53 +34,57 @@ 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,
|
||||||
local D=parseCB()
|
code=function()
|
||||||
if D then
|
local D=parseCB()
|
||||||
TABLE.update(D,RANKS)
|
if D then
|
||||||
FILE.save(RANKS,"conf/unlock")
|
TABLE.update(D,RANKS)
|
||||||
LOG.print(text.importSuccess,"message")
|
FILE.save(RANKS,"conf/unlock")
|
||||||
else
|
LOG.print(text.importSuccess,"message")
|
||||||
LOG.print(text.dataCorrupted,"warn")
|
else
|
||||||
end
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
end},
|
end
|
||||||
WIDGET.newButton{name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
end},
|
||||||
local D=parseCB()
|
WIDGET.newButton{name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
if D and D.version==STAT.version then
|
code=function()
|
||||||
TABLE.update(D,STAT)
|
local D=parseCB()
|
||||||
FILE.save(STAT,"conf/data")
|
if D and D.version==STAT.version then
|
||||||
LOG.print(text.importSuccess,"message")
|
TABLE.update(D,STAT)
|
||||||
else
|
FILE.save(STAT,"conf/data")
|
||||||
LOG.print(text.dataCorrupted,"warn")
|
LOG.print(text.importSuccess,"message")
|
||||||
end
|
else
|
||||||
end},
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
end
|
||||||
local D=parseCB()
|
end},
|
||||||
if D then
|
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
TABLE.update(D,SETTING)
|
code=function()
|
||||||
FILE.save(SETTING,"conf/settings")
|
local D=parseCB()
|
||||||
LOG.print(text.importSuccess,"message")
|
if D then
|
||||||
else
|
TABLE.update(D,SETTING)
|
||||||
LOG.print(text.dataCorrupted,"warn")
|
FILE.save(SETTING,"conf/settings")
|
||||||
end
|
LOG.print(text.importSuccess,"message")
|
||||||
end},
|
else
|
||||||
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
local D=parseCB()
|
end
|
||||||
if D then
|
end},
|
||||||
TABLE.update(D,VK_org)
|
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,
|
||||||
FILE.save(VK_org,"conf/virtualkey")
|
code=function()
|
||||||
LOG.print(text.importSuccess,"message")
|
local D=parseCB()
|
||||||
else
|
if D then
|
||||||
LOG.print(text.dataCorrupted,"warn")
|
TABLE.update(D,VK_org)
|
||||||
end
|
FILE.save(VK_org,"conf/virtualkey")
|
||||||
end},
|
LOG.print(text.importSuccess,"message")
|
||||||
|
else
|
||||||
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()
|
LOG.print(text.dataCorrupted,"warn")
|
||||||
scene.widgetList.reset.hide=true
|
end
|
||||||
scene.widgetList.resetUnlock.hide=false
|
end},
|
||||||
scene.widgetList.resetRecord.hide=false
|
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,
|
||||||
scene.widgetList.resetData.hide=false
|
code=function()
|
||||||
end},
|
scene.widgetList.reset.hide=true
|
||||||
|
scene.widgetList.resetUnlock.hide=false
|
||||||
|
scene.widgetList.resetRecord.hide=false
|
||||||
|
scene.widgetList.resetData.hide=false
|
||||||
|
end},
|
||||||
WIDGET.newButton{name="resetUnlock", x=340,y=460,w=280,h=100,color="red",
|
WIDGET.newButton{name="resetUnlock", x=340,y=460,w=280,h=100,color="red",
|
||||||
code=function()
|
code=function()
|
||||||
love.filesystem.remove("conf/unlock")
|
love.filesystem.remove("conf/unlock")
|
||||||
@@ -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,15 +34,16 @@ 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"),
|
||||||
SETTING.simpMode=not SETTING.simpMode
|
code=function()
|
||||||
for i=1,#SCN.stack,2 do
|
SETTING.simpMode=not SETTING.simpMode
|
||||||
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
for i=1,#SCN.stack,2 do
|
||||||
SCN.stack[i]=SETTING.simpMode and"main_simple"or"main"
|
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
||||||
break
|
SCN.stack[i]=SETTING.simpMode and"main_simple"or"main"
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end},
|
||||||
end},
|
|
||||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user