整理代码

This commit is contained in:
MrZ626
2021-07-13 22:26:10 +08:00
parent 51e709acf6
commit 9818685856
3 changed files with 44 additions and 43 deletions

View File

@@ -564,16 +564,16 @@ function love.run()
--UPDATE --UPDATE
STEP() STEP()
TASK.update()
WS.update(dt)
VOC.update() VOC.update()
BG.update(dt) BG.update(dt)
TEXT.update()
MES.update(dt)
WS.update(dt)
TASK.update()
SYSFX.update(dt) SYSFX.update(dt)
if SCN.update then SCN.update(dt)end if SCN.update then SCN.update(dt)end
if SCN.swapping then SCN.swapUpdate()end if SCN.swapping then SCN.swapUpdate()end
WIDGET.update() WIDGET.update()
TEXT.update()
MES.update(dt)
--DRAW --DRAW
if not MINI()then if not MINI()then
@@ -644,36 +644,36 @@ function love.run()
--New cursor pos disp --New cursor pos disp
gc_replaceTransform(SCR.xOy) gc_replaceTransform(SCR.xOy)
gc_setLineWidth(1) gc_setLineWidth(1)
gc_line(mx,-1e4,mx,1e4) gc_line(mx,-1e4,mx,1e4)
gc_line(-1e4,my,1e4,my) gc_line(-1e4,my,1e4,my)
local t=int(mx+.5)..","..int(my+.5) local t=int(mx+.5)..","..int(my+.5)
gc_setColor(0,0,0) gc_setColor(0,0,0)
gc_print(t,mx+1,my) gc_print(t,mx+1,my)
gc_print(t,mx+1,my-1) gc_print(t,mx+1,my-1)
gc_print(t,mx+2,my-1) gc_print(t,mx+2,my-1)
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc_print(t,mx+2,my) gc_print(t,mx+2,my)
gc_replaceTransform(SCR.xOy_dr) gc_replaceTransform(SCR.xOy_dr)
--Websocket status --Websocket status
for i=1,6 do for i=1,6 do
local status=WS.status(WSnames[i]) local status=WS.status(WSnames[i])
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc.draw(wsBottomImage,-79,20*i-139) gc.draw(wsBottomImage,-79,20*i-139)
if status=='dead'then if status=='dead'then
gc_draw(ws_deadImg,-20,20*i-140) gc_draw(ws_deadImg,-20,20*i-140)
elseif status=='connecting'then elseif status=='connecting'then
gc_setColor(1,1,1,.5+.3*sin(time*6.26)) gc_setColor(1,1,1,.5+.3*sin(time*6.26))
gc_draw(ws_connectingImg,-20,20*i-140) gc_draw(ws_connectingImg,-20,20*i-140)
elseif status=='running'then elseif status=='running'then
gc_draw(ws_runningImg,-20,20*i-140) gc_draw(ws_runningImg,-20,20*i-140)
end
local t1,t2,t3=WS.getTimers(WSnames[i])
gc_setColor(.9,.9,.9,t1)gc.rectangle('fill',-60,20*i-122,-16,-16)
gc_setColor(.3,1,.3,t2)gc.rectangle('fill',-42,20*i-122,-16,-16)
gc_setColor(1,.2,.2,t3)gc.rectangle('fill',-24,20*i-122,-16,-16)
end end
local t1,t2,t3=WS.getTimers(WSnames[i])
gc_setColor(.9,.9,.9,t1)gc.rectangle('fill',-60,20*i-122,-16,-16)
gc_setColor(.3,1,.3,t2)gc.rectangle('fill',-42,20*i-122,-16,-16)
gc_setColor(1,.2,.2,t3)gc.rectangle('fill',-24,20*i-122,-16,-16)
end
end end
gc_present() gc_present()

View File

