大多数菜单的二次确认统一用tryXXX管理
This commit is contained in:
@@ -24,9 +24,7 @@ local sList={
|
||||
|
||||
local scene={}
|
||||
|
||||
local sure
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
destroyPlayers()
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
@@ -80,7 +78,7 @@ function scene.keyDown(key,isRep)
|
||||
elseif key=='m'then
|
||||
SCN.go('custom_mission','swipeD')
|
||||
elseif key=='delete'then
|
||||
if sure>.3 then
|
||||
if tryReset()then
|
||||
TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION)
|
||||
FIELD[1]=DATA.newBoard()
|
||||
TABLE.clear(CUSTOMENV)
|
||||
@@ -90,13 +88,9 @@ function scene.keyDown(key,isRep)
|
||||
saveFile(DATA.copyBoards(),'conf/customBoards')
|
||||
saveFile(DATA.copySequence(),'conf/customSequence')
|
||||
saveFile(CUSTOMENV,'conf/customEnv')
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
else
|
||||
sure=1
|
||||
MES.new('info',text.sureReset)
|
||||
end
|
||||
elseif key=='f1'then
|
||||
SCN.go('mod','swipeD')
|
||||
@@ -129,10 +123,6 @@ function scene.keyDown(key,isRep)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then sure=sure-dt end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.translate(0,-WIDGET.scrollPos)
|
||||
setFont(30)
|
||||
|
||||
@@ -7,7 +7,6 @@ local ins,rem=table.insert,table.remove
|
||||
local FIELD=FIELD
|
||||
local scene={}
|
||||
|
||||
local sure
|
||||
local curPen
|
||||
local pens={-2,0,-1,[false]=false}--Color (air/smart)
|
||||
local penMode
|
||||
@@ -119,7 +118,6 @@ local function _pDraw()
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
sure=0
|
||||
curPen=false
|
||||
penMode=0
|
||||
penX,penY=1,1
|
||||
@@ -182,13 +180,9 @@ function scene.keyDown(key)
|
||||
_pTouch(penX,penY)
|
||||
end
|
||||
elseif key=='delete'then
|
||||
if sure>.3 then
|
||||
if tryReset()then
|
||||
FIELD[page]=DATA.newBoard()
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
MES.new('info',text.sureReset)
|
||||
end
|
||||
elseif key=='j'then
|
||||
demo=not demo
|
||||
@@ -265,12 +259,6 @@ function scene.keyUp(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then
|
||||
sure=sure-dt
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.translate(200,60)
|
||||
|
||||
|
||||
@@ -8,12 +8,10 @@ local scene={}
|
||||
|
||||
local input--Input buffer
|
||||
local cur--Cursor position
|
||||
local sure
|
||||
|
||||
function scene.sceneInit()
|
||||
input=""
|
||||
cur=#MISSION
|
||||
sure=0
|
||||
end
|
||||
function scene.sceneBack()
|
||||
saveFile(DATA.copyMission(),'conf/customMissions')
|
||||
@@ -62,14 +60,10 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
elseif key=='delete'then
|
||||
if sure>.3 then
|
||||
if tryReset()then
|
||||
TABLE.cut(MISSION)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
MES.new('info',text.sureReset)
|
||||
end
|
||||
elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then
|
||||
if #MISSION>0 then
|
||||
@@ -117,12 +111,6 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then
|
||||
sure=sure-dt
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
--Draw frame
|
||||
gc.setLineWidth(2)
|
||||
|
||||
@@ -9,11 +9,9 @@ local gc_setColor,gc_print=gc.setColor,gc.print
|
||||
local scene={}
|
||||
|
||||
local cur--Cursor position
|
||||
local sure
|
||||
|
||||
function scene.sceneInit()
|
||||
cur=#BAG
|
||||
sure=0
|
||||
end
|
||||
function scene.sceneBack()
|
||||
saveFile(DATA.copySequence(),'conf/customSequence')
|
||||
@@ -66,14 +64,10 @@ function scene.keyDown(key)
|
||||
cur=cur-1
|
||||
end
|
||||
elseif key=='delete'then
|
||||
if sure>.3 then
|
||||
if tryReset()then
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
MES.new('info',text.sureReset)
|
||||
end
|
||||
elseif key=='='then
|
||||
local l={1,2,3,4,5,6,7}
|
||||
@@ -119,12 +113,6 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then
|
||||
sure=sure-dt
|
||||
end
|
||||
end
|
||||
|
||||
local blockCharWidth={}for i=1,#BLOCK_CHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth()end
|
||||
function scene.draw()
|
||||
--Draw frame
|
||||
|
||||
@@ -39,8 +39,6 @@ end}
|
||||
|
||||
local scene={}
|
||||
|
||||
local sure
|
||||
|
||||
local function _playRep(fileName)
|
||||
local rep=DATA.parseReplay(fileName,true)
|
||||
if not rep.available then
|
||||
@@ -72,7 +70,6 @@ end
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
sure=0
|
||||
listBox:setList(REPLAY)
|
||||
local hide=listBox:getLen()==0
|
||||
for i=3,5 do
|
||||
@@ -121,8 +118,7 @@ function scene.keyDown(key)
|
||||
elseif key=='delete'then
|
||||
local rep=listBox:getSel()
|
||||
if rep then
|
||||
if sure>.3 then
|
||||
sure=0
|
||||
if tryDelete()then
|
||||
listBox:remove()
|
||||
love.filesystem.remove(rep.fileName)
|
||||
for i=1,#REPLAY do
|
||||
@@ -132,9 +128,6 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
SFX.play('finesseError',.7)
|
||||
else
|
||||
sure=1
|
||||
MES.new('info',text.sureReset)
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -142,12 +135,6 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if sure>0 then
|
||||
sure=sure-dt
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
listBox,
|
||||
WIDGET.newButton{name='export',x=180,y=640,w=140,h=80,color='lG',code=pressKey'cC',font=50,fText=CHAR.icon.export},
|
||||
|
||||
Reference in New Issue
Block a user