From 74b099d58f85441ea74ffd5d84b5484d32199b87 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Mon, 24 Oct 2022 23:01:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=88=98=E6=88=BF=E9=97=B4=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=A1=86=E5=8F=AF=E4=BB=A5=E7=94=A8=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E6=88=BF=E9=97=B4=E7=AE=A1=E7=90=86=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/net_game.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 64971dd5..3cf2d954 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -139,8 +139,19 @@ function scene.keyDown(key,isRep) elseif key=='return' then local mes=STRING.trim(inputBox:getText()) if not inputBox.hide and #mes>0 then - if NET.room_chat(mes) then - inputBox:clear() + if mes:sub(1,1)=='/' then + local cmd=STRING.split(mes,' ') + if cmd[1]=='/kick' then + if tonumber(cmd[2]) then NET.room_kick(tonumber(cmd[2])) end + elseif cmd[1]=='/host' then + if tonumber(cmd[2]) then NET.player_setHost(tonumber(cmd[2])) end + else + NET.textBox:push{COLOR.R,'Invalid command'} + end + else + if NET.room_chat(mes) then + inputBox:clear() + end end else _switchChat()