升级进出消息样式(服务器配合调整)

This commit is contained in:
MrZ626
2020-12-05 22:36:54 +08:00
parent b23f005348
commit be1794049b
5 changed files with 20 additions and 21 deletions

View File

@@ -91,8 +91,8 @@ return{
-- wsDisconnected="WS连接断开",
-- wsNoConn="WS未连接",
-- chatJoin="有人来了,当前人数:",
-- chatLeave="有人离开了,当前人数:",
-- chatJoin="进入房间",
-- chatLeave="离开房间",
-- chatRemain="人数:",
-- chatHistory="------以上是历史消息------",

View File

@@ -94,8 +94,8 @@ return{
-- wsDisconnected="WS连接断开",
-- wsNoConn="WS未连接",
-- chatJoin="有人来了,当前人数:",
-- chatLeave="有人离开了,当前人数:",
-- chatJoin="进入房间",
-- chatLeave="离开房间",
-- chatRemain="人数:",
-- chatHistory="------以上是历史消息------",

View File

@@ -95,8 +95,8 @@ return{
-- wsDisconnected="WS连接断开",
-- wsNoConn="WS未连接",
-- chatJoin="有人来了,当前人数:",
-- chatLeave="有人离开了,当前人数:",
-- chatJoin="进入房间",
-- chatLeave="离开房间",
-- chatRemain="人数:",
-- chatHistory="------以上是历史消息------",

View File

@@ -92,8 +92,8 @@ return{
wsDisconnected="WS连接断开",
wsNoConn="WS未连接",
chatJoin="有人来了,当前人数:",
chatLeave="有人离开了,当前人数:",
chatJoin="进入房间",
chatLeave="离开房间",
chatRemain="人数:",
chatHistory="------以上是历史消息------",

View File

@@ -33,8 +33,8 @@ function scene.sceneInit()
scroll=#texts
if scroll>0 then
if texts[scroll][1]~=COLOR.green then
ins(texts,{COLOR.green,text.chatHistory})
if texts[scroll][1]~=COLOR.dG then
ins(texts,{COLOR.dG,text.chatHistory})
scroll=scroll+1
end
end
@@ -76,22 +76,21 @@ function scene.socketRead(mes)
local sep=mes:find(":")
local cmd=mes:sub(2,sep-1)
local data=mes:sub(sep+1)
if cmd=="J"then
remain=tonumber(data)
if remain<=10 then
ins(texts,{COLOR.yellow,text.chatJoin..remain})
end
elseif cmd=="L"then
remain=tonumber(data)
if remain<=10 then
ins(texts,{COLOR.yellow,text.chatLeave..remain})
end
if cmd=="J"or cmd=="L"then
sep=data:find("@")
local num=data:find("#")
remain=tonumber(data:sub(1,sep-1))
ins(texts,{
COLOR.lR,data:sub(sep+1,num-1),
COLOR.dY,data:sub(num).." ",
COLOR.Y,(cmd=="J"and text.chatJoin or text.chatLeave),
})
end
else--user message
local sep=mes:find(":")
local num=mes:find("#")
ins(texts,{
COLOR.white,mes:sub(1,num-1),
COLOR.W,mes:sub(1,num-1),
COLOR.dY,mes:sub(num,sep-1).." ",
COLOR.sky,mes:sub(sep+1),
})