From b668fa47509ae96e066c8ad1a14fdf5eb41490db Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Mon, 24 Oct 2022 15:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=82=E6=88=98=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A3=80=E6=B5=8B=20=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/init.lua | 2 +- parts/scenes/login_pw.lua | 4 ++-- parts/scenes/net_game.lua | 13 ++++++------- parts/scenes/savedata.lua | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/parts/player/init.lua b/parts/player/init.lua index 8150d165..1e2cee4a 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -12,7 +12,7 @@ local PLY={draw=ply_draw} local modeDataMeta do local rawset=rawset modeDataMeta={ - __index=function(self,k) rawset(self,k,0)return 0 end, + __index=function(self,k) rawset(self,k,0) return 0 end, __newindex=function(self,k,v) rawset(self,k,v) end, } end diff --git a/parts/scenes/login_pw.lua b/parts/scenes/login_pw.lua index b8685c89..b1253474 100644 --- a/parts/scenes/login_pw.lua +++ b/parts/scenes/login_pw.lua @@ -6,9 +6,9 @@ local showEmail=true local function _login() local email,password=emailBox:getText(),passwordBox:getText() if not STRING.simpEmailCheck(email) then - MES.new('error',text.wrongEmail)return + MES.new('error',text.wrongEmail) return elseif #password==0 then - MES.new('error',text.noPassword)return + MES.new('error',text.noPassword) return end NET.pwLogin(email,password) end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 9c559115..64971dd5 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -89,8 +89,8 @@ end scene.mouseDown=NULL function scene.mouseMove(x,y) NETPLY.mouseMove(x,y) end function scene.touchDown(x,y) - if not playing then NETPLY.mouseMove(x,y)return end - if noTouch then return end + if not playing then NETPLY.mouseMove(x,y) return end + if NET.spectate or noTouch then return end local t=VK.on(x,y) if t then @@ -99,7 +99,7 @@ function scene.touchDown(x,y) end end function scene.touchUp(x,y) - if not playing or noTouch then return end + if not playing or NET.spectate or noTouch then return end local n=VK.on(x,y) if n then PLAYERS[1]:releaseKey(n) @@ -149,7 +149,7 @@ function scene.keyDown(key,isRep) WIDGET.focus(inputBox) inputBox:keypress(key) elseif playing then - if noKey or isRep then return end + if NET.spectate or noKey or isRep then return end local k=KEY_MAP.keyboard[key] if k and k>0 then PLAYERS[1]:pressKey(k) @@ -168,7 +168,7 @@ function scene.keyDown(key,isRep) end end function scene.keyUp(key) - if not playing or noKey then return end + if not playing or NET.spectate or noKey then return end local k=KEY_MAP.keyboard[key] if k and k>0 then PLAYERS[1]:releaseKey(k) @@ -253,8 +253,7 @@ function scene.update(dt) for i=1,#NETPLY.list do NETPLY.list[i].readyMode='Playing' end - noKey=PLAYERS[1].uid~=USER.uid - noTouch=noKey + NET.spectate=PLAYERS[1].uid~=USER.uid end end end diff --git a/parts/scenes/savedata.lua b/parts/scenes/savedata.lua index c6ecd863..61d4805e 100644 --- a/parts/scenes/savedata.lua +++ b/parts/scenes/savedata.lua @@ -10,7 +10,7 @@ local function _parseCB() -- Decode s=STRING.unpackText(s) - if not s then MES.new('error',text.dataCorrupted)return end + if not s then MES.new('error',text.dataCorrupted) return end s=loadstring(s) if s then