微调房间列表和房间内ui

This commit is contained in:
MrZ626
2021-04-29 00:16:29 +08:00
parent 602c321067
commit 4ac3fea028
2 changed files with 15 additions and 12 deletions

View File

@@ -93,7 +93,7 @@ function scene.keyDown(key)
elseif key=="space"then elseif key=="space"then
NET.signal_ready(not PLY_NET[1].ready) NET.signal_ready(not PLY_NET[1].ready)
elseif key=="s"then elseif key=="s"then
if not PLY_NET[1].ready then if not(PLY_NET[1].ready or NET.getlock("ready"))then
SCN.go("setting_game") SCN.go("setting_game")
end end
end end
@@ -282,7 +282,7 @@ function scene.draw()
end end
scene.widgetList={ scene.widgetList={
textBox, textBox,
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return PLY_NET[1].ready end}, WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or PLY_NET[1].ready or NET.getlock("ready")end},
WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space", WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space",
hide=function() hide=function()
return return

View File

@@ -30,6 +30,8 @@ function scene.keyDown(k)
if fetchTimer<=3.26 then if fetchTimer<=3.26 then
fetchRoom() fetchRoom()
end end
elseif k=="s"then
SCN.go("setting_game")
elseif k=="m"or k=="n"then elseif k=="m"or k=="n"then
if TIME()-lastCreateRoomTime>6.26 then if TIME()-lastCreateRoomTime>6.26 then
NET.createRoom( NET.createRoom(
@@ -70,17 +72,17 @@ function scene.keyDown(k)
end end
function scene.mouseMove(x,y,_,dy) function scene.mouseMove(x,y,_,dy)
if ms.isDown(1)and x>50 and x<1230 and y>110 and y<510 then if ms.isDown(1)and x>50 and x<1110 and y>110 and y<510 then
scene.wheelMoved(0,dy/40) scene.wheelMoved(0,dy/40)
end end
end end
function scene.touchMove(x,y,_,dy) function scene.touchMove(x,y,_,dy)
if x>50 and x<1230 and y>110 and y<510 then if x>50 and x<1110 and y>110 and y<510 then
scene.wheelMoved(0,dy/40) scene.wheelMoved(0,dy/40)
end end
end end
function scene.mouseClick(x,y) function scene.mouseClick(x,y)
if x>50 and x<1230 then if x>50 and x<1110 then
y=int((y-70)/40) y=int((y-70)/40)
if y>=1 and y<=10 then if y>=1 and y<=10 then
local s=int(y+scrollPos) local s=int(y+scrollPos)
@@ -118,7 +120,7 @@ function scene.draw()
--Room list --Room list
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.setLineWidth(2) gc.setLineWidth(2)
gc.rectangle("line",50,110,1180,400) gc.rectangle("line",50,110,1060,400)
local roomCount=#NET.roomList local roomCount=#NET.roomList
if roomCount>0 then if roomCount>0 then
setFont(35) setFont(35)
@@ -131,19 +133,19 @@ function scene.draw()
local R=NET.roomList[pos+i] local R=NET.roomList[pos+i]
if pos+i==selected then if pos+i==selected then
gc.setColor(1,1,1,.3) gc.setColor(1,1,1,.3)
gc.rectangle("fill",50,70+40*i,1180,40) gc.rectangle("fill",50,70+40*i,1060,40)
end end
if R.start then if R.start then
gc.setColor(0,1,0) gc.setColor(0,1,0)
gc.print(text.started,800,66+40*i) gc.print(text.started,620,66+40*i)
end end
gc.setColor(.9,.9,1) gc.setColor(.9,.9,1)
gc.print(pos+i,95,66+40*i) gc.print(pos+i,95,66+40*i)
gc.setColor(1,1,.7) gc.setColor(1,1,.7)
gc.print(R.name,250,66+40*i) gc.print(R.name,250,66+40*i)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.printf(R.type,550,66+40*i,500,"right") gc.printf(R.type,430,66+40*i,500,"right")
gc.print(R.count.."/"..R.capacity,1100,66+40*i) gc.print(R.count.."/"..R.capacity,980,66+40*i)
if R.private then if R.private then
gc.draw(IMG.lock,59,75+40*i) gc.draw(IMG.lock,59,75+40*i)
end end
@@ -161,8 +163,9 @@ function scene.draw()
end end
scene.widgetList={ scene.widgetList={
WIDGET.newText{name="refreshing",x=640,y=255,font=45,hide=function()return not NET.getlock("fetchRoom")end}, WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s"},
WIDGET.newText{name="noRoom", x=640,y=260,font=40,hide=function()return #NET.roomList>0 or NET.getlock("fetchRoom")end}, WIDGET.newText{name="refreshing",x=580,y=255,font=45,hide=function()return not NET.getlock("fetchRoom")end},
WIDGET.newText{name="noRoom", x=580,y=260,font=40,hide=function()return #NET.roomList>0 or NET.getlock("fetchRoom")end},
WIDGET.newKey{name="refresh", x=300,y=620,w=140,h=140,font=35,code=fetchRoom,hide=function()return fetchTimer>3.26 end}, WIDGET.newKey{name="refresh", x=300,y=620,w=140,h=140,font=35,code=fetchRoom,hide=function()return fetchTimer>3.26 end},
WIDGET.newKey{name="new", x=500,y=620,w=140,h=140,font=20,code=pressKey"n"}, WIDGET.newKey{name="new", x=500,y=620,w=140,h=140,font=20,code=pressKey"n"},
WIDGET.newKey{name="new2", x=700,y=620,w=140,h=140,font=20,code=pressKey"m"}, WIDGET.newKey{name="new2", x=700,y=620,w=140,h=140,font=20,code=pressKey"m"},