统一注释位置

This commit is contained in:
MrZ_26
2020-08-03 04:16:54 +08:00
parent 1cbd9e717a
commit 798f691b4c
5 changed files with 23 additions and 12 deletions

View File

@@ -227,14 +227,15 @@ back.space={
S[i+2]=rnd(H)-10 --Y S[i+2]=rnd(H)-10 --Y
S[i+3]=(rnd()-.5)*.01*s --Vx S[i+3]=(rnd()-.5)*.01*s --Vx
S[i+4]=(rnd()-.5)*.01*s --Vy S[i+4]=(rnd()-.5)*.01*s --Vy
end--800 var end
end, end,
update=function(dt) update=function(dt)
local S=stars local S=stars
--Star moving
for i=1,1260,5 do for i=1,1260,5 do
S[i+1]=(S[i+1]+S[i+3])%W S[i+1]=(S[i+1]+S[i+3])%W
S[i+2]=(S[i+2]+S[i+4])%H S[i+2]=(S[i+2]+S[i+4])%H
end--Star moving end
end, end,
draw=function() draw=function()
gc.clear(.2,.2,.2) gc.clear(.2,.2,.2)
@@ -254,13 +255,14 @@ back.space={
end, end,
} }
--Make BG vars invisible
for _,bg in next,back do for _,bg in next,back do
if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars) if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars)
if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars) if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars)
if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars) if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars)
if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars) if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars)
if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars) if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars)
end--Make BG vars invisible end
BG={ BG={
cur="none", cur="none",

View File

@@ -186,6 +186,7 @@ function Pnt.mode()
local sel=cam.sel local sel=cam.sel
setFont(30) setFont(30)
--Draw lines connecting modes
gc.setLineWidth(8) gc.setLineWidth(8)
gc.setColor(1,1,1,.2) gc.setColor(1,1,1,.2)
for name,M in next,Modes do for name,M in next,Modes do
@@ -195,7 +196,7 @@ function Pnt.mode()
gc.line(M.x,M.y,m.x,m.y) gc.line(M.x,M.y,m.x,m.y)
end end
end end
end--Lines connecting modes end
for name,M in next,Modes do for name,M in next,Modes do
if R[name]then if R[name]then
@@ -441,6 +442,7 @@ function Pnt.play()
for p=1,#players do for p=1,#players do
players[p]:draw() players[p]:draw()
end end
gc.setLineWidth(5) gc.setLineWidth(5)
for i=1,#FX_attack do for i=1,#FX_attack do
local A=FX_attack[i] local A=FX_attack[i]
@@ -463,9 +465,11 @@ function Pnt.play()
gc.rotate(A.t*.1) gc.rotate(A.t*.1)
gc.circle("fill",0,0,A.rad,A.corner) gc.circle("fill",0,0,A.rad,A.corner)
gc.pop() gc.pop()
end--FX animation end
gc.setColor(1,1,1) gc.setColor(1,1,1)
if setting.VKSwitch then drawVirtualkey()end if setting.VKSwitch then drawVirtualkey()end
if modeEnv.royaleMode then if modeEnv.royaleMode then
for i=1,#FX_badge do for i=1,#FX_badge do
local b=FX_badge[i] local b=FX_badge[i]
@@ -501,7 +505,7 @@ function Pnt.play()
gc.draw(drawableText.modeName,485,10) gc.draw(drawableText.modeName,485,10)
gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10) gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10)
--Danger --Warning
gc.push("transform") gc.push("transform")
gc.origin() gc.origin()
if restartCount>0 then if restartCount>0 then
@@ -843,6 +847,6 @@ function Pnt.history()
gc.rectangle("line",30,45,1000,632) gc.rectangle("line",30,45,1000,632)
setFont(20) setFont(20)
local _=sceneTemp local _=sceneTemp
gc.print(_[1][_[2]],40,50) gc.print(_.text[_.pos],40,50)
end end
return Pnt return Pnt

View File

@@ -74,7 +74,7 @@ local TEXT={}
function TEXT.clear() function TEXT.clear()
texts={} texts={}
end end
function TEXT.getText(text,x,y,font,style,spd,stop) function TEXT.getText(text,x,y,font,style,spd,stop)--Another version of TEXT()
return{ return{
c=0, c=0,
text=text, text=text,
@@ -85,7 +85,7 @@ function TEXT.getText(text,x,y,font,style,spd,stop)
stop=stop, stop=stop,
draw=textFX[style]or assert(false,"unavailable type:"..style), draw=textFX[style]or assert(false,"unavailable type:"..style),
} }
end--Another version of TEXT() end
function TEXT.show(text,x,y,font,style,spd,stop) function TEXT.show(text,x,y,font,style,spd,stop)
texts[#texts+1]={ texts[#texts+1]={
c=0, --Timer c=0, --Timer

View File

@@ -199,10 +199,12 @@ WIDGET.sel=nil--Selected widget
function WIDGET.set(L) function WIDGET.set(L)
WIDGET.sel=nil WIDGET.sel=nil
WIDGET.active=L or{} WIDGET.active=L or{}
--Reset all widgets
if L then if L then
for _,W in next,L do for _,W in next,L do
W:reset() W:reset()
end--Reset all widgets end
end end
end end

View File

@@ -199,6 +199,7 @@ return{
["9S"]={ ["9S"]={
function(P,ctrl) function(P,ctrl)
local Tfield={}--Test field local Tfield={}--Test field
local best={x=1,dir=0,hold=false,score=-1e99}--Best method
local field_org=P.field local field_org=P.field
for i=1,#field_org do for i=1,#field_org do
Tfield[i]=freeRow.get(0) Tfield[i]=freeRow.get(0)
@@ -206,7 +207,7 @@ return{
Tfield[i][j]=field_org[i][j] Tfield[i][j]=field_org[i][j]
end end
end end
local best={x=1,dir=0,hold=false,score=-1e99}
for ifhold=0,P.gameEnv.hold and 1 or 0 do for ifhold=0,P.gameEnv.hold and 1 or 0 do
--Get block id --Get block id
local bn local bn
@@ -247,9 +248,11 @@ return{
::CTN:: ::CTN::
end end
if not best.bn then return 1 end if not best.bn then return 1 end
--Release cache
while #Tfield>0 do while #Tfield>0 do
freeRow.discard(rem(Tfield,1)) freeRow.discard(rem(Tfield,1))
end--Release cache end
local p=#ctrl+1 local p=#ctrl+1
if best.hold then if best.hold then
ctrl[p]=8 ctrl[p]=8