整理代码
This commit is contained in:
@@ -97,20 +97,21 @@ local function newEmptyPlayer(id,mini)
|
||||
P.x,P.y,P.size=0,0,1
|
||||
P.frameColor=0
|
||||
|
||||
P.mini=mini--If draw in small mode
|
||||
|
||||
--Set these at Player:setPosition()
|
||||
-- P.fieldX,P.fieldY=...
|
||||
-- P.centerX,P.centerY=...
|
||||
-- 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.frameWait=rnd(30,120)
|
||||
P.frameWait=rnd(26,62)
|
||||
P.draw=PLY.draw.small
|
||||
else
|
||||
P.draw=PLY.draw.norm
|
||||
end
|
||||
|
||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
||||
|
||||
P.alive=true
|
||||
@@ -323,15 +324,14 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
||||
ENV.splashFX=false
|
||||
ENV.shakeFX=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
|
||||
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.center==0 then ENV.center=false end
|
||||
end
|
||||
|
||||
@@ -271,19 +271,21 @@ function scene.draw()
|
||||
end
|
||||
scene.widgetList={
|
||||
textBox,
|
||||
WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space",hide=function()
|
||||
return
|
||||
playing or
|
||||
not textBox.hide or
|
||||
PLY_NET[1].ready or
|
||||
NET.getlock("ready")
|
||||
WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space",
|
||||
hide=function()
|
||||
return
|
||||
playing or
|
||||
not textBox.hide or
|
||||
PLY_NET[1].ready or
|
||||
NET.getlock("ready")
|
||||
end},
|
||||
WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color="grey",font=40,code=pressKey"space",hide=function()
|
||||
return
|
||||
playing or
|
||||
not textBox.hide or
|
||||
not PLY_NET[1].ready or
|
||||
NET.getlock("ready")
|
||||
WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color="grey",font=40,code=pressKey"space",
|
||||
hide=function()
|
||||
return
|
||||
playing or
|
||||
not textBox.hide or
|
||||
not PLY_NET[1].ready or
|
||||
NET.getlock("ready")
|
||||
end},
|
||||
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"},
|
||||
|
||||
@@ -12,24 +12,25 @@ end
|
||||
|
||||
scene.widgetList={
|
||||
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="logout", x=1140, y=70,w=180,h=70,color="dR",code=function()
|
||||
if TIME()-lastLogoutTime<1 then
|
||||
if USER.uid then
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_user()
|
||||
USER.username=false
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
FILE.save(USER,"conf/user","q")
|
||||
SCN.back()
|
||||
WIDGET.newButton{name="logout", x=1140, y=70,w=180,h=70,color="dR",
|
||||
code=function()
|
||||
if TIME()-lastLogoutTime<1 then
|
||||
if USER.uid then
|
||||
NET.wsclose_play()
|
||||
NET.wsclose_user()
|
||||
USER.username=false
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
FILE.save(USER,"conf/user","q")
|
||||
SCN.back()
|
||||
end
|
||||
else
|
||||
LOG.print(text.sureQuit,COLOR.orange)
|
||||
lastLogoutTime=TIME()
|
||||
end
|
||||
else
|
||||
LOG.print(text.sureQuit,COLOR.orange)
|
||||
lastLogoutTime=TIME()
|
||||
end
|
||||
end},
|
||||
end},
|
||||
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="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()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,RANKS)
|
||||
FILE.save(RANKS,"conf/unlock")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
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()
|
||||
local D=parseCB()
|
||||
if D and D.version==STAT.version then
|
||||
TABLE.update(D,STAT)
|
||||
FILE.save(STAT,"conf/data")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
FILE.save(SETTING,"conf/settings")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,code=function()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
FILE.save(VK_org,"conf/virtualkey")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
|
||||
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,code=function()
|
||||
scene.widgetList.reset.hide=true
|
||||
scene.widgetList.resetUnlock.hide=false
|
||||
scene.widgetList.resetRecord.hide=false
|
||||
scene.widgetList.resetData.hide=false
|
||||
end},
|
||||
WIDGET.newButton{name="importUnlock", x=190,y=300,w=280,h=100,color="lBlue",font=25,
|
||||
code=function()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,RANKS)
|
||||
FILE.save(RANKS,"conf/unlock")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
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()
|
||||
local D=parseCB()
|
||||
if D and D.version==STAT.version then
|
||||
TABLE.update(D,STAT)
|
||||
FILE.save(STAT,"conf/data")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,
|
||||
code=function()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,SETTING)
|
||||
FILE.save(SETTING,"conf/settings")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,
|
||||
code=function()
|
||||
local D=parseCB()
|
||||
if D then
|
||||
TABLE.update(D,VK_org)
|
||||
FILE.save(VK_org,"conf/virtualkey")
|
||||
LOG.print(text.importSuccess,"message")
|
||||
else
|
||||
LOG.print(text.dataCorrupted,"warn")
|
||||
end
|
||||
end},
|
||||
WIDGET.newButton{name="reset", x=640,y=460,w=280,h=100,color="lRed",font=40,
|
||||
code=function()
|
||||
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",
|
||||
code=function()
|
||||
love.filesystem.remove("conf/unlock")
|
||||
@@ -106,7 +110,6 @@ scene.widgetList={
|
||||
LOG.print("effected after restart game","message")
|
||||
LOG.print("play one game to get data back","message")
|
||||
end,hide=true},
|
||||
|
||||
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="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="simpMode", x=1060, y=550, font=25,disp=SETval("simpMode"),code=function()
|
||||
SETTING.simpMode=not SETTING.simpMode
|
||||
for i=1,#SCN.stack,2 do
|
||||
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
||||
SCN.stack[i]=SETTING.simpMode and"main_simple"or"main"
|
||||
break
|
||||
WIDGET.newSwitch{name="simpMode", x=1060, y=550, font=25,disp=SETval("simpMode"),
|
||||
code=function()
|
||||
SETTING.simpMode=not SETTING.simpMode
|
||||
for i=1,#SCN.stack,2 do
|
||||
if SCN.stack[i]=="main"or SCN.stack[i]=="main_simple"then
|
||||
SCN.stack[i]=SETTING.simpMode and"main_simple"or"main"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end},
|
||||
end},
|
||||
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user