diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index c38114ce..88ccfc0b 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -243,6 +243,7 @@ return{ match="Find Match", }, net_rooms={ + password="Password", refreshing="Refreshing rooms", noRoom="There aren't any rooms right now...", refresh="Refresh", diff --git a/parts/language/lang_es.lua b/parts/language/lang_es.lua index 6f262ac6..03cadcd7 100644 --- a/parts/language/lang_es.lua +++ b/parts/language/lang_es.lua @@ -218,6 +218,7 @@ return{ match="Buscar Match", }, net_rooms={ + password="Contraseña", refreshing="Refrescando Salas", noRoom="No Hay Salas Actualmente", refresh="Refrescar", @@ -227,7 +228,7 @@ return{ net_newRoom={ title="Ajustes de sala", roomName="Nombre (Por defecto: *usuario*'s room)", - password="Password", + password="Contraseña", description="Descripción", life="Vida", diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 472170b5..75e7c14a 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -214,6 +214,7 @@ return{ -- match="Find Match", }, net_rooms={ + password="Mot de passe", -- refreshing="Refreshing Rooms", noRoom="Aucun salon actuellement", -- refresh="Refresh", @@ -223,7 +224,7 @@ return{ net_newRoom={ -- title="Room config", -- roomName="Room name(default to username's room)", - -- password="Password", + password="Mot de passe", -- description="Room description", life="Vie", diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index eee60e54..dc278879 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -242,6 +242,7 @@ return{ -- match="Find Match", }, net_rooms={ + password="Senha", -- refreshing="Refreshing Rooms", noRoom="Nenhuma sala agora", -- refresh="Refresh", @@ -251,7 +252,7 @@ return{ net_newRoom={ -- title="Room config", -- roomName="Room name(default to username's room)", - -- password="Password", + password="Senha", -- description="Room description", life="Vidas", diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 14c51274..39cd1421 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -243,6 +243,7 @@ return{ match="匹配对手", }, net_rooms={ + password="密码", refreshing="刷新房间列表中", noRoom="一个房间都没有哎...", refresh="刷新", diff --git a/parts/scenes/net_newRoom.lua b/parts/scenes/net_newRoom.lua index 25543eb2..967c7e1f 100644 --- a/parts/scenes/net_newRoom.lua +++ b/parts/scenes/net_newRoom.lua @@ -1,11 +1,11 @@ local ROOMENV=ROOMENV -local roomName=WIDGET.newText {name="roomName", x=40,y=130,align='L'} -local roomNameBox=WIDGET.newInputBox {name="roomNameBox", x=40,y=180,w=540,h=60} -local password=WIDGET.newText {name="password", x=40,y=250,align='L'} -local passwordBox=WIDGET.newInputBox {name="passwordBox", x=40,y=300,w=540,h=60} -local description=WIDGET.newText {name="description", x=650,y=50,align='L'} -local descriptionBox=WIDGET.newInputBox {name="descriptionBox", x=650,y=100,w=550,h=160,font=25} +local roomName=WIDGET.newText{name="roomName", x=40,y=115,align='L'} +local roomNameBox=WIDGET.newInputBox{ x=40,y=160,w=540,h=60} +local password=WIDGET.newText{name="password", x=40,y=255,align='L'} +local passwordBox=WIDGET.newInputBox{ x=40,y=300,w=540,h=60} +local description=WIDGET.newText{name="description",x=650,y=55,align='L'} +local descriptionBox=WIDGET.newInputBox { x=650,y=100,w=550,h=160,font=25} local sList={ visible={"show","easy","slow","medium","fast","none"}, diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 5ef7fa89..580fc220 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -7,6 +7,22 @@ local NET=NET local scrollPos,selected local fetchTimer +local function hidePW() + local R=NET.roomList[selected] + return not R or not R.private +end +local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=hidePW} + +local listBoxPos={ + x=50,y=90, + w=800,h=400, + x2=850,y2=510, +} +local function focusPWbox() + passwordBox.value="" + WIDGET.focus(passwordBox) +end + --[[NET.roomList[n]={ rid="qwerty", roomInfo={ @@ -23,13 +39,13 @@ local function fetchRoom() fetchTimer=10 NET.fetchRoom() end - local scene={} function scene.sceneInit() BG.set() scrollPos=0 selected=1 + focusPWbox() fetchRoom() end @@ -51,45 +67,48 @@ function scene.keyDown(key) if key=="down"then if selected<#NET.roomList then selected=selected+1 + focusPWbox() scrollPos=max(selected-10,min(scrollPos,selected-1)) end elseif key=="up"then if selected>1 then selected=selected-1 + focusPWbox() scrollPos=max(selected-10,min(scrollPos,selected-1)) end elseif key=="return"then if NET.getlock('fetchRoom')or not NET.roomList[selected]then return end local R=NET.roomList[selected] - if R.roomInfo.version~=VERSION.short then MES.new('error',"Version doesn't match")return end - if R.private then MES.new('error',"Can't enter private room now")return end - NET.enterRoom(R)--,password + if R.roomInfo.version~=VERSION.short then MES.new('error',"Version doesn't match 版本不一致")return end + NET.enterRoom(R,passwordBox.value) + else + WIDGET.keyPressed(key) end + else + WIDGET.keyPressed(key) end end function scene.mouseMove(x,y,_,dy) - if ms.isDown(1)and x>50 and x<850 and y>110 and y<510 then + if ms.isDown(1)and x>listBoxPos.x and xlistBoxPos.y and y50 and x<850 and y>110 and y<510 then + if x>listBoxPos.x and xlistBoxPos.y and y50 and x<850 then - y=int((y-70)/40) - if y>=1 and y<=10 then - local s=int(y+scrollPos) - if NET.roomList[s]then - if selected~=s then - selected=s - SFX.play('click',.4) - else - scene.keyDown("return") - end + if x>listBoxPos.x and xlistBoxPos.y and y0 then if roomCount>10 then - local len=400*10/roomCount - gc.rectangle('fill',837,110+(400-len)*scrollPos/(roomCount-10),12,len) + local len=10*listBoxPos.h/roomCount + gc.rectangle('fill',-15,(listBoxPos.h-len)*scrollPos/(roomCount-10),12,len) end - gc.push('transform') gc.stencil(roomListStencil,'replace',1) gc.setStencilTest('equal',1) gc.translate(0,scrollPos%1*-40) @@ -136,46 +156,47 @@ function scene.draw() local R=NET.roomList[pos+i] if pos+i==selected then gc.setColor(1,1,1,.3) - gc.rectangle('fill',50,70+40*i,800,40) + gc.rectangle('fill',0,40*i-40,listBoxPos.w,40) end gc.setColor(1,1,1) - if R.private then gc.draw(IMG.lock,60,75+40*i)end - gc.print(R.count.."/"..R.capacity,720,66+40*i) + if R.private then gc.draw(IMG.lock,10,40*i-35)end + gc.print(R.count.."/"..R.capacity,670,40*i-44) gc.setColor(.9,.9,1) - gc.print(pos+i,95,66+40*i) + gc.print(pos+i,45,40*i-44) if R.start then gc.setColor(0,.4,.1) else gc.setColor(1,1,.7) end - gc.print(R.roomInfo.name,250,66+40*i) + gc.print(R.roomInfo.name,200,40*i-44) end gc.setStencilTest() - gc.pop() + gc.translate(820,130+scrollPos%1*40) gc.setColor(1,1,1) - gc.rectangle('line',860,240,385,270) + gc.rectangle('line',0,0,385,335) if NET.roomList[selected]then local R=NET.roomList[selected] setFont(25) - gc.print(R.roomInfo.type,870,265) + gc.print(R.roomInfo.type,10,25) gc.setColor(1,1,.7) - gc.printf(R.roomInfo.name,870,240,365) + gc.printf(R.roomInfo.name,10,0,365) setFont(20) gc.setColor(.8,.8,.8) - gc.printf(R.roomInfo.description or"[No description]",870,295,365) + gc.printf(R.roomInfo.description or"[No description]",10,55,365) if R.start then gc.setColor(0,1,.2) - gc.print(text.started,870,475) + gc.print(text.started,10,300) end if R.roomInfo.version~=VERSION.short then gc.setColor(1,.2,0) - gc.printf(R.roomInfo.version,870,475,365,'right') + gc.printf(R.roomInfo.version,10,300,365,'right') end end end + gc.pop() --Profile drawSelfProfile() @@ -185,12 +206,13 @@ function scene.draw() end scene.widgetList={ + passwordBox, WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s"}, WIDGET.newText{name="refreshing",x=450,y=255,font=45,hideF=function()return not NET.getlock('fetchRoom')end}, WIDGET.newText{name="noRoom", x=450,y=260,font=40,hideF=function()return #NET.roomList>0 or NET.getlock('fetchRoom')end}, - WIDGET.newKey{name="refresh", x=250,y=620,w=140,h=140,font=35,code=fetchRoom,hideF=function()return fetchTimer>7 end}, - WIDGET.newKey{name="new", x=550,y=620,w=260,h=140,font=30,code=pressKey"n"}, - WIDGET.newKey{name="join", x=850,y=620,w=140,h=140,font=40,code=pressKey"return",hideF=function()return #NET.roomList==0 or NET.getlock('enterRoom')end}, + WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,font=35,code=fetchRoom,hideF=function()return fetchTimer>7 end}, + WIDGET.newKey{name="new", x=510,y=630,w=260,h=120,font=30,code=pressKey"n"}, + WIDGET.newKey{name="join", x=780,y=630,w=140,h=120,font=40,code=pressKey"return",hideF=function()return #NET.roomList==0 or NET.getlock('enterRoom')end}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene}, }