优化15p体验,新增滑动操作开关和键盘反向

This commit is contained in:
MrZ626
2020-09-02 18:21:29 +08:00
parent b4258d0759
commit f2520fdbc2
3 changed files with 51 additions and 19 deletions

View File

@@ -378,7 +378,9 @@ local langList={
p15={ p15={
reset="打乱", reset="打乱",
color="颜色", color="颜色",
hide="", blind="",
slide="滑动操作",
revKB="键盘反向",
back="返回", back="返回",
}, },
help={ help={
@@ -859,7 +861,9 @@ local langList={
p15={ p15={
reset="打乱", reset="打乱",
color="颜色", color="颜色",
hide="", blind="",
slide="滑动操作",
revKB="键盘反向",
back="返回", back="返回",
}, },
help={ help={
@@ -1330,7 +1334,9 @@ local langList={
p15={ p15={
reset="Shuffle", reset="Shuffle",
color="Color", color="Color",
hide="Blind", blind="Blind",
slide="Slide",
revKB="Reverse",
back="Back", back="Back",
}, },
help={ help={
@@ -1799,7 +1805,9 @@ local langList={
p15={ p15={
reset="!@#$%", reset="!@#$%",
color="~~~", color="~~~",
hide="???", blind="???",
slide="~_~",
revKB="Reverse",
back="X", back="X",
}, },
help={ help={
@@ -2282,7 +2290,9 @@ local langList={
p15={ p15={
reset="打乱", reset="打乱",
color="", color="",
hide="", blind="",
slide="滑动",
revKB="键盘反向",
back="返回", back="返回",
}, },
help={ help={

View File

@@ -468,8 +468,10 @@ local Widgets={
}, },
p15={ p15={
newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen", font=40,code=pressKey("space")}), newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen", font=40,code=pressKey("space")}),
newSlider({name="color", x=110,y=240,w=170,unit=4,show=false, font=30,disp=function()return sceneTemp.color end,code=function(v)sceneTemp.color=v end,hide=function()return sceneTemp.state<2 end}), newSlider({name="color", x=110,y=250,w=170,unit=4,show=false, font=30,disp=function()return sceneTemp.color end,code=function(v)sceneTemp.color=v end,hide=function()return sceneTemp.state<2 end}),
newSwitch({name="hide", x=200,y=340,w=60, font=40,disp=function()return sceneTemp.blind end,code=pressKey("h"),hide=function()return sceneTemp.state>0 end}), newSwitch({name="blind", x=200,y=350,w=60, font=40,disp=function()return sceneTemp.blind end,code=pressKey("b"),hide=function()return sceneTemp.state>0 end}),
newSwitch({name="slide", x=200,y=450,w=60, font=40,disp=function()return sceneTemp.slide end,code=pressKey("s"),hide=function()return sceneTemp.state>0 end}),
newSwitch({name="revKB", x=200,y=550,w=60, font=40,disp=function()return sceneTemp.revKB end,code=pressKey("r"),hide=function()return sceneTemp.state>0 end}),
newButton({name="back", x=1140,y=640,w=180,h=80,color="white", font=35,code=BACK}), newButton({name="back", x=1140,y=640,w=180,h=80,color="white", font=35,code=BACK}),
}, },
help={ help={

View File

@@ -141,6 +141,12 @@ do--calculator
if S.pass then setFont(30)mStr(S.tip,640,10)end if S.pass then setFont(30)mStr(S.tip,640,10)end
end end
end end
do--minigame
function sceneInit.p15()
BG.set("space")
BGM.play()
end
end
do--p15 do--p15
function sceneInit.p15() function sceneInit.p15()
BG.set("rainbow") BG.set("rainbow")
@@ -155,6 +161,8 @@ do--p15
color=2, color=2,
blind=false, blind=false,
slide=true,
revKB=false,
} }
end end
@@ -253,13 +261,13 @@ do--p15
local S=sceneTemp local S=sceneTemp
local b=S.board local b=S.board
if k=="up"then if k=="up"then
tapBoard(S.x,S.y+1,true) tapBoard(S.x,S.y-(S.revKB and 1 or -1),true)
elseif k=="down"then elseif k=="down"then
tapBoard(S.x,S.y-1,true) tapBoard(S.x,S.y+(S.revKB and 1 or -1),true)
elseif k=="left"then elseif k=="left"then
tapBoard(S.x+1,S.y,true) tapBoard(S.x-(S.revKB and 1 or -1),S.y,true)
elseif k=="right"then elseif k=="right"then
tapBoard(S.x-1,S.y,true) tapBoard(S.x+(S.revKB and 1 or -1),S.y,true)
elseif k=="space"then elseif k=="space"then
shuffleBoard(S,b) shuffleBoard(S,b)
S.state=0 S.state=0
@@ -269,7 +277,15 @@ do--p15
if S.state==2 then if S.state==2 then
S.color=(S.color+1)%5 S.color=(S.color+1)%5
end end
elseif k=="h"then elseif k=="r"then
if S.state==0 then
S.revKB=not S.revKB
end
elseif k=="s"then
if S.state==0 then
S.slide=not S.slide
end
elseif k=="b"then
if S.state==0 then if S.state==0 then
S.blind=not S.blind S.blind=not S.blind
end end
@@ -281,14 +297,18 @@ do--p15
tapBoard(x,y) tapBoard(x,y)
end end
function mouseMove.p15(x,y) function mouseMove.p15(x,y)
if sceneTemp.slide then
tapBoard(x,y) tapBoard(x,y)
end end
end
function touchDown.p15(id,x,y) function touchDown.p15(id,x,y)
tapBoard(x,y) tapBoard(x,y)
end end
function touchMove.p15(id,x,y,dx,dy) function touchMove.p15(id,x,y,dx,dy)
if sceneTemp.slide then
tapBoard(x,y) tapBoard(x,y)
end end
end
function Tmr.p15() function Tmr.p15()
local S=sceneTemp local S=sceneTemp
@@ -337,10 +357,10 @@ do--p15
color.black,color.black,color.black,color.black, color.black,color.black,color.black,color.black,
},--Black },--Black
{ {
color.grey,color.grey,color.grey,color.grey, color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.grey,color.grey,color.grey,color.grey, color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.grey,color.grey,color.grey,color.grey, color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.grey,color.grey,color.grey,color.grey, color.dGrey,color.dGrey,color.dGrey,color.dGrey,
},--Grey },--Grey
{ {
color.dRed,color.dRed,color.dRed,color.dRed, color.dRed,color.dRed,color.dRed,color.dRed,
@@ -385,7 +405,7 @@ do--p15
local blind=S.blind and S.state==1 local blind=S.blind and S.state==1
local N=S.board[i][j] local N=S.board[i][j]
local C=blind and 0 or S.color local C=blind and 1 or S.color
local backColor=backColor[C] local backColor=backColor[C]
local frontColor=frontColor[C] local frontColor=frontColor[C]