修复多处全局变量泄露,整理代码

This commit is contained in:
MrZ626
2021-04-25 15:20:48 +08:00
parent 4f278925f4
commit 3d02bc87ea
6 changed files with 13 additions and 11 deletions

View File

@@ -241,7 +241,7 @@ function DATA.copyQuestArgs()
end
do--function DATA.pasteQuestArgs(str)
local sub=string.sub
function pasteQuestArgs(str)
function DATA.pasteQuestArgs(str)
if #str<4 then return end
local ENV=CUSTOMENV
ENV.holdCount= byte(str,1)-48

View File

@@ -1604,7 +1604,7 @@ local function tick_lose(self)
end
end
end
function tick_autoPause()
local function tick_autoPause()
local time=0
while true do
yield()

View File

@@ -23,7 +23,7 @@ local function new()
end
end
scene={}
local scene={}
function scene.sceneInit()
state=0

View File

@@ -75,7 +75,7 @@ function scene.keyDown(key)
local args=STRING.split(str:sub((str:find(":")or 0)+1),"!")
if #args<4 then goto THROW_fail end
if not(
pasteQuestArgs(args[1])and
DATA.pasteQuestArgs(args[1])and
DATA.pasteSequence(args[2])and
DATA.pasteMission(args[3])
)then goto THROW_fail end

View File

@@ -194,6 +194,7 @@ local baseRankColor={
{.85,.8,.3,.3},
{.4,.7,.4,.3},
}
local rankColor=rankColor
local function drawModeShape(M,S,drawType)
if M.shape==1 then--Rectangle
gc.rectangle(drawType,M.x-S,M.y-S,2*S,2*S)

View File

@@ -2,7 +2,8 @@ local gc=love.graphics
local sin,log=math.sin,math.log10
local format=string.format
local SCR,setFont,mStr=SCR,setFont,mStr
local GAME,SCR=GAME,SCR
local setFont,mStr=setFont,mStr
local fnsRankColor={
Z=COLOR.lY,
@@ -311,12 +312,12 @@ function scene.draw()
end
scene.widgetList={
WIDGET.newButton{name="setting", x=1120, y=70, w=240,h=90, color="lB",font=35,code=pressKey"s"},
WIDGET.newButton{name="replay", x=535, y=250, w=200,h=100,color="lY",font=30,code=pressKey"p",hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end},
WIDGET.newButton{name="save", x=745, y=250, w=200,h=100,color="G",font=30,code=pressKey"o",hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 or GAME.saved end},
WIDGET.newButton{name="resume", x=640, y=367, w=240,h=100,color="lG",font=30,code=pressKey"escape"},
WIDGET.newButton{name="restart", x=640, y=483, w=240,h=100,color="lR",font=35,code=pressKey"r"},
WIDGET.newButton{name="quit", x=640, y=600, w=240,h=100,font=35,code=backScene},
WIDGET.newButton{name="setting", x=1120,y=70,w=240,h=90, color="lB",font=35,code=pressKey"s"},
WIDGET.newButton{name="replay", x=535,y=250,w=200,h=100,color="lY",font=30,code=pressKey"p",hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end},
WIDGET.newButton{name="save", x=745,y=250,w=200,h=100,color="G",font=30,code=pressKey"o",hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 or GAME.saved end},
WIDGET.newButton{name="resume", x=640,y=367,w=240,h=100,color="lG",font=30,code=pressKey"escape"},
WIDGET.newButton{name="restart", x=640,y=483,w=240,h=100,color="lR",font=35,code=pressKey"r"},
WIDGET.newButton{name="quit", x=640,y=600,w=240,h=100,font=35,code=backScene},
}
return scene