修复聊天室不能发分号

This commit is contained in:
MrZ626
2021-02-11 14:39:46 +08:00
parent a28e25c4fb
commit 33ec4897f6
2 changed files with 4 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
local gc=love.graphics local gc=love.graphics
local data=love.data
local textBox=WIDGET.newTextBox{name="texts",x=40,y=50,w=1200,h=430} local textBox=WIDGET.newTextBox{name="texts",x=40,y=50,w=1200,h=430}
local remain--People in chat room local remain--People in chat room
@@ -11,7 +12,7 @@ local function _init()
end end
local function sendMessage() local function sendMessage()
local W=WIDGET.active.input local W=WIDGET.active.input
if #W.value>0 and wsWrite("T"..W.value)then if #W.value>0 and wsWrite("T"..data.encode("string","base64",W.value))then
W.value="" W.value=""
end end
end end
@@ -75,7 +76,7 @@ function scene.socketRead(mes)
textBox:push{ textBox:push{
COLOR.W,args[1], COLOR.W,args[1],
COLOR.dY,args[2].." ", COLOR.dY,args[2].." ",
COLOR.sky,args[3] data.decode("string","base64",COLOR.sky,args[3])
} }
else else
LOG.print("Illegal message: "..mes,30,COLOR.green) LOG.print("Illegal message: "..mes,30,COLOR.green)

View File

@@ -206,7 +206,7 @@ function scene.socketRead(mes)
textBox:push{ textBox:push{
COLOR.W,args[1], COLOR.W,args[1],
COLOR.dY,args[2].." ", COLOR.dY,args[2].." ",
COLOR.sky,args[3] data.decode("string","base64",COLOR.sky,args[3])
} }
elseif cmd=="C"then elseif cmd=="C"then
if tostring(USER.id)~=args[2]then if tostring(USER.id)~=args[2]then