From 798f691b4cb35b64a46bcfcef18dd4fa6392eb48 Mon Sep 17 00:00:00 2001 From: MrZ_26 Date: Mon, 3 Aug 2020 04:16:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=B3=A8=E9=87=8A=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/bg.lua | 8 +++++--- Zframework/paint.lua | 12 ++++++++---- Zframework/text.lua | 4 ++-- Zframework/widget.lua | 4 +++- parts/ai.lua | 7 +++++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Zframework/bg.lua b/Zframework/bg.lua index fbb428e1..8f72bb7f 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -227,14 +227,15 @@ back.space={ S[i+2]=rnd(H)-10 --Y S[i+3]=(rnd()-.5)*.01*s --Vx S[i+4]=(rnd()-.5)*.01*s --Vy - end--800 var + end end, update=function(dt) local S=stars + --Star moving for i=1,1260,5 do S[i+1]=(S[i+1]+S[i+3])%W S[i+2]=(S[i+2]+S[i+4])%H - end--Star moving + end end, draw=function() gc.clear(.2,.2,.2) @@ -254,13 +255,14 @@ back.space={ end, } +--Make BG vars invisible for _,bg in next,back do 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.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.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars) -end--Make BG vars invisible +end BG={ cur="none", diff --git a/Zframework/paint.lua b/Zframework/paint.lua index 89720ceb..7468d5c9 100644 --- a/Zframework/paint.lua +++ b/Zframework/paint.lua @@ -186,6 +186,7 @@ function Pnt.mode() local sel=cam.sel setFont(30) + --Draw lines connecting modes gc.setLineWidth(8) gc.setColor(1,1,1,.2) for name,M in next,Modes do @@ -195,7 +196,7 @@ function Pnt.mode() gc.line(M.x,M.y,m.x,m.y) end end - end--Lines connecting modes + end for name,M in next,Modes do if R[name]then @@ -441,6 +442,7 @@ function Pnt.play() for p=1,#players do players[p]:draw() end + gc.setLineWidth(5) for i=1,#FX_attack do local A=FX_attack[i] @@ -463,9 +465,11 @@ function Pnt.play() gc.rotate(A.t*.1) gc.circle("fill",0,0,A.rad,A.corner) gc.pop() - end--FX animation + end + gc.setColor(1,1,1) if setting.VKSwitch then drawVirtualkey()end + if modeEnv.royaleMode then for i=1,#FX_badge do local b=FX_badge[i] @@ -501,7 +505,7 @@ function Pnt.play() gc.draw(drawableText.modeName,485,10) gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10) - --Danger + --Warning gc.push("transform") gc.origin() if restartCount>0 then @@ -843,6 +847,6 @@ function Pnt.history() gc.rectangle("line",30,45,1000,632) setFont(20) local _=sceneTemp - gc.print(_[1][_[2]],40,50) + gc.print(_.text[_.pos],40,50) end return Pnt \ No newline at end of file diff --git a/Zframework/text.lua b/Zframework/text.lua index b0985bd4..bf3ec76a 100644 --- a/Zframework/text.lua +++ b/Zframework/text.lua @@ -74,7 +74,7 @@ local TEXT={} function TEXT.clear() texts={} 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{ c=0, text=text, @@ -85,7 +85,7 @@ function TEXT.getText(text,x,y,font,style,spd,stop) stop=stop, 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) texts[#texts+1]={ c=0, --Timer diff --git a/Zframework/widget.lua b/Zframework/widget.lua index d1365dda..b8d8b7dc 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -199,10 +199,12 @@ WIDGET.sel=nil--Selected widget function WIDGET.set(L) WIDGET.sel=nil WIDGET.active=L or{} + + --Reset all widgets if L then for _,W in next,L do W:reset() - end--Reset all widgets + end end end diff --git a/parts/ai.lua b/parts/ai.lua index f13c2c33..f148746c 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -199,6 +199,7 @@ return{ ["9S"]={ function(P,ctrl) local Tfield={}--Test field + local best={x=1,dir=0,hold=false,score=-1e99}--Best method local field_org=P.field for i=1,#field_org do Tfield[i]=freeRow.get(0) @@ -206,7 +207,7 @@ return{ Tfield[i][j]=field_org[i][j] end end - local best={x=1,dir=0,hold=false,score=-1e99} + for ifhold=0,P.gameEnv.hold and 1 or 0 do --Get block id local bn @@ -247,9 +248,11 @@ return{ ::CTN:: end if not best.bn then return 1 end + + --Release cache while #Tfield>0 do freeRow.discard(rem(Tfield,1)) - end--Release cache + end local p=#ctrl+1 if best.hold then ctrl[p]=8