From 59848cd5590c3961a2ab18673d17df3e4fcfc8d4 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 19 May 2021 16:15:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E6=96=87=E6=9C=AC=E6=A1=86=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 4 +--- parts/scenes/net_game.lua | 41 +++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index f6890da0..77e5e926 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -189,9 +189,7 @@ function love.touchreleased(id,x,y) WIDGET.press(x,y,1) WIDGET.release(x,y) touching=false - if WIDGET.sel and not WIDGET.sel.keepFocus then - WIDGET.unFocus() - end + WIDGET.unFocus() end if SCN.touchUp then SCN.touchUp(x,y)end if(x-lastX)^2+(y-lastY)^2<62 then diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index d11231af..24d971a7 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -94,29 +94,40 @@ function scene.touchMove() end function scene.keyDown(key) if key=="escape"then - if TIME()-lastBackTime<1 then - NET.signal_quit() + if not inputBox.hide then + scene.keyDown("switchChat") else - lastBackTime=TIME() - LOG.print(text.sureQuit,'warn') + if TIME()-lastBackTime<1 then + NET.signal_quit() + else + lastBackTime=TIME() + LOG.print(text.sureQuit,'warn') + end end elseif key=="return"then - if inputBox.hide then - textBox.hide=false - inputBox.hide=false - TASK.new(function()YIELD()WIDGET.focus(inputBox)end) - else - local mes=STRING.trim(inputBox:getText()) - if mes and #mes>0 then + local mes=STRING.trim(inputBox:getText()) + if not inputBox.hide then + if #mes>0 then NET.sendMessage(mes) inputBox:clear() elseif #EDITING==0 then - textBox.hide=true - inputBox.hide=true - WIDGET.unFocus() + scene.keyDown("switchChat") end + else + scene.keyDown("switchChat") + end + elseif key=="switchChat"then + if inputBox.hide then + textBox.hide=false + inputBox.hide=false + WIDGET.focus(inputBox) + else + textBox.hide=true + inputBox.hide=true + WIDGET.unFocus() end elseif not inputBox.hide then + print(1) WIDGET.focus(inputBox) inputBox:keypress(key) elseif playing then @@ -360,7 +371,7 @@ scene.widgetList={ not netPLY.getSelfReady() or NET.getlock('ready') end}, - WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"return"}, + WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"switchChat"}, WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"}, }