控件模块/场景代码更好地响应系统长按
This commit is contained in:
@@ -257,7 +257,7 @@ local function noDevkeyPressed(key)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function love.keypressed(key)
|
function love.keypressed(key,_,isRep)
|
||||||
mouseShow=false
|
mouseShow=false
|
||||||
if devMode and not noDevkeyPressed(key)then
|
if devMode and not noDevkeyPressed(key)then
|
||||||
return
|
return
|
||||||
@@ -272,11 +272,13 @@ function love.keypressed(key)
|
|||||||
end
|
end
|
||||||
elseif not SCN.swapping then
|
elseif not SCN.swapping then
|
||||||
if SCN.keyDown then
|
if SCN.keyDown then
|
||||||
if #EDITING==0 then SCN.keyDown(key)end
|
if EDITING==""then
|
||||||
elseif key=="escape"then
|
SCN.keyDown(key,isRep)
|
||||||
|
end
|
||||||
|
elseif key=="escape"and not isRep then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
WIDGET.keyPressed(key,isRep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1150,9 +1150,9 @@ function WIDGET.release(x,y)
|
|||||||
W:release(x,y+WIDGET.scrollPos)
|
W:release(x,y+WIDGET.scrollPos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.keyPressed(k)
|
function WIDGET.keyPressed(k,isRep)
|
||||||
local W=WIDGET.sel
|
local W=WIDGET.sel
|
||||||
if k=="space"or k=="return"then
|
if not isRep and(k=="space"or k=="return")then
|
||||||
WIDGET.press()
|
WIDGET.press()
|
||||||
elseif kb.isDown("lshift","lalt","lctrl")and(k=="left"or k=="right")then
|
elseif kb.isDown("lshift","lalt","lctrl")and(k=="left"or k=="right")then
|
||||||
--When hold [↑], control slider with left/right
|
--When hold [↑], control slider with left/right
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ local function tapBoard(x,y,key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="up"then
|
if key=="up"then
|
||||||
tapBoard(cx,cy-(revKB and 1 or -1),true)
|
tapBoard(cx,cy-(revKB and 1 or -1),true)
|
||||||
elseif key=="down"then
|
elseif key=="down"then
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ local startTime,time
|
|||||||
local state,progress
|
local state,progress
|
||||||
local move
|
local move
|
||||||
|
|
||||||
|
local autoPressing
|
||||||
local nextTile,nextCD
|
local nextTile,nextCD
|
||||||
local nextPos,prevPos
|
local nextPos,prevPos
|
||||||
local prevSpawnTime=0
|
local prevSpawnTime=0
|
||||||
@@ -232,10 +233,6 @@ function scene.sceneInit()
|
|||||||
tapControl=false
|
tapControl=false
|
||||||
startTime=0
|
startTime=0
|
||||||
reset()
|
reset()
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.mouseDown(x,y,k)
|
function scene.mouseDown(x,y,k)
|
||||||
@@ -277,7 +274,9 @@ local function playRep(n)
|
|||||||
repeater.focus=false
|
repeater.focus=false
|
||||||
local move0=move
|
local move0=move
|
||||||
for i=1,#repeater.seq[n],3 do
|
for i=1,#repeater.seq[n],3 do
|
||||||
|
autoPressing=true
|
||||||
scene.keyDown(arrows[repeater.seq[n]:sub(i,i+2)],true)
|
scene.keyDown(arrows[repeater.seq[n]:sub(i,i+2)],true)
|
||||||
|
autoPressing=false
|
||||||
end
|
end
|
||||||
if move~=move0 then
|
if move~=move0 then
|
||||||
if repeater.seq[n]~=repeater.last[n]then
|
if repeater.seq[n]~=repeater.last[n]then
|
||||||
@@ -289,7 +288,8 @@ local function playRep(n)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key,auto)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||||
if repeater.focus then
|
if repeater.focus then
|
||||||
local f=repeater.focus
|
local f=repeater.focus
|
||||||
@@ -311,7 +311,7 @@ function scene.keyDown(key,auto)
|
|||||||
newTile()
|
newTile()
|
||||||
TEXT.show(arrows[key],640,360,80,'beat',3)
|
TEXT.show(arrows[key],640,360,80,'beat',3)
|
||||||
move=move+1
|
move=move+1
|
||||||
if not auto then
|
if not autoPressing then
|
||||||
SFX.play('move')
|
SFX.play('move')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,13 +41,10 @@ function scene.sceneInit()
|
|||||||
startTime=0
|
startTime=0
|
||||||
time=0
|
time=0
|
||||||
state=0
|
state=0
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if #key==1 then
|
if #key==1 then
|
||||||
if state<2 and frameKeyCount<3 then
|
if state<2 and frameKeyCount<3 then
|
||||||
if key:upper():byte()==targetString:byte(progress)then
|
if key:upper():byte()==targetString:byte(progress)then
|
||||||
|
|||||||
@@ -15,23 +15,23 @@ function scene.sceneInit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.mouseDown=NULL
|
scene.mouseDown=NULL
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k:byte()>=48 and k:byte()<=57 then
|
if key:byte()>=48 and key:byte()<=57 then
|
||||||
if sym=="="then
|
if sym=="="then
|
||||||
val=k
|
val=key
|
||||||
sym=false
|
sym=false
|
||||||
elseif sym and not reg then
|
elseif sym and not reg then
|
||||||
reg=val
|
reg=val
|
||||||
val=k
|
val=key
|
||||||
else
|
else
|
||||||
if #val<14 then
|
if #val<14 then
|
||||||
if val=="0"then val=""end
|
if val=="0"then val=""end
|
||||||
val=val..k
|
val=val..key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif k:sub(1,2)=="kp"then
|
elseif key:sub(1,2)=="kp"then
|
||||||
scene.keyDown(k:sub(3))
|
scene.keyDown(key:sub(3))
|
||||||
elseif k=="."then
|
elseif key=="."then
|
||||||
if not(val:find(".",nil,true)or val:find("e"))then
|
if not(val:find(".",nil,true)or val:find("e"))then
|
||||||
if sym and not reg then
|
if sym and not reg then
|
||||||
reg=val
|
reg=val
|
||||||
@@ -39,11 +39,11 @@ function scene.keyDown(k)
|
|||||||
end
|
end
|
||||||
val=val.."."
|
val=val.."."
|
||||||
end
|
end
|
||||||
elseif k=="e"then
|
elseif key=="e"then
|
||||||
if not val:find("e")then
|
if not val:find("e")then
|
||||||
val=val.."e"
|
val=val.."e"
|
||||||
end
|
end
|
||||||
elseif k=="backspace"then
|
elseif key=="backspace"then
|
||||||
if sym=="="then
|
if sym=="="then
|
||||||
val=""
|
val=""
|
||||||
elseif sym then
|
elseif sym then
|
||||||
@@ -52,11 +52,11 @@ function scene.keyDown(k)
|
|||||||
val=val:sub(1,-2)
|
val=val:sub(1,-2)
|
||||||
end
|
end
|
||||||
if val==""then val="0"end
|
if val==""then val="0"end
|
||||||
elseif k=="+"or k=="="and kb.isDown("lshift","rshift")then sym="+" reg=false
|
elseif key=="+"or key=="="and kb.isDown("lshift","rshift")then sym="+" reg=false
|
||||||
elseif k=="*"or k=="8"and kb.isDown("lshift","rshift")then sym="*" reg=false
|
elseif key=="*"or key=="8"and kb.isDown("lshift","rshift")then sym="*" reg=false
|
||||||
elseif k=="-"then sym="-" reg=false
|
elseif key=="-"then sym="-" reg=false
|
||||||
elseif k=="/"then sym="/" reg=false
|
elseif key=="/"then sym="/" reg=false
|
||||||
elseif k=="return"then
|
elseif key=="return"then
|
||||||
if val:byte(-1)==101 then val=val:sub(1,-2)end
|
if val:byte(-1)==101 then val=val:sub(1,-2)end
|
||||||
if sym and reg then
|
if sym and reg then
|
||||||
if reg:byte(-1)==101 then reg=reg:sub(1,-2)end
|
if reg:byte(-1)==101 then reg=reg:sub(1,-2)end
|
||||||
@@ -69,13 +69,13 @@ function scene.keyDown(k)
|
|||||||
end
|
end
|
||||||
sym="="
|
sym="="
|
||||||
reg=false
|
reg=false
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
if val~="0"then
|
if val~="0"then
|
||||||
val,reg,sym="0"
|
val,reg,sym="0"
|
||||||
else
|
else
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
elseif k=="delete"then
|
elseif key=="delete"then
|
||||||
val="0"
|
val="0"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,13 +15,10 @@ function scene.sceneInit()
|
|||||||
ex,ey=626,260
|
ex,ey=626,260
|
||||||
BG.set('matrix')
|
BG.set('matrix')
|
||||||
BGM.play('hang out')
|
BGM.play('hang out')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="space"or key=="return"then
|
if key=="space"or key=="return"then
|
||||||
if state==0 then
|
if state==0 then
|
||||||
state=1
|
state=1
|
||||||
|
|||||||
@@ -835,8 +835,8 @@ function scene.wheelMoved(_,y)
|
|||||||
WHEELMOV(y,"scrollup","scrolldown")
|
WHEELMOV(y,"scrollup","scrolldown")
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k=="return"then
|
if key=="return"then
|
||||||
local input=STRING.trim(inputBox:getText())
|
local input=STRING.trim(inputBox:getText())
|
||||||
if input==""then return end
|
if input==""then return end
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ function scene.keyDown(k)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
elseif k=="up"then
|
elseif key=="up"then
|
||||||
if not hisPtr then
|
if not hisPtr then
|
||||||
hisPtr=#history
|
hisPtr=#history
|
||||||
if hisPtr>0 then
|
if hisPtr>0 then
|
||||||
@@ -891,7 +891,7 @@ function scene.keyDown(k)
|
|||||||
hisPtr=hisPtr-1
|
hisPtr=hisPtr-1
|
||||||
inputBox:setText(history[hisPtr])
|
inputBox:setText(history[hisPtr])
|
||||||
end
|
end
|
||||||
elseif k=="down"then
|
elseif key=="down"then
|
||||||
if hisPtr then
|
if hisPtr then
|
||||||
hisPtr=hisPtr+1
|
hisPtr=hisPtr+1
|
||||||
if history[hisPtr]then
|
if history[hisPtr]then
|
||||||
@@ -901,7 +901,7 @@ function scene.keyDown(k)
|
|||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif k=="tab"then
|
elseif key=="tab"then
|
||||||
local str=inputBox:getText()
|
local str=inputBox:getText()
|
||||||
if str~=""and not str:find("%s")then
|
if str~=""and not str:find("%s")then
|
||||||
local res={}
|
local res={}
|
||||||
@@ -919,15 +919,15 @@ function scene.keyDown(k)
|
|||||||
inputBox:setText(res[1])
|
inputBox:setText(res[1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif k=="scrollup"then outputBox:scroll(-5)
|
elseif key=="scrollup"then outputBox:scroll(-5)
|
||||||
elseif k=="scrolldown"then outputBox:scroll(5)
|
elseif key=="scrolldown"then outputBox:scroll(5)
|
||||||
elseif k=="pageup"then outputBox:scroll(-20)
|
elseif key=="pageup"then outputBox:scroll(-20)
|
||||||
elseif k=="pagedown"then outputBox:scroll(20)
|
elseif key=="pagedown"then outputBox:scroll(20)
|
||||||
elseif k=="home"then outputBox:scroll(-1e99)
|
elseif key=="home"then outputBox:scroll(-1e99)
|
||||||
elseif k=="end"then outputBox:scroll(1e99)
|
elseif key=="end"then outputBox:scroll(1e99)
|
||||||
elseif combKey[k]and kb.isDown("lctrl","rctrl")then
|
elseif combKey[key]and kb.isDown("lctrl","rctrl")then
|
||||||
combKey[k]()
|
combKey[key]()
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
if not WIDGET.isFocus(inputBox)then
|
if not WIDGET.isFocus(inputBox)then
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
else
|
else
|
||||||
@@ -935,7 +935,7 @@ function scene.keyDown(k)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not WIDGET.isFocus(inputBox)then WIDGET.focus(inputBox)end
|
if not WIDGET.isFocus(inputBox)then WIDGET.focus(inputBox)end
|
||||||
WIDGET.keyPressed(k)
|
WIDGET.keyPressed(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,6 @@ function scene.sceneInit()
|
|||||||
gc.setLineJoin('bevel')
|
gc.setLineJoin('bevel')
|
||||||
BGM.play('push')
|
BGM.play('push')
|
||||||
BG.set('none')
|
BG.set('none')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.touchDown(x)
|
function scene.touchDown(x)
|
||||||
@@ -102,7 +98,8 @@ function scene.touchUp(x)
|
|||||||
scene.keyDown("space")
|
scene.keyDown("space")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif play then
|
elseif play then
|
||||||
|
|||||||
@@ -34,13 +34,10 @@ function scene.sceneInit()
|
|||||||
state='menu'
|
state='menu'
|
||||||
BGM.play('hang out')
|
BGM.play('hang out')
|
||||||
BG.set('space')
|
BG.set('space')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="space"or key=="return"then
|
if key=="space"or key=="return"then
|
||||||
if state=='move'then
|
if state=='move'then
|
||||||
if floor>0 then
|
if floor>0 then
|
||||||
|
|||||||
@@ -108,10 +108,6 @@ function scene.sceneInit()
|
|||||||
reset()
|
reset()
|
||||||
BG.set('gray')
|
BG.set('gray')
|
||||||
BGM.play('way')
|
BGM.play('way')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function touch(n)
|
local function touch(n)
|
||||||
@@ -153,7 +149,8 @@ local function touch(n)
|
|||||||
SFX.play('clear_2')
|
SFX.play('clear_2')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="r"then reset()
|
if key=="r"then reset()
|
||||||
elseif key=="escape"then SCN.back()
|
elseif key=="escape"then SCN.back()
|
||||||
elseif state~=2 then
|
elseif state~=2 then
|
||||||
|
|||||||
@@ -38,16 +38,13 @@ function scene.sceneInit()
|
|||||||
end
|
end
|
||||||
BG.set('none')
|
BG.set('none')
|
||||||
BGM.play('dream')
|
BGM.play('dream')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key,isRep)
|
||||||
if k=="escape"then
|
if isRep then return end
|
||||||
|
if key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif k=="space"then
|
elseif key=="space"then
|
||||||
if state==0 then--main
|
if state==0 then--main
|
||||||
if timer==0 then
|
if timer==0 then
|
||||||
state=1
|
state=1
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ local function start()
|
|||||||
vx=rnd()>.5 and 6 or -6
|
vx=rnd()>.5 and 6 or -6
|
||||||
vy=rnd()*6-3
|
vy=rnd()*6-3
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="space"then
|
if key=="space"then
|
||||||
if state==0 then
|
if state==0 then
|
||||||
start()
|
start()
|
||||||
|
|||||||
@@ -17,13 +17,10 @@ end
|
|||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
reset()
|
reset()
|
||||||
BG.set('none')
|
BG.set('none')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if state==0 then
|
if state==0 then
|
||||||
if key=="space"then
|
if key=="space"then
|
||||||
reset()
|
reset()
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ end
|
|||||||
function scene.touchDown(x,y)
|
function scene.touchDown(x,y)
|
||||||
tapBoard(x,y)
|
tapBoard(x,y)
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="z"or key=="x"then
|
if key=="z"or key=="x"then
|
||||||
love.mousepressed(ms.getPosition())
|
love.mousepressed(ms.getPosition())
|
||||||
elseif key=="space"then
|
elseif key=="space"then
|
||||||
|
|||||||
@@ -14,13 +14,10 @@ function scene.sceneInit()
|
|||||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||||
BG.set('gray')
|
BG.set('gray')
|
||||||
BGM.play('push')
|
BGM.play('push')
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ local function merge()
|
|||||||
failPos=cy*10+cx
|
failPos=cy*10+cx
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="up"or key=="down"or key=="left"or key=="right"then
|
if key=="up"or key=="down"or key=="left"or key=="right"then
|
||||||
if state==2 then return end
|
if state==2 then return end
|
||||||
if not cx then
|
if not cx then
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ function scene.sceneBack()
|
|||||||
BGM.play()
|
BGM.play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="return"or key=="return2"then
|
if key=="return"or key=="return2"then
|
||||||
if CUSTOMENV.opponent~="X"then
|
if CUSTOMENV.opponent~="X"then
|
||||||
if CUSTOMENV.opponent:sub(1,2)=='CC'and CUSTOMENV.sequence=="fixed"then
|
if CUSTOMENV.opponent:sub(1,2)=='CC'and CUSTOMENV.sequence=="fixed"then
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ function scene.keyDown(key)
|
|||||||
else
|
else
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return
|
||||||
end
|
end
|
||||||
url=getList()[selected][5]
|
url=getList()[selected][5]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ local touchMoveLastFrame=false
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
if GAME.init then
|
if GAME.init then
|
||||||
resetGameData()
|
resetGameData()
|
||||||
GAME.init=false
|
GAME.init=false
|
||||||
@@ -17,7 +16,6 @@ function scene.sceneInit()
|
|||||||
noTouch=not SETTING.VKSwitch or noKey
|
noTouch=not SETTING.VKSwitch or noKey
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
destroyPlayers()
|
destroyPlayers()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,7 +66,8 @@ function scene.touchMove()
|
|||||||
::CONTINUE_nextKey::
|
::CONTINUE_nextKey::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
local k=keyMap.keyboard[key]
|
local k=keyMap.keyboard[key]
|
||||||
if k then
|
if k then
|
||||||
if k>0 then
|
if k>0 then
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ end
|
|||||||
function scene.wheelMoved(_,y)
|
function scene.wheelMoved(_,y)
|
||||||
WHEELMOV(y)
|
WHEELMOV(y)
|
||||||
end
|
end
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k=="up"then
|
if key=="up"then
|
||||||
WIDGET.active.texts:scroll(-5)
|
WIDGET.active.texts:scroll(-5)
|
||||||
elseif k=="down"then
|
elseif key=="down"then
|
||||||
WIDGET.active.texts:scroll(5)
|
WIDGET.active.texts:scroll(5)
|
||||||
elseif k=="pageup"then
|
elseif key=="pageup"then
|
||||||
WIDGET.active.texts:scroll(-20)
|
WIDGET.active.texts:scroll(-20)
|
||||||
elseif k=="pagedown"then
|
elseif key=="pagedown"then
|
||||||
WIDGET.active.texts:scroll(20)
|
WIDGET.active.texts:scroll(20)
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ end
|
|||||||
function scene.touchDown()
|
function scene.touchDown()
|
||||||
scene.mouseDown()
|
scene.mouseDown()
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
VOC.play('bye')
|
VOC.play('bye')
|
||||||
SCN.swapTo('quit','slowFade')
|
SCN.swapTo('quit','slowFade')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local gc,kb=love.graphics,love.keyboard
|
local gc=love.graphics
|
||||||
|
|
||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
@@ -212,13 +212,13 @@ function scene.sceneInit()
|
|||||||
shadePhase2=6.26*math.random()
|
shadePhase2=6.26*math.random()
|
||||||
skip=0--Skip time
|
skip=0--Skip time
|
||||||
light[6*3],light[26*3]=true,true
|
light[6*3],light[26*3]=true,true
|
||||||
kb.setKeyRepeat(false)
|
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
love.event.quit()
|
love.event.quit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif key=="s"then
|
elseif key=="s"then
|
||||||
@@ -252,7 +252,6 @@ function scene.update(dt)
|
|||||||
end
|
end
|
||||||
if openTime>=3.26 and not SCN.swapping then
|
if openTime>=3.26 and not SCN.swapping then
|
||||||
SCN.swapTo('intro')
|
SCN.swapTo('intro')
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ local function testButton(n)
|
|||||||
WIDGET.focus(scene.widgetList[n])
|
WIDGET.focus(scene.widgetList[n])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="1"then
|
if key=="1"then
|
||||||
if testButton(1)then
|
if testButton(1)then
|
||||||
SCN.go('mode')
|
SCN.go('mode')
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ end
|
|||||||
function scene.wheelMoved(_,y)
|
function scene.wheelMoved(_,y)
|
||||||
WHEELMOV(y)
|
WHEELMOV(y)
|
||||||
end
|
end
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k=="up"then
|
if key=="up"then
|
||||||
WIDGET.active.texts:scroll(-5)
|
WIDGET.active.texts:scroll(-5)
|
||||||
elseif k=="down"then
|
elseif key=="down"then
|
||||||
WIDGET.active.texts:scroll(5)
|
WIDGET.active.texts:scroll(5)
|
||||||
elseif k=="pageup"then
|
elseif key=="pageup"then
|
||||||
WIDGET.active.texts:scroll(-20)
|
WIDGET.active.texts:scroll(-20)
|
||||||
elseif k=="pagedown"then
|
elseif key=="pagedown"then
|
||||||
WIDGET.active.texts:scroll(20)
|
WIDGET.active.texts:scroll(20)
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ end
|
|||||||
function scene.touchClick(x,y)
|
function scene.touchClick(x,y)
|
||||||
scene.mouseClick(x,y)
|
scene.mouseClick(x,y)
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="return"then
|
if key=="return"then
|
||||||
if mapCam.sel then
|
if mapCam.sel then
|
||||||
mapCam.keyCtrl=false
|
mapCam.keyCtrl=false
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ end
|
|||||||
function scene.wheelMoved(_,y)
|
function scene.wheelMoved(_,y)
|
||||||
WHEELMOV(y)
|
WHEELMOV(y)
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
local S=selected
|
local S=selected
|
||||||
if key=="down"then
|
if key=="down"then
|
||||||
if S<#bgmList then
|
if S<#bgmList then
|
||||||
@@ -42,7 +42,8 @@ function scene.keyDown(key)
|
|||||||
selected=S-1
|
selected=S-1
|
||||||
SFX.play('move',.7)
|
SFX.play('move',.7)
|
||||||
end
|
end
|
||||||
elseif key=="return"or key=="space"then
|
elseif not isRep then
|
||||||
|
if key=="return"or key=="space"then
|
||||||
if BGM.nowPlay~=bgmList[S]then
|
if BGM.nowPlay~=bgmList[S]then
|
||||||
BGM.play(bgmList[S])
|
BGM.play(bgmList[S])
|
||||||
if SETTING.bgm>0 then SFX.play('click')end
|
if SETTING.bgm>0 then SFX.play('click')end
|
||||||
@@ -55,6 +56,7 @@ function scene.keyDown(key)
|
|||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
|
|||||||
@@ -73,9 +73,6 @@ function scene.sceneInit(org)
|
|||||||
NET.specSRID=false
|
NET.specSRID=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scene.mouseDown=NULL
|
scene.mouseDown=NULL
|
||||||
function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end
|
function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end
|
||||||
@@ -120,30 +117,26 @@ function scene.touchMove()
|
|||||||
::CONTINUE_nextKey::
|
::CONTINUE_nextKey::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
if not inputBox.hide then
|
if not inputBox.hide then
|
||||||
scene.keyDown("switchChat")
|
_switchChat()
|
||||||
else
|
else
|
||||||
_quit()
|
_quit()
|
||||||
end
|
end
|
||||||
elseif key=="return"then
|
elseif key=="return"then
|
||||||
local mes=STRING.trim(inputBox:getText())
|
local mes=STRING.trim(inputBox:getText())
|
||||||
if not inputBox.hide then
|
if not inputBox.hide and #mes>0 then
|
||||||
if #mes>0 then
|
|
||||||
NET.sendMessage(mes)
|
NET.sendMessage(mes)
|
||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
else
|
else
|
||||||
_switchChat()
|
_switchChat()
|
||||||
end
|
end
|
||||||
else
|
|
||||||
_switchChat()
|
|
||||||
end
|
|
||||||
elseif not inputBox.hide then
|
elseif not inputBox.hide then
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
inputBox:keypress(key)
|
inputBox:keypress(key)
|
||||||
elseif playing then
|
elseif playing then
|
||||||
if noKey then return end
|
if noKey or isRep then return end
|
||||||
local k=keyMap.keyboard[key]
|
local k=keyMap.keyboard[key]
|
||||||
if k and k>0 then
|
if k and k>0 then
|
||||||
PLAYERS[1]:pressKey(k)
|
PLAYERS[1]:pressKey(k)
|
||||||
@@ -214,7 +207,6 @@ function scene.socketRead(cmd,d)
|
|||||||
elseif cmd=='go'then
|
elseif cmd=='go'then
|
||||||
if not playing then
|
if not playing then
|
||||||
playing=true
|
playing=true
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
resetGameData('n',NET.seed)
|
resetGameData('n',NET.seed)
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ function scene.sceneBack()
|
|||||||
BGM.play()
|
BGM.play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k=="return"then
|
if key=="return"then
|
||||||
createRoom()
|
createRoom()
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(k)
|
WIDGET.keyPressed(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -36,29 +36,29 @@ end
|
|||||||
function scene.wheelMoved(_,y)
|
function scene.wheelMoved(_,y)
|
||||||
scrollPos=max(0,min(scrollPos-y,#NET.roomList-10))
|
scrollPos=max(0,min(scrollPos-y,#NET.roomList-10))
|
||||||
end
|
end
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key)
|
||||||
if k=="r"then
|
if key=="r"then
|
||||||
if fetchTimer<=7 then
|
if fetchTimer<=7 then
|
||||||
fetchRoom()
|
fetchRoom()
|
||||||
end
|
end
|
||||||
elseif k=="s"then
|
elseif key=="s"then
|
||||||
SCN.go('setting_game')
|
SCN.go('setting_game')
|
||||||
elseif k=="n"then
|
elseif key=="n"then
|
||||||
SCN.go('net_newRoom')
|
SCN.go('net_newRoom')
|
||||||
elseif k=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif #NET.roomList>0 then
|
elseif #NET.roomList>0 then
|
||||||
if k=="down"then
|
if key=="down"then
|
||||||
if selected<#NET.roomList then
|
if selected<#NET.roomList then
|
||||||
selected=selected+1
|
selected=selected+1
|
||||||
scrollPos=max(selected-10,min(scrollPos,selected-1))
|
scrollPos=max(selected-10,min(scrollPos,selected-1))
|
||||||
end
|
end
|
||||||
elseif k=="up"then
|
elseif key=="up"then
|
||||||
if selected>1 then
|
if selected>1 then
|
||||||
selected=selected-1
|
selected=selected-1
|
||||||
scrollPos=max(selected-10,min(scrollPos,selected-1))
|
scrollPos=max(selected-10,min(scrollPos,selected-1))
|
||||||
end
|
end
|
||||||
elseif k=="return"then
|
elseif key=="return"then
|
||||||
if NET.getlock('fetchRoom')or not NET.roomList[selected]then return end
|
if NET.getlock('fetchRoom')or not NET.roomList[selected]then return end
|
||||||
local R=NET.roomList[selected]
|
local R=NET.roomList[selected]
|
||||||
if R.roomInfo.version~=VERSION.short then MES.new('error',"Version doesn't match")return end
|
if R.roomInfo.version~=VERSION.short then MES.new('error',"Version doesn't match")return end
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ function scene.sceneInit(org)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||||
trySave()
|
trySave()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="q"then
|
if key=="q"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ local forbbidenKeys={
|
|||||||
["\\"]=true,
|
["\\"]=true,
|
||||||
["return"]=true,
|
["return"]=true,
|
||||||
}
|
}
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
if selected then
|
if selected then
|
||||||
for k,v in next,keyMap.keyboard do
|
for k,v in next,keyMap.keyboard do
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ end
|
|||||||
|
|
||||||
local blockName={'z','s','j','l','t','o','i'}
|
local blockName={'z','s','j','l','t','o','i'}
|
||||||
local lineCount={'single','double','triple','techrash'}
|
local lineCount={'single','double','triple','techrash'}
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
if key=="1"then
|
if key=="1"then
|
||||||
mini=not mini
|
mini=not mini
|
||||||
elseif key=="2"then
|
elseif key=="2"then
|
||||||
|
|||||||
@@ -33,13 +33,14 @@ function scene.touchDown(x,y)
|
|||||||
scene.mouseDown(x,y)
|
scene.mouseDown(x,y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(key,isRep)
|
||||||
if k=="escape"then
|
if isRep then return end
|
||||||
|
if key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
if k=="l"then
|
if key=="l"then
|
||||||
loadGame('sprintLock',true)
|
loadGame('sprintLock',true)
|
||||||
elseif k=="f"then
|
elseif key=="f"then
|
||||||
loadGame('sprintFix',true)
|
loadGame('sprintFix',true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ function scene.sceneInit()
|
|||||||
backCounter=5
|
backCounter=5
|
||||||
list={}
|
list={}
|
||||||
timer=0
|
timer=0
|
||||||
love.keyboard.setKeyRepeat(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
function scene.sceneBack()
|
|
||||||
list={}
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.gamepadDown(key)
|
function scene.gamepadDown(key)
|
||||||
@@ -28,7 +22,8 @@ end
|
|||||||
function scene.gamepadUp(key)
|
function scene.gamepadUp(key)
|
||||||
push{COLOR.H,"[gamepadUp] <"..key..">"}
|
push{COLOR.H,"[gamepadUp] <"..key..">"}
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return end
|
||||||
push("[keyDown] <"..key..">")
|
push("[keyDown] <"..key..">")
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
backCounter=backCounter-1
|
backCounter=backCounter-1
|
||||||
|
|||||||
Reference in New Issue
Block a user