@@ -12,9 +12,9 @@ return{
{name='drought_n', x=-400, y=0, size=40,shape=1,icon="drought", unlock={'drought_l'}}, {name='drought_n', x=-400, y=0, size=40,shape=1,icon="drought", unlock={'drought_l'}},
{name='drought_l', x=-600, y=0, size=40,shape=1,icon="mess"}, {name='drought_l', x=-600, y=0, size=40,shape=1,icon="mess"},
{name='dig_10l', x=-200, y=-400, size=40,shape=1,icon="dig_sprint", unlock={'dig_40l'}}, {name='dig_10l', x=-200, y=-400, size=40,shape=1,icon="dig_sprint",unlock={'dig_40l'}},
{name='dig_40l', x=-400, y=-400, size=40,shape=1,icon="dig_sprint", unlock={'dig_100l'}}, {name='dig_40l', x=-400, y=-400, size=40,shape=1,icon="dig_sprint",unlock={'dig_100l'}},
{name='dig_100l', x=-600, y=-400, size=40,shape=1,icon="dig_sprint", unlock={'dig_400l'}}, {name='dig_100l', x=-600, y=-400, size=40,shape=1,icon="dig_sprint",unlock={'dig_400l'}},
{name='dig_400l', x=-800, y=-200, size=40,shape=1,icon="dig_sprint"}, {name='dig_400l', x=-800, y=-200, size=40,shape=1,icon="dig_sprint"},
{name='marathon_n', x=0, y=-600, size=60,shape=1,icon="marathon",unlock={'marathon_h','rhythm_e','solo_e','round_e','blind_e','classic_fast','survivor_e','bigbang','zen'}}, {name='marathon_n', x=0, y=-600, size=60,shape=1,icon="marathon",unlock={'marathon_h','rhythm_e','solo_e','round_e','blind_e','classic_fast','survivor_e','bigbang','zen'}},
@@ -74,7 +74,7 @@ return{
{name='dig_u', x=700, y=-1000,size=40,shape=1,icon="dig"}, {name='dig_u', x=700, y=-1000,size=40,shape=1,icon="dig"},
{name='bigbang', x=400, y=-400, size=50,shape=1,icon="bigbang", unlock={'c4wtrain_n','pctrain_n','tech_n'}}, {name='bigbang', x=400, y=-400, size=50,shape=1,icon="bigbang", unlock={'c4wtrain_n','pctrain_n','tech_n'}},
{name='c4wtrain_n', x=700, y=-400, size=40,shape=1,icon="pc",unlock={'c4wtrain_l'}}, {name='c4wtrain_n', x=700, y=-400, size=40,shape=1,icon="pc", unlock={'c4wtrain_l'}},
{name='c4wtrain_l', x=900, y=-400, size=40,shape=1,icon="pc"}, {name='c4wtrain_l', x=900, y=-400, size=40,shape=1,icon="pc"},
{name='pctrain_n', x=700, y=-250, size=40,shape=1,icon="pc", unlock={'pctrain_l','pc_n'}}, {name='pctrain_n', x=700, y=-250, size=40,shape=1,icon="pc", unlock={'pctrain_l','pc_n'}},

View File

@@ -584,18 +584,19 @@ function Player:resetBlock()--Reset Block's position and execute I*S
end end
function Player:spin(d,ifpre) function Player:spin(d,ifpre)
local kickData=self.RS[self.cur.id] local cur=self.cur
local kickData=self.RS[cur.id]
if type(kickData)=='table'then if type(kickData)=='table'then
local idir=(self.cur.dir+d)%4 local idir=(cur.dir+d)%4
kickData=kickData[self.cur.dir*10+idir] kickData=kickData[cur.dir*10+idir]
if not kickData then if not kickData then
self:freshBlock('move') self:freshBlock('move')
SFX.play(ifpre and'prerotate'or'rotate',nil,self:getCenterX()*.15) SFX.play(ifpre and'prerotate'or'rotate',nil,self:getCenterX()*.15)
return return
end end
local icb=BLOCKS[self.cur.id][idir] local icb=BLOCKS[cur.id][idir]
local isc=SCS[self.cur.id][idir] local isc=SCS[cur.id][idir]
local ix,iy=self.curX+self.cur.sc[2]-isc[2],self.curY+self.cur.sc[1]-isc[1] local ix,iy=self.curX+cur.sc[2]-isc[2],self.curY+cur.sc[1]-isc[1]
for test=1,#kickData do for test=1,#kickData do
local x,y=ix+kickData[test][1],iy+kickData[test][2] local x,y=ix+kickData[test][1],iy+kickData[test][2]
if not self:ifoverlap(icb,x,y)and(self.freshTime>0 or kickData[test][2]<=0)then if not self:ifoverlap(icb,x,y)and(self.freshTime>0 or kickData[test][2]<=0)then
@@ -603,8 +604,8 @@ function Player:spin(d,ifpre)
if self.gameEnv.moveFX and self.gameEnv.block then if self.gameEnv.moveFX and self.gameEnv.block then
self:createMoveFX() self:createMoveFX()
end end
self.curX,self.curY,self.cur.dir=ix,iy,idir self.curX,self.curY,cur.dir=ix,iy,idir
self.cur.sc,self.cur.bk=isc,icb cur.sc,cur.bk=isc,icb
self.spinLast=test==2 and 0 or 1 self.spinLast=test==2 and 0 or 1
local t=self.freshTime local t=self.freshTime