允许用键盘编辑序列
This commit is contained in:
@@ -24,7 +24,7 @@ local gc,sys=love.graphics,love.system
|
||||
local Timer=love.timer.getTime
|
||||
local int,rnd,max,min=math.floor,math.random,math.max,math.min
|
||||
local abs=math.abs
|
||||
local rem=table.remove
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local scr=scr
|
||||
local xOy=love.math.newTransform()
|
||||
@@ -314,6 +314,8 @@ function keyDown.custom(key)
|
||||
elseif sel==13 then
|
||||
BGM.play(customRange.bgm[customSel[sel]])
|
||||
end
|
||||
elseif key=="q"then
|
||||
SCN.goto("sequence")
|
||||
elseif #key==1 then
|
||||
local T=tonumber(key)
|
||||
if T and T>=1 and T<=5 then
|
||||
@@ -328,8 +330,30 @@ function keyDown.custom(key)
|
||||
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)
|
||||
local s=sceneTemp
|
||||
if type(key)=="number"then
|
||||
local C=s.cur+1
|
||||
ins(preBag,C,key)
|
||||
s.cur=C
|
||||
elseif #key==1 then
|
||||
local i=(kb.isDown("lctrl","lshift","lalt","rctrl","rshift","ralt")and minoKey2 or minoKey)[key]
|
||||
if i then
|
||||
local C=s.cur+1
|
||||
ins(preBag,C,i)
|
||||
s.cur=C
|
||||
end
|
||||
else
|
||||
if key=="left"then
|
||||
if s.cur>0 then s.cur=s.cur-1 end
|
||||
elseif key=="right"then
|
||||
@@ -340,15 +364,18 @@ function keyDown.sequence(key)
|
||||
rem(preBag,C)
|
||||
s.cur=C-1
|
||||
end
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
elseif key=="delete"then
|
||||
if sceneTemp.sure>20 then
|
||||
preBag={1,2,3,4,5,6,7}
|
||||
preBag={}
|
||||
sceneTemp.cur=7
|
||||
sceneTemp.sure=0
|
||||
else
|
||||
sceneTemp.sure=50
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mouseDown.draw(x,y,k)
|
||||
|
||||
@@ -210,7 +210,7 @@ local langList={
|
||||
set3="无尽(3)",
|
||||
set4="隐形(4)",
|
||||
set5="极限(5)",
|
||||
seq="高级设置",
|
||||
seq="高级设置(q)",
|
||||
draw="初始场地编辑",
|
||||
back="返回",
|
||||
},
|
||||
@@ -648,7 +648,7 @@ local langList={
|
||||
set3="无尽(3)",
|
||||
set4="隐形(4)",
|
||||
set5="极限(5)",
|
||||
seq="高级设置",
|
||||
seq="高级设置(q)",
|
||||
draw="初始场地编辑",
|
||||
back="返回",
|
||||
},
|
||||
@@ -1075,7 +1075,7 @@ local langList={
|
||||
set3="Inf. (3)",
|
||||
set4="Blind (4)",
|
||||
set5="Master (5)",
|
||||
seq="Advanced",
|
||||
seq="Advanced(q)",
|
||||
draw="Field Edit",
|
||||
back="Back",
|
||||
},
|
||||
@@ -1502,7 +1502,7 @@ local langList={
|
||||
set3="Inf. (3)",
|
||||
set4="Blind (4)",
|
||||
set5="Master (5)",
|
||||
seq="Advanced",
|
||||
seq="Advanced(q)",
|
||||
draw="Field Edit",
|
||||
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 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 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
|
||||
|
||||
|
||||
@@ -127,37 +126,37 @@ local Widgets={
|
||||
set4= newButton(940, 560,260,70, C.lightYellow, 32,pressKey("4")),
|
||||
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),
|
||||
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
||||
},
|
||||
sequence={
|
||||
Z= newButton(150, 440,90, 90,C.white, 50,SEQpush(1)),
|
||||
S= newButton(250, 440,90, 90,C.white, 50,SEQpush(2)),
|
||||
J= newButton(350, 440,90, 90,C.white, 50,SEQpush(3)),
|
||||
L= newButton(450, 440,90, 90,C.white, 50,SEQpush(4)),
|
||||
T= newButton(550, 440,90, 90,C.white, 50,SEQpush(5)),
|
||||
O= newButton(650, 440,90, 90,C.white, 50,SEQpush(6)),
|
||||
I= newButton(750, 440,90, 90,C.white, 50,SEQpush(7)),
|
||||
Z= newButton(150, 440,90, 90,C.white, 50,pressKey(1)),
|
||||
S= newButton(250, 440,90, 90,C.white, 50,pressKey(2)),
|
||||
J= newButton(350, 440,90, 90,C.white, 50,pressKey(3)),
|
||||
L= newButton(450, 440,90, 90,C.white, 50,pressKey(4)),
|
||||
T= newButton(550, 440,90, 90,C.white, 50,pressKey(5)),
|
||||
O= newButton(650, 440,90, 90,C.white, 50,pressKey(6)),
|
||||
I= newButton(750, 440,90, 90,C.white, 50,pressKey(7)),
|
||||
|
||||
Z5= newButton(150, 540,90, 90,C.white, 50,SEQpush(8)),
|
||||
S5= newButton(250, 540,90, 90,C.white, 50,SEQpush(9)),
|
||||
P= newButton(350, 540,90, 90,C.white, 50,SEQpush(10)),
|
||||
Q= newButton(450, 540,90, 90,C.white, 50,SEQpush(11)),
|
||||
F= newButton(550, 540,90, 90,C.white, 50,SEQpush(12)),
|
||||
E= newButton(650, 540,90, 90,C.white, 50,SEQpush(13)),
|
||||
T5= newButton(750, 540,90, 90,C.white, 50,SEQpush(14)),
|
||||
U= newButton(850, 540,90, 90,C.white, 50,SEQpush(15)),
|
||||
V= newButton(950, 540,90, 90,C.white, 50,SEQpush(16)),
|
||||
W= newButton(150, 640,90, 90,C.white, 50,SEQpush(17)),
|
||||
X= newButton(250, 640,90, 90,C.white, 50,SEQpush(18)),
|
||||
J5= newButton(350, 640,90, 90,C.white, 50,SEQpush(19)),
|
||||
L5= newButton(450, 640,90, 90,C.white, 50,SEQpush(20)),
|
||||
R= newButton(550, 640,90, 90,C.white, 50,SEQpush(21)),
|
||||
Y= newButton(650, 640,90, 90,C.white, 50,SEQpush(22)),
|
||||
N= newButton(750, 640,90, 90,C.white, 50,SEQpush(23)),
|
||||
H= newButton(850, 640,90, 90,C.white, 50,SEQpush(24)),
|
||||
I5= newButton(950, 640,90, 90,C.white, 50,SEQpush(25)),
|
||||
Z5= newButton(150, 540,90, 90,C.white, 50,pressKey(8)),
|
||||
S5= newButton(250, 540,90, 90,C.white, 50,pressKey(9)),
|
||||
P= newButton(350, 540,90, 90,C.white, 50,pressKey(10)),
|
||||
Q= newButton(450, 540,90, 90,C.white, 50,pressKey(11)),
|
||||
F= newButton(550, 540,90, 90,C.white, 50,pressKey(12)),
|
||||
E= newButton(650, 540,90, 90,C.white, 50,pressKey(13)),
|
||||
T5= newButton(750, 540,90, 90,C.white, 50,pressKey(14)),
|
||||
U= newButton(850, 540,90, 90,C.white, 50,pressKey(15)),
|
||||
V= newButton(950, 540,90, 90,C.white, 50,pressKey(16)),
|
||||
W= newButton(150, 640,90, 90,C.white, 50,pressKey(17)),
|
||||
X= newButton(250, 640,90, 90,C.white, 50,pressKey(18)),
|
||||
J5= newButton(350, 640,90, 90,C.white, 50,pressKey(19)),
|
||||
L5= newButton(450, 640,90, 90,C.white, 50,pressKey(20)),
|
||||
R= newButton(550, 640,90, 90,C.white, 50,pressKey(21)),
|
||||
Y= newButton(650, 640,90, 90,C.white, 50,pressKey(22)),
|
||||
N= newButton(750, 640,90, 90,C.white, 50,pressKey(23)),
|
||||
H= newButton(850, 640,90, 90,C.white, 50,pressKey(24)),
|
||||
I5= newButton(950, 640,90, 90,C.white, 50,pressKey(25)),
|
||||
|
||||
left= newButton(850, 440,90, 90,C.lightGreen, 55,pressKey("left")),
|
||||
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)),
|
||||
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),
|
||||
copy= newButton(920, 640,120,120,C.lightRed, 35,copyBoard),
|
||||
paste= newButton(1060, 640,120,120,C.lightBlue, 35,pasteBoard),
|
||||
copy= newButton(920, 640,120,120,C.lightRed, 35,function()copyBoard()end),
|
||||
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),
|
||||
back= newButton(1200, 640,120,120,C.white, 35,BACK),
|
||||
},
|
||||
|
||||
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}
|
||||
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}
|
||||
--blockSkin,blockSkinMini={},{}--redefined in SKIN.change
|
||||
|
||||
@@ -12,7 +12,7 @@ return{
|
||||
end
|
||||
modeEnv._20G=modeEnv.drop==0
|
||||
modeEnv.oncehold=customSel[6]==1
|
||||
modeEnv.bag=preBag
|
||||
if preBag[1]then modeEnv.bag=preBag end
|
||||
PLY.newPlayer(1,340,15)
|
||||
local L=modeEnv.opponent
|
||||
if L~=0 then
|
||||
|
||||
@@ -31,7 +31,7 @@ return{
|
||||
end
|
||||
modeEnv._20G=modeEnv.drop==0
|
||||
modeEnv.oncehold=customSel[6]==1
|
||||
modeEnv.bag=preBag
|
||||
if preBag[1]then modeEnv.bag=preBag end
|
||||
modeEnv.target=0
|
||||
PLY.newPlayer(1,340,15)
|
||||
local L=modeEnv.opponent
|
||||
|
||||
Reference in New Issue
Block a user