整理2048ui代码

This commit is contained in:
MrZ626
2021-02-16 21:35:02 +08:00
parent 5f96e8450e
commit 063de09d3f
3 changed files with 10 additions and 17 deletions

View File

@@ -640,10 +640,7 @@ return{
blind="Blind",
tapControl="Tap control",
up="",down="",left="",right="",
skip="Skip Round",
replay1="P",
replay2="P",
},
mg_jgt={
reset="Reset",

View File

@@ -642,10 +642,7 @@ return{
blind="盲打",
tapControl="点击操作",
up="",down="",left="",right="",
skip="跳过回合",
replay1="P",
replay2="P",
},
mg_jgt={
reset="重置",

View File

@@ -74,12 +74,11 @@ end
local function newTile()
--Select position & generate number
nextPos=(nextPos+6)%16+1
local p=nextPos
while board[p]do
p=(p-4)%16+1
while board[nextPos]do
nextPos=(nextPos-4)%16+1
end
board[p]=nextTile
prevPos=p
board[nextPos]=nextTile
prevPos=nextPos
prevSpawnTime=0
--Fresh score
@@ -479,15 +478,15 @@ scene.widgetList={
WIDGET.newSwitch{name="blind", x=240,y=300,w=60, font=40,disp=function()return blind end, code=pressKey"q",hide=function()return state==1 end},
WIDGET.newSwitch{name="tapControl", x=240,y=370,w=60, font=40,disp=function()return tapControl end, code=pressKey"w",hide=function()return state==1 end},
WIDGET.newKey{name="up", x=155,y=560-100,w=100,font=50,color="yellow",code=pressKey"up",hide=function()return tapControl end},
WIDGET.newKey{name="down", x=155,y=560+100,w=100,font=50,color="yellow",code=pressKey"down",hide=function()return tapControl end},
WIDGET.newKey{name="left", x=155-100,y=560,w=100,font=50,color="yellow",code=pressKey"left",hide=function()return tapControl end},
WIDGET.newKey{name="right", x=155+100,y=560,w=100,font=50,color="yellow",code=pressKey"right",hide=function()return tapControl end},
WIDGET.newKey{name="up", x=155,y=460,w=100,fText="",font=50,color="yellow",code=pressKey"up",hide=function()return tapControl end},
WIDGET.newKey{name="down", x=155,y=660,w=100,fText="",font=50,color="yellow",code=pressKey"down",hide=function()return tapControl end},
WIDGET.newKey{name="left", x=55,y=560,w=100,fText="",font=50,color="yellow",code=pressKey"left",hide=function()return tapControl end},
WIDGET.newKey{name="right", x=255,y=560,w=100,fText="",font=50,color="yellow",code=pressKey"right",hide=function()return tapControl end},
WIDGET.newKey{name="skip", x=155,y=400,w=100,font=20,color="yellow",code=pressKey"space",hide=function()return state~=1 or not skipper.cd or skipper.cd>0 end},
WIDGET.newKey{name="record1", x=1100,y=390,w=220,h=50,fText="",color="grey",code=pressKey"1",hide=function()return state==2 end},
WIDGET.newKey{name="record2", x=1100,y=450,w=220,h=50,fText="",color="grey",code=pressKey"2",hide=function()return state==2 end},
WIDGET.newKey{name="replay1", x=1245,y=390,w=50,color="green",code=pressKey"c1",hide=function()return state==2 or #repeater.seq[1]==0 end},
WIDGET.newKey{name="replay2", x=1245,y=450,w=50,color="green",code=pressKey"c2",hide=function()return state==2 or #repeater.seq[2]==0 end},
WIDGET.newKey{name="replay1", x=1245,y=390,w=50,fText="!",color="green",code=pressKey"c1",hide=function()return state==2 or #repeater.seq[1]==0 end},
WIDGET.newKey{name="replay2", x=1245,y=450,w=50,fText="!",color="green",code=pressKey"c2",hide=function()return state==2 or #repeater.seq[2]==0 end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
}