控件代码分分布到场景代码中,优化控件相关代码
This commit is contained in:
@@ -95,4 +95,117 @@ function Pnt.setting_touch()
|
||||
gc.line(0,d*i,1280,d*i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local virtualkeySet={
|
||||
{
|
||||
{1, 80, 720-200, 80},--moveLeft
|
||||
{2, 320, 720-200, 80},--moveRight
|
||||
{3, 1280-80, 720-200, 80},--rotRight
|
||||
{4, 1280-200, 720-80, 80},--rotLeft
|
||||
{5, 1280-200, 720-320, 80},--rot180
|
||||
{6, 200, 720-320, 80},--hardDrop
|
||||
{7, 200, 720-80, 80},--softDrop
|
||||
{8, 1280-320, 720-200, 80},--hold
|
||||
{9, 1280-80, 280, 80},--func
|
||||
{10,80, 280, 80},--restart
|
||||
},--Farter's tetr.js set
|
||||
{
|
||||
{1, 1280-320, 720-200, 80},--moveLeft
|
||||
{2, 1280-80, 720-200, 80},--moveRight
|
||||
{3, 200, 720-80, 80},--rotRight
|
||||
{4, 80, 720-200, 80},--rotLeft
|
||||
{5, 200, 720-320, 80},--rot180
|
||||
{6, 1280-200, 720-320, 80},--hardDrop
|
||||
{7, 1280-200, 720-80, 80},--softDrop
|
||||
{8, 320, 720-200, 80},--hold
|
||||
{9, 80, 280, 80},--func
|
||||
{10,1280-80, 280, 80},--restart
|
||||
},--Mirrored tetr.js set
|
||||
{
|
||||
{1, 80, 720-80, 80},--moveLeft
|
||||
{2, 240, 720-80, 80},--moveRight
|
||||
{3, 1280-240, 720-80, 80},--rotRight
|
||||
{4, 1280-400, 720-80, 80},--rotLeft
|
||||
{5, 1280-240, 720-240, 80},--rot180
|
||||
{6, 1280-80, 720-80, 80},--hardDrop
|
||||
{7, 1280-80, 720-240, 80},--softDrop
|
||||
{8, 1280-80, 720-400, 80},--hold
|
||||
{9, 80, 360, 80},--func
|
||||
{10,80, 80, 80},--restart
|
||||
},--Author's set, not recommend
|
||||
{
|
||||
{1, 1280-400, 720-80, 80},--moveLeft
|
||||
{2, 1280-80, 720-80, 80},--moveRight
|
||||
{3, 240, 720-80, 80},--rotRight
|
||||
{4, 80, 720-80, 80},--rotLeft
|
||||
{5, 240, 720-240, 80},--rot180
|
||||
{6, 1280-240, 720-240, 80},--hardDrop
|
||||
{7, 1280-240, 720-80, 80},--softDrop
|
||||
{8, 1280-80, 720-240, 80},--hold
|
||||
{9, 80, 720-240, 80},--func
|
||||
{10,80, 320, 80},--restart
|
||||
},--Keyboard set
|
||||
{
|
||||
{10,70, 50,30},--restart
|
||||
{9, 130, 50,30},--func
|
||||
{4, 190, 50,30},--rotLeft
|
||||
{3, 250, 50,30},--rotRight
|
||||
{5, 310, 50,30},--rot180
|
||||
{1, 370, 50,30},--moveLeft
|
||||
{2, 430, 50,30},--moveRight
|
||||
{8, 490, 50,30},--hold
|
||||
{7, 550, 50,30},--softDrop1
|
||||
{6, 610, 50,30},--hardDrop
|
||||
{11,670, 50,30},--insLeft
|
||||
{12,730, 50,30},--insRight
|
||||
{13,790, 50,30},--insDown
|
||||
{14,850, 50,30},--down1
|
||||
{15,910, 50,30},--down4
|
||||
{16,970, 50,30},--down10
|
||||
{17,1030, 50,30},--dropLeft
|
||||
{18,1090, 50,30},--dropRight
|
||||
{19,1150, 50,30},--zangiLeft
|
||||
{20,1210, 50,30},--zangiRight
|
||||
},--PC key feedback(top&in a row)
|
||||
}
|
||||
WIDGET.init("setting_touch",{
|
||||
WIDGET.newButton({name="default", x=520,y=90,w=200,h=80,font=35,
|
||||
code=function()
|
||||
local D=virtualkeySet[sceneTemp.default]
|
||||
for i=1,#VK_org do
|
||||
VK_org[i].ava=false
|
||||
end
|
||||
|
||||
--Replace keys
|
||||
for n=1,#D do
|
||||
local T=D[n]
|
||||
if T[1]then
|
||||
local B=VK_org[n]
|
||||
B.ava=true
|
||||
B.x,B.y,B.r=T[2],T[3],T[4]
|
||||
end
|
||||
end
|
||||
sceneTemp.default=sceneTemp.default%5+1
|
||||
sceneTemp.sel=nil
|
||||
LOG.print("[ "..sceneTemp.default.." ]")
|
||||
end}),
|
||||
WIDGET.newSelector({name="snap", x=760,y=90,w=200,h=80,color="yellow",list={1,10,20,40,60,80},disp=WIDGET.lnk.STPval("snap"),code=WIDGET.lnk.STPsto("snap")}),
|
||||
WIDGET.newButton({name="option", x=520,y=190,w=200,h=80,font=40,
|
||||
code=function()
|
||||
SCN.go("setting_touchSwitch")
|
||||
end}),
|
||||
WIDGET.newButton({name="back", x=760,y=190,w=200,h=80,font=35,code=WIDGET.lnk.BACK}),
|
||||
WIDGET.newSlider({name="size", x=450,y=270,w=460,unit=19,font=40,show="vkSize",
|
||||
disp=function()
|
||||
return VK_org[sceneTemp.sel].r/10-1
|
||||
end,
|
||||
code=function(v)
|
||||
if sceneTemp.sel then
|
||||
VK_org[sceneTemp.sel].r=(v+1)*10
|
||||
end
|
||||
end,
|
||||
hide=function()
|
||||
return not sceneTemp.sel
|
||||
end}),
|
||||
})
|
||||
Reference in New Issue
Block a user