允许用键盘编辑序列
This commit is contained in:
@@ -24,7 +24,7 @@ local gc,sys=love.graphics,love.system
|
|||||||
local Timer=love.timer.getTime
|
local Timer=love.timer.getTime
|
||||||
local int,rnd,max,min=math.floor,math.random,math.max,math.min
|
local int,rnd,max,min=math.floor,math.random,math.max,math.min
|
||||||
local abs=math.abs
|
local abs=math.abs
|
||||||
local rem=table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
|
|
||||||
local scr=scr
|
local scr=scr
|
||||||
local xOy=love.math.newTransform()
|
local xOy=love.math.newTransform()
|
||||||
@@ -314,6 +314,8 @@ function keyDown.custom(key)
|
|||||||
elseif sel==13 then
|
elseif sel==13 then
|
||||||
BGM.play(customRange.bgm[customSel[sel]])
|
BGM.play(customRange.bgm[customSel[sel]])
|
||||||
end
|
end
|
||||||
|
elseif key=="q"then
|
||||||
|
SCN.goto("sequence")
|
||||||
elseif #key==1 then
|
elseif #key==1 then
|
||||||
local T=tonumber(key)
|
local T=tonumber(key)
|
||||||
if T and T>=1 and T<=5 then
|
if T and T>=1 and T<=5 then
|
||||||
@@ -328,25 +330,50 @@ function keyDown.custom(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local minoKey={
|
||||||
|
["1"]=1,["2"]=2,["3"]=3,["4"]=4,["5"]=5,["6"]=6,["7"]=7,
|
||||||
|
z=1,s=2,j=3,l=4,t=5,o=6,i=7,
|
||||||
|
p=10,q=11,f=12,e=13,u=15,
|
||||||
|
v=16,w=17,x=18,r=21,y=22,n=23,h=24,
|
||||||
|
}
|
||||||
|
local minoKey2={
|
||||||
|
["1"]=8,["2"]=9,["3"]=19,["4"]=20,["5"]=14,["7"]=25,
|
||||||
|
z=8,s=9,t=14,j=19,l=20,i=25
|
||||||
|
}
|
||||||
function keyDown.sequence(key)
|
function keyDown.sequence(key)
|
||||||
local s=sceneTemp
|
local s=sceneTemp
|
||||||
if key=="left"then
|
if type(key)=="number"then
|
||||||
if s.cur>0 then s.cur=s.cur-1 end
|
local C=s.cur+1
|
||||||
elseif key=="right"then
|
ins(preBag,C,key)
|
||||||
if s.cur<#preBag then s.cur=s.cur+1 end
|
s.cur=C
|
||||||
elseif key=="backspace"then
|
elseif #key==1 then
|
||||||
local C=s.cur
|
local i=(kb.isDown("lctrl","lshift","lalt","rctrl","rshift","ralt")and minoKey2 or minoKey)[key]
|
||||||
if C>0 then
|
if i then
|
||||||
rem(preBag,C)
|
local C=s.cur+1
|
||||||
s.cur=C-1
|
ins(preBag,C,i)
|
||||||
|
s.cur=C
|
||||||
end
|
end
|
||||||
elseif key=="delete"then
|
else
|
||||||
if sceneTemp.sure>20 then
|
if key=="left"then
|
||||||
preBag={1,2,3,4,5,6,7}
|
if s.cur>0 then s.cur=s.cur-1 end
|
||||||
sceneTemp.cur=7
|
elseif key=="right"then
|
||||||
sceneTemp.sure=0
|
if s.cur<#preBag then s.cur=s.cur+1 end
|
||||||
else
|
elseif key=="backspace"then
|
||||||
sceneTemp.sure=50
|
local C=s.cur
|
||||||
|
if C>0 then
|
||||||
|
rem(preBag,C)
|
||||||
|
s.cur=C-1
|
||||||
|
end
|
||||||
|
elseif key=="escape"then
|
||||||
|
SCN.back()
|
||||||
|
elseif key=="delete"then
|
||||||
|
if sceneTemp.sure>20 then
|
||||||
|
preBag={}
|
||||||
|
sceneTemp.cur=7
|
||||||
|
sceneTemp.sure=0
|
||||||
|
else
|
||||||
|
sceneTemp.sure=50
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ local langList={
|
|||||||
set3="无尽(3)",
|
set3="无尽(3)",
|
||||||
set4="隐形(4)",
|
set4="隐形(4)",
|
||||||
set5="极限(5)",
|
set5="极限(5)",
|
||||||
seq="高级设置",
|
seq="高级设置(q)",
|
||||||
draw="初始场地编辑",
|
draw="初始场地编辑",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
@@ -648,7 +648,7 @@ local langList={
|
|||||||
set3="无尽(3)",
|
set3="无尽(3)",
|
||||||
set4="隐形(4)",
|
set4="隐形(4)",
|
||||||
set5="极限(5)",
|
set5="极限(5)",
|
||||||
seq="高级设置",
|
seq="高级设置(q)",
|
||||||
draw="初始场地编辑",
|
draw="初始场地编辑",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
@@ -1075,7 +1075,7 @@ local langList={
|
|||||||
set3="Inf. (3)",
|
set3="Inf. (3)",
|
||||||
set4="Blind (4)",
|
set4="Blind (4)",
|
||||||
set5="Master (5)",
|
set5="Master (5)",
|
||||||
seq="Advanced",
|
seq="Advanced(q)",
|
||||||
draw="Field Edit",
|
draw="Field Edit",
|
||||||
back="Back",
|
back="Back",
|
||||||
},
|
},
|
||||||
@@ -1502,7 +1502,7 @@ local langList={
|
|||||||
set3="Inf. (3)",
|
set3="Inf. (3)",
|
||||||
set4="Blind (4)",
|
set4="Blind (4)",
|
||||||
set5="Master (5)",
|
set5="Master (5)",
|
||||||
seq="Advanced",
|
seq="Advanced(q)",
|
||||||
draw="Field Edit",
|
draw="Field Edit",
|
||||||
back="X",
|
back="X",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ local function nextDir(n) return function()SKIN.rotate(n) end end
|
|||||||
local function VKAdisp(n) return function()return VK_org[n].ava end end
|
local function VKAdisp(n) return function()return VK_org[n].ava end end
|
||||||
local function VKAcode(n) return function()VK_org[n].ava=not VK_org[n].ava end end
|
local function VKAcode(n) return function()VK_org[n].ava=not VK_org[n].ava end end
|
||||||
local function setLang(n) return function()LANG.set(n)setting.lang=n end end
|
local function setLang(n) return function()LANG.set(n)setting.lang=n end end
|
||||||
local function SEQpush(n) return function()local C=sceneTemp.cur+1 ins(preBag,C,n)sceneTemp.cur=C end end
|
|
||||||
local newButton,newSwitch,newSlider=WIDGET.new.button,WIDGET.new.switch,WIDGET.new.slider
|
local newButton,newSwitch,newSlider=WIDGET.new.button,WIDGET.new.switch,WIDGET.new.slider
|
||||||
|
|
||||||
|
|
||||||
@@ -127,37 +126,37 @@ local Widgets={
|
|||||||
set4= newButton(940, 560,260,70, C.lightYellow, 32,pressKey("4")),
|
set4= newButton(940, 560,260,70, C.lightYellow, 32,pressKey("4")),
|
||||||
set5= newButton(940, 640,260,70, C.lightYellow, 32,pressKey("5")),
|
set5= newButton(940, 640,260,70, C.lightYellow, 32,pressKey("5")),
|
||||||
|
|
||||||
seq= newButton(665, 415,162,40, C.lightGreen, 32,function()SCN.goto("sequence")end),
|
seq= newButton(665, 415,200,40, C.lightGreen, 30,function()SCN.goto("sequence")end),
|
||||||
draw= newButton(150, 80, 220,80, C.white, 35,function()SCN.swapTo("draw")end),
|
draw= newButton(150, 80, 220,80, C.white, 35,function()SCN.swapTo("draw")end),
|
||||||
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
||||||
},
|
},
|
||||||
sequence={
|
sequence={
|
||||||
Z= newButton(150, 440,90, 90,C.white, 50,SEQpush(1)),
|
Z= newButton(150, 440,90, 90,C.white, 50,pressKey(1)),
|
||||||
S= newButton(250, 440,90, 90,C.white, 50,SEQpush(2)),
|
S= newButton(250, 440,90, 90,C.white, 50,pressKey(2)),
|
||||||
J= newButton(350, 440,90, 90,C.white, 50,SEQpush(3)),
|
J= newButton(350, 440,90, 90,C.white, 50,pressKey(3)),
|
||||||
L= newButton(450, 440,90, 90,C.white, 50,SEQpush(4)),
|
L= newButton(450, 440,90, 90,C.white, 50,pressKey(4)),
|
||||||
T= newButton(550, 440,90, 90,C.white, 50,SEQpush(5)),
|
T= newButton(550, 440,90, 90,C.white, 50,pressKey(5)),
|
||||||
O= newButton(650, 440,90, 90,C.white, 50,SEQpush(6)),
|
O= newButton(650, 440,90, 90,C.white, 50,pressKey(6)),
|
||||||
I= newButton(750, 440,90, 90,C.white, 50,SEQpush(7)),
|
I= newButton(750, 440,90, 90,C.white, 50,pressKey(7)),
|
||||||
|
|
||||||
Z5= newButton(150, 540,90, 90,C.white, 50,SEQpush(8)),
|
Z5= newButton(150, 540,90, 90,C.white, 50,pressKey(8)),
|
||||||
S5= newButton(250, 540,90, 90,C.white, 50,SEQpush(9)),
|
S5= newButton(250, 540,90, 90,C.white, 50,pressKey(9)),
|
||||||
P= newButton(350, 540,90, 90,C.white, 50,SEQpush(10)),
|
P= newButton(350, 540,90, 90,C.white, 50,pressKey(10)),
|
||||||
Q= newButton(450, 540,90, 90,C.white, 50,SEQpush(11)),
|
Q= newButton(450, 540,90, 90,C.white, 50,pressKey(11)),
|
||||||
F= newButton(550, 540,90, 90,C.white, 50,SEQpush(12)),
|
F= newButton(550, 540,90, 90,C.white, 50,pressKey(12)),
|
||||||
E= newButton(650, 540,90, 90,C.white, 50,SEQpush(13)),
|
E= newButton(650, 540,90, 90,C.white, 50,pressKey(13)),
|
||||||
T5= newButton(750, 540,90, 90,C.white, 50,SEQpush(14)),
|
T5= newButton(750, 540,90, 90,C.white, 50,pressKey(14)),
|
||||||
U= newButton(850, 540,90, 90,C.white, 50,SEQpush(15)),
|
U= newButton(850, 540,90, 90,C.white, 50,pressKey(15)),
|
||||||
V= newButton(950, 540,90, 90,C.white, 50,SEQpush(16)),
|
V= newButton(950, 540,90, 90,C.white, 50,pressKey(16)),
|
||||||
W= newButton(150, 640,90, 90,C.white, 50,SEQpush(17)),
|
W= newButton(150, 640,90, 90,C.white, 50,pressKey(17)),
|
||||||
X= newButton(250, 640,90, 90,C.white, 50,SEQpush(18)),
|
X= newButton(250, 640,90, 90,C.white, 50,pressKey(18)),
|
||||||
J5= newButton(350, 640,90, 90,C.white, 50,SEQpush(19)),
|
J5= newButton(350, 640,90, 90,C.white, 50,pressKey(19)),
|
||||||
L5= newButton(450, 640,90, 90,C.white, 50,SEQpush(20)),
|
L5= newButton(450, 640,90, 90,C.white, 50,pressKey(20)),
|
||||||
R= newButton(550, 640,90, 90,C.white, 50,SEQpush(21)),
|
R= newButton(550, 640,90, 90,C.white, 50,pressKey(21)),
|
||||||
Y= newButton(650, 640,90, 90,C.white, 50,SEQpush(22)),
|
Y= newButton(650, 640,90, 90,C.white, 50,pressKey(22)),
|
||||||
N= newButton(750, 640,90, 90,C.white, 50,SEQpush(23)),
|
N= newButton(750, 640,90, 90,C.white, 50,pressKey(23)),
|
||||||
H= newButton(850, 640,90, 90,C.white, 50,SEQpush(24)),
|
H= newButton(850, 640,90, 90,C.white, 50,pressKey(24)),
|
||||||
I5= newButton(950, 640,90, 90,C.white, 50,SEQpush(25)),
|
I5= newButton(950, 640,90, 90,C.white, 50,pressKey(25)),
|
||||||
|
|
||||||
left= newButton(850, 440,90, 90,C.lightGreen, 55,pressKey("left")),
|
left= newButton(850, 440,90, 90,C.lightGreen, 55,pressKey("left")),
|
||||||
right= newButton(950, 440,90, 90,C.lightGreen, 55,pressKey("right")),
|
right= newButton(950, 440,90, 90,C.lightGreen, 55,pressKey("right")),
|
||||||
@@ -189,8 +188,8 @@ local Widgets={
|
|||||||
space= newButton(730, 360,120,120,C.grey, 65,setPen(-1)),
|
space= newButton(730, 360,120,120,C.grey, 65,setPen(-1)),
|
||||||
clear= newButton(1200, 500,120,120,C.white, 40,pressKey("delete")),
|
clear= newButton(1200, 500,120,120,C.white, 40,pressKey("delete")),
|
||||||
demo= newSwitch(755, 640,30,function()return sceneTemp.demo end,function()sceneTemp.demo=not sceneTemp.demo end),
|
demo= newSwitch(755, 640,30,function()return sceneTemp.demo end,function()sceneTemp.demo=not sceneTemp.demo end),
|
||||||
copy= newButton(920, 640,120,120,C.lightRed, 35,copyBoard),
|
copy= newButton(920, 640,120,120,C.lightRed, 35,function()copyBoard()end),
|
||||||
paste= newButton(1060, 640,120,120,C.lightBlue, 35,pasteBoard),
|
paste= newButton(1060, 640,120,120,C.lightBlue, 35,function()pasteBoard()end),
|
||||||
custom= newButton(110, 80, 140,80, C.white, 35,function()SCN.goto("custom")end),
|
custom= newButton(110, 80, 140,80, C.white, 35,function()SCN.goto("custom")end),
|
||||||
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
||||||
},
|
},
|
||||||
@@ -211,20 +210,20 @@ local Widgets={
|
|||||||
quit= newButton(640,600,240,100,C.white,35,BACK),
|
quit= newButton(640,600,240,100,C.white,35,BACK),
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
graphic=newButton(200,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_video")end, nil,"sound"),
|
graphic=newButton(200,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_video")end, nil,"sound"),
|
||||||
sound= newButton(1080,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_sound")end, nil,"ctrl"),
|
sound= newButton(1080,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_sound")end, nil,"ctrl"),
|
||||||
ctrl= newButton(290,220,320,80,C.lightYellow,35,function()SCN.goto("setting_control")end, nil,"key"),
|
ctrl= newButton(290,220,320,80,C.lightYellow,35,function()SCN.goto("setting_control")end, nil,"key"),
|
||||||
key= newButton(640,220,320,80,C.lightGreen,35,function()SCN.goto("setting_key")end, nil,"touch"),
|
key= newButton(640,220,320,80,C.lightGreen,35,function()SCN.goto("setting_key")end, nil,"touch"),
|
||||||
touch= newButton(990,220,320,80,C.lightBlue,35,function()SCN.goto("setting_touch")end, nil,"reTime"),
|
touch= newButton(990,220,320,80,C.lightBlue,35,function()SCN.goto("setting_touch")end, nil,"reTime"),
|
||||||
reTime= newSlider(350,340,300,10,30,nil, SETval("reTime"), SETsto("reTime"), nil,"maxNext"),
|
reTime= newSlider(350,340,300,10,30,nil, SETval("reTime"), SETsto("reTime"), nil,"maxNext"),
|
||||||
maxNext=newSlider(350,440,300,6,30,nil, SETval("maxNext"), SETsto("maxNext"), nil,"autoPause"),
|
maxNext=newSlider(350,440,300,6,30,nil, SETval("maxNext"), SETsto("maxNext"), nil,"autoPause"),
|
||||||
autoPause=newSwitch(350,540,20, SETval("autoPause"), SETrev("autoPause"), nil,"layout"),
|
autoPause=newSwitch(350,540,20, SETval("autoPause"), SETrev("autoPause"), nil,"layout"),
|
||||||
layout= newButton(590,540,140,70,C.white,35,function()
|
layout= newButton(590,540,140,70,C.white,35,function()
|
||||||
SCN.goto("setting_skin")
|
SCN.goto("setting_skin")
|
||||||
end,nil,"quickR"),
|
end,nil,"quickR"),
|
||||||
quickR= newSwitch(1050,340,35, SETval("quickR"), SETrev("quickR"), nil,"swap"),
|
quickR= newSwitch(1050,340,35, SETval("quickR"), SETrev("quickR"), nil,"swap"),
|
||||||
swap= newSwitch(1050,440,19, SETval("swap"), SETrev("swap"), nil,"fine"),
|
swap= newSwitch(1050,440,19, SETval("swap"), SETrev("swap"), nil,"fine"),
|
||||||
fine= newSwitch(1050,540,20, SETval("fine"), SETrev("fine"), nil,"back"),
|
fine= newSwitch(1050,540,20, SETval("fine"), SETrev("fine"), nil,"back"),
|
||||||
back= newButton(1140,650,200,80,C.white,40,BACK, nil,"graphic"),
|
back= newButton(1140,650,200,80,C.white,40,BACK, nil,"graphic"),
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -261,10 +260,10 @@ local Widgets={
|
|||||||
setting_sound={
|
setting_sound={
|
||||||
game= newButton(200,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_game")end, nil,"graphic"),
|
game= newButton(200,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_game")end, nil,"graphic"),
|
||||||
graphic=newButton(1080,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_video")end, nil,"sfx"),
|
graphic=newButton(1080,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_video")end, nil,"sfx"),
|
||||||
sfx= newSlider(180,250,400,10,35,function()SFX.play("blip_1")end, SETval("sfx"), SETsto("sfx"), nil,"bgm"),
|
sfx= newSlider(180,250,400,10,35,function()SFX.play("blip_1")end, SETval("sfx"), SETsto("sfx"), nil,"bgm"),
|
||||||
bgm= newSlider(750,250,400,10,35,function()BGM.freshVolume()end, SETval("bgm"), SETsto("bgm"), nil,"vib"),
|
bgm= newSlider(750,250,400,10,35,function()BGM.freshVolume()end, SETval("bgm"), SETsto("bgm"), nil,"vib"),
|
||||||
vib= newSlider(180,440,400,5 ,28,function()VIB(2)end, SETval("vib"), SETsto("vib"), nil,"voc"),
|
vib= newSlider(180,440,400,5 ,28,function()VIB(2)end, SETval("vib"), SETsto("vib"), nil,"voc"),
|
||||||
voc= newSlider(750,440,400,10,32,function()VOC.play("nya")end, SETval("voc"), SETsto("voc"), nil,"stereo"),
|
voc= newSlider(750,440,400,10,32,function()VOC.play("nya")end, SETval("voc"), SETsto("voc"), nil,"stereo"),
|
||||||
stereo= newSlider(180,630,400,10,35,function()SFX.play("move",1,-1)SFX.play("lock",1,1)end, SETval("stereo"), SETsto("stereo"),function()return setting.sfx==0 end,"back"),
|
stereo= newSlider(180,630,400,10,35,function()SFX.play("move",1,-1)SFX.play("lock",1,1)end, SETval("stereo"), SETsto("stereo"),function()return setting.sfx==0 end,"back"),
|
||||||
back= newButton(1140,650,200,80,C.white,40,BACK,nil,"game"),
|
back= newButton(1140,650,200,80,C.white,40,BACK,nil,"game"),
|
||||||
},
|
},
|
||||||
|
|||||||
2
main.lua
2
main.lua
@@ -29,7 +29,7 @@ scr={x=0,y=0,w=0,h=0,rad=0,k=1}--wid,hei,radius,scale K
|
|||||||
|
|
||||||
customSel={1,22,1,1,7,3,1,1,8,4,1,1,1}
|
customSel={1,22,1,1,7,3,1,1,8,4,1,1,1}
|
||||||
preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
|
preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
|
||||||
preBag={1,2,3,4,5,6,7}
|
preBag={}
|
||||||
|
|
||||||
players={alive={},human=0}
|
players={alive={},human=0}
|
||||||
--blockSkin,blockSkinMini={},{}--redefined in SKIN.change
|
--blockSkin,blockSkinMini={},{}--redefined in SKIN.change
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return{
|
|||||||
end
|
end
|
||||||
modeEnv._20G=modeEnv.drop==0
|
modeEnv._20G=modeEnv.drop==0
|
||||||
modeEnv.oncehold=customSel[6]==1
|
modeEnv.oncehold=customSel[6]==1
|
||||||
modeEnv.bag=preBag
|
if preBag[1]then modeEnv.bag=preBag end
|
||||||
PLY.newPlayer(1,340,15)
|
PLY.newPlayer(1,340,15)
|
||||||
local L=modeEnv.opponent
|
local L=modeEnv.opponent
|
||||||
if L~=0 then
|
if L~=0 then
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ return{
|
|||||||
end
|
end
|
||||||
modeEnv._20G=modeEnv.drop==0
|
modeEnv._20G=modeEnv.drop==0
|
||||||
modeEnv.oncehold=customSel[6]==1
|
modeEnv.oncehold=customSel[6]==1
|
||||||
modeEnv.bag=preBag
|
if preBag[1]then modeEnv.bag=preBag end
|
||||||
modeEnv.target=0
|
modeEnv.target=0
|
||||||
PLY.newPlayer(1,340,15)
|
PLY.newPlayer(1,340,15)
|
||||||
local L=modeEnv.opponent
|
local L=modeEnv.opponent
|
||||||
|
|||||||
Reference in New Issue
Block a user