整理代码,纠正回放控制按钮显示条件
This commit is contained in:
@@ -7,6 +7,7 @@ local noTouch,noKey=false,false
|
|||||||
local touchMoveLastFrame=false
|
local touchMoveLastFrame=false
|
||||||
local floatRepRate,replayRate=0,1
|
local floatRepRate,replayRate=0,1
|
||||||
|
|
||||||
|
local replaying
|
||||||
local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",[5]="5x"}
|
local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",[5]="5x"}
|
||||||
local function _rep0()replayRate=0 end
|
local function _rep0()replayRate=0 end
|
||||||
local function _repP8()replayRate=.125 end
|
local function _repP8()replayRate=.125 end
|
||||||
@@ -23,12 +24,13 @@ function scene.sceneInit(org)
|
|||||||
resetGameData()
|
resetGameData()
|
||||||
GAME.init=false
|
GAME.init=false
|
||||||
end
|
end
|
||||||
|
replaying=GAME.replaying
|
||||||
if org~='pause'then
|
if org~='pause'then
|
||||||
floatRepRate,replayRate=0,1
|
floatRepRate,replayRate=0,1
|
||||||
end
|
end
|
||||||
noKey=GAME.replaying
|
noKey=replaying
|
||||||
noTouch=not SETTING.VKSwitch or noKey
|
noTouch=not SETTING.VKSwitch or noKey
|
||||||
WIDGET.active.restart.hide=GAME.replaying
|
WIDGET.active.restart.hide=replaying
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
destroyPlayers()
|
destroyPlayers()
|
||||||
@@ -37,7 +39,7 @@ end
|
|||||||
scene.mouseDown=NULL
|
scene.mouseDown=NULL
|
||||||
local function restart()
|
local function restart()
|
||||||
resetGameData(PLAYERS[1].frameRun<240 and'q')
|
resetGameData(PLAYERS[1].frameRun<240 and'q')
|
||||||
noKey=GAME.replaying
|
noKey=replaying
|
||||||
noTouch=noKey
|
noTouch=noKey
|
||||||
end
|
end
|
||||||
function scene.touchDown(x,y)
|
function scene.touchDown(x,y)
|
||||||
@@ -82,7 +84,7 @@ function scene.touchMove()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key,isRep)
|
function scene.keyDown(key,isRep)
|
||||||
if not GAME.replaying then
|
if not replaying then
|
||||||
if isRep then return end
|
if isRep then return end
|
||||||
local k=keyMap.keyboard[key]
|
local k=keyMap.keyboard[key]
|
||||||
if k then
|
if k then
|
||||||
@@ -174,7 +176,7 @@ local function update_common(dt)
|
|||||||
checkWarning()
|
checkWarning()
|
||||||
end
|
end
|
||||||
function scene.update(dt)
|
function scene.update(dt)
|
||||||
local repPtr=GAME.replaying
|
local repPtr=replaying
|
||||||
if repPtr then
|
if repPtr then
|
||||||
floatRepRate=floatRepRate+replayRate
|
floatRepRate=floatRepRate+replayRate
|
||||||
while floatRepRate>=1 do
|
while floatRepRate>=1 do
|
||||||
@@ -194,7 +196,7 @@ function scene.update(dt)
|
|||||||
end
|
end
|
||||||
repPtr=repPtr+2
|
repPtr=repPtr+2
|
||||||
end
|
end
|
||||||
GAME.replaying=repPtr
|
replaying=repPtr
|
||||||
end
|
end
|
||||||
update_common(dt)
|
update_common(dt)
|
||||||
end
|
end
|
||||||
@@ -251,7 +253,7 @@ function scene.draw()
|
|||||||
gc.draw(drawableText.modeName,940,0)
|
gc.draw(drawableText.modeName,940,0)
|
||||||
|
|
||||||
--Replaying
|
--Replaying
|
||||||
if GAME.replaying then
|
if replaying then
|
||||||
setFont(20)
|
setFont(20)
|
||||||
gc.setColor(1,1,TIME()%.8>.4 and 1 or 0)
|
gc.setColor(1,1,TIME()%.8>.4 and 1 or 0)
|
||||||
mStr(text.replaying,770,6)
|
mStr(text.replaying,770,6)
|
||||||
@@ -264,13 +266,13 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newKey{name="rep0", fText=TEXTURE.rep.rep0,x=40,y=50,w=60,code=_rep0,hideF=function()return not GAME.replay and replayRate==0 end},
|
WIDGET.newKey{name="rep0", fText=TEXTURE.rep.rep0,x=40,y=50,w=60,code=_rep0,hideF=function()return not replaying or replayRate==0 end},
|
||||||
WIDGET.newKey{name="repP8", fText=TEXTURE.rep.repP8,x=105,y=50,w=60,code=_repP8,hideF=function()return not GAME.replay and replayRate==.125 end},
|
WIDGET.newKey{name="repP8", fText=TEXTURE.rep.repP8,x=105,y=50,w=60,code=_repP8,hideF=function()return not replaying or replayRate==.125 end},
|
||||||
WIDGET.newKey{name="repP2", fText=TEXTURE.rep.repP2,x=170,y=50,w=60,code=_repP2,hideF=function()return not GAME.replay and replayRate==.5 end},
|
WIDGET.newKey{name="repP2", fText=TEXTURE.rep.repP2,x=170,y=50,w=60,code=_repP2,hideF=function()return not replaying or replayRate==.5 end},
|
||||||
WIDGET.newKey{name="rep1", fText=TEXTURE.rep.rep1,x=235,y=50,w=60,code=_rep1,hideF=function()return not GAME.replay and replayRate==1 end},
|
WIDGET.newKey{name="rep1", fText=TEXTURE.rep.rep1,x=235,y=50,w=60,code=_rep1,hideF=function()return not replaying or replayRate==1 end},
|
||||||
WIDGET.newKey{name="rep2", fText=TEXTURE.rep.rep2,x=300,y=50,w=60,code=_rep2,hideF=function()return not GAME.replay and replayRate==2 end},
|
WIDGET.newKey{name="rep2", fText=TEXTURE.rep.rep2,x=300,y=50,w=60,code=_rep2,hideF=function()return not replaying or replayRate==2 end},
|
||||||
WIDGET.newKey{name="rep5", fText=TEXTURE.rep.rep5,x=365,y=50,w=60,code=_rep5,hideF=function()return not GAME.replay and replayRate==5 end},
|
WIDGET.newKey{name="rep5", fText=TEXTURE.rep.rep5,x=365,y=50,w=60,code=_rep5,hideF=function()return not replaying or replayRate==5 end},
|
||||||
WIDGET.newKey{name="step", fText=TEXTURE.rep.step,x=430,y=50,w=60,code=_step,hideF=function()return not GAME.replay and replayRate~=0 end},
|
WIDGET.newKey{name="step", fText=TEXTURE.rep.step,x=430,y=50,w=60,code=_step,hideF=function()return not replaying or replayRate~=0 end},
|
||||||
WIDGET.newKey{name="restart", fText="R",x=380,y=35,w=60,font=40,code=restart},
|
WIDGET.newKey{name="restart", fText="R",x=380,y=35,w=60,font=40,code=restart},
|
||||||
WIDGET.newKey{name="pause", fText="II",x=900,y=35,w=60,font=40,code=function()pauseGame()end},
|
WIDGET.newKey{name="pause", fText="II",x=900,y=35,w=60,font=40,code=function()pauseGame()end},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user