diff --git a/parts/net.lua b/parts/net.lua index 93c2d252..80d5c7e1 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -198,16 +198,22 @@ end function NET.checkPlayDisconn() return WS.status("play")~="running" end -function NET.signal_ready(ready) - if NET.lock("ready",3)and not NET.serverGaming then - WS.send("play",'{"action":6,"data":{"ready":'..tostring(ready)..'}}') - end -end function NET.signal_quit() if NET.lock("quit",3)then WS.send("play",'{"action":3}') end end +function NET.sendMessage(mes) + WS.send("play",'{"action":4,"data":{"message":'..mes..'}}') +end +function NET.changeConfig() + WS.send("play",'{"action":5,"data":'..JSON.encode({config=dumpBasicConfig()})..'}') +end +function NET.signal_ready(ready) + if NET.lock("ready",3)and not NET.serverGaming then + WS.send("play",'{"action":6,"data":{"ready":'..tostring(ready)..'}}') + end +end function NET.signal_die() WS.send("stream",'{"action":4,"data":{"score":0,"survivalTime":0}}') end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 05ab4e75..d0a63765 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -16,7 +16,7 @@ local scene={} function scene.sceneBack() love.keyboard.setKeyRepeat(true) end -function scene.sceneInit() +function scene.sceneInit(org) love.keyboard.setKeyRepeat(false) textBox.hide=true textBox:clear() @@ -25,6 +25,10 @@ function scene.sceneInit() playing=false lastUpstreamTime=0 upstreamProgress=1 + + if org=="setting_game"then + NET.changeConfig() + end end scene.mouseDown=NULL @@ -88,6 +92,10 @@ function scene.keyDown(key) end elseif key=="space"then NET.signal_ready(not PLY_NET[1].ready) + elseif key=="s"then + if not PLY_NET[1].ready then + SCN.go("setting_game") + end end end function scene.keyUp(key) @@ -274,6 +282,7 @@ function scene.draw() end scene.widgetList={ 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="ready",x=900,y=560,w=400,h=100,color="lB",font=40,code=pressKey"space", hide=function() return diff --git a/parts/texture.lua b/parts/texture.lua index 52287462..9f71de95 100644 --- a/parts/texture.lua +++ b/parts/texture.lua @@ -79,6 +79,7 @@ TEXTURE.cursor_hold=DOGC{16,16, {"fCirc",8,8,3}, } +--Level icons TEXTURE.lvIcon=setmetatable({},{__index=function(self,lv) local img={25,25} @@ -93,6 +94,20 @@ TEXTURE.lvIcon=setmetatable({},{__index=function(self,lv) return img end}) +--Setting icon +TEXTURE.setting=DOGC{64,64, + {"setLW",8}, + {"dCirc",32,32,18}, + {"setLW",10}, + {"dLine",52,32,64,32}, + {"dLine",32,52,32,64}, + {"dLine",12,32,0,32}, + {"dLine",32,12,32,0}, + {"dLine",45,45,55,55}, + {"dLine",19,45,9,55}, + {"dLine",19,19,9,9}, + {"dLine",45,19,55,9}, +} gc.setDefaultFilter("linear","linear")