【聊天】公会消息缓存添加,暂时删除公会红包跑马灯
parent
d48458f417
commit
fbfb02fc34
|
@ -15,6 +15,7 @@ local _DeltaTime = 5
|
||||||
-- 定时刷新数据的通道枚举
|
-- 定时刷新数据的通道枚举
|
||||||
local _CHANNEL = {
|
local _CHANNEL = {
|
||||||
CHAT_CHANNEL.SYSTEM, -- 系统
|
CHAT_CHANNEL.SYSTEM, -- 系统
|
||||||
|
CHAT_CHANNEL.FAMILY, --
|
||||||
CHAT_CHANNEL.GLOBAL, -- 世界
|
CHAT_CHANNEL.GLOBAL, -- 世界
|
||||||
}
|
}
|
||||||
this.SYS_MSG_TYPE = {
|
this.SYS_MSG_TYPE = {
|
||||||
|
@ -161,14 +162,14 @@ function this.RequestSendChatMsg(channel, content, func)
|
||||||
if func then func() end
|
if func then func() end
|
||||||
else
|
else
|
||||||
__DebugLog(Language[10357])
|
__DebugLog(Language[10357])
|
||||||
if channel == CHAT_CHANNEL.FAMILY then
|
-- if channel == CHAT_CHANNEL.FAMILY then
|
||||||
if func then func() end
|
-- if func then func() end
|
||||||
else
|
-- else
|
||||||
NetManager.RequestChatMsg(channel, msgId, function(data)
|
NetManager.RequestChatMsg(channel, msgId, function(data)
|
||||||
this.ChatDataAdapter(channel, data)
|
this.ChatDataAdapter(channel, data)
|
||||||
if func then func() end
|
if func then func() end
|
||||||
end)
|
end)
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -201,6 +202,7 @@ end
|
||||||
|
|
||||||
-- 数据处理
|
-- 数据处理
|
||||||
function this.ChatDataAdapter(channel, data)
|
function this.ChatDataAdapter(channel, data)
|
||||||
|
__DebugLog("ChatDataAdapter++++++++++++++++++++++++++++++"..channel)
|
||||||
-- 好友数据特殊处理
|
-- 好友数据特殊处理
|
||||||
if channel == CHAT_CHANNEL.FRIEND then return end
|
if channel == CHAT_CHANNEL.FRIEND then return end
|
||||||
-- 先对数据排个序
|
-- 先对数据排个序
|
||||||
|
@ -214,38 +216,6 @@ function this.ChatDataAdapter(channel, data)
|
||||||
-- 数据没有变化,则不刷新
|
-- 数据没有变化,则不刷新
|
||||||
local len = #data.chatInfo
|
local len = #data.chatInfo
|
||||||
if len == 0 then return end
|
if len == 0 then return end
|
||||||
--- 公会数据无需判断消息号
|
|
||||||
if channel == CHAT_CHANNEL.FAMILY then
|
|
||||||
__DebugLog("++++++++++++++++++++++++++++++"..channel)
|
|
||||||
for i = 1, len do
|
|
||||||
table.insert(this.ChatList[channel], data.chatInfo[i])
|
|
||||||
__DebugLog(Language[10359]..data.chatInfo[i].msg)
|
|
||||||
-- 公会红包消息加入跑马灯显示
|
|
||||||
local anaMsg = string.split(data.chatInfo[i].msg, "#")
|
|
||||||
local msgType = tonumber(anaMsg[1])
|
|
||||||
if msgType == GLOBAL_CHAT_TYPE.GUILD_REDPACKET then
|
|
||||||
local content = this.AnalysisGlobalChat(data.chatInfo[i].msg).content
|
|
||||||
local race = {
|
|
||||||
messageId = 0,
|
|
||||||
msg = content,
|
|
||||||
speed = this.horseRunSpeed,
|
|
||||||
multiple = 1,
|
|
||||||
}
|
|
||||||
HorseRaceManager.AddRaceData(race)
|
|
||||||
|
|
||||||
Log("<color=yellow>ChatManager</color>")
|
|
||||||
-- if GuildRedPacketManager.isCheck then return end
|
|
||||||
GuildRedPacketManager.isCheck=true
|
|
||||||
CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
__DebugLog("++++++++++++++++++++++++++++++"..channel)
|
|
||||||
-- 更新事件
|
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnChatDataChanged, channel)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--- 非公会
|
|
||||||
--- 判断messageId是否符合要求,新数据得第一条messageId必须比旧数据最后一条大,
|
--- 判断messageId是否符合要求,新数据得第一条messageId必须比旧数据最后一条大,
|
||||||
--- mssageId相等表示包含敏感字未发出的消息,此消息需要在前端展示,但是不会发送给其他人
|
--- mssageId相等表示包含敏感字未发出的消息,此消息需要在前端展示,但是不会发送给其他人
|
||||||
__DebugLog("++++++++++++++++++++++++++++++"..channel)
|
__DebugLog("++++++++++++++++++++++++++++++"..channel)
|
||||||
|
@ -255,6 +225,7 @@ function this.ChatDataAdapter(channel, data)
|
||||||
local msgIdFlag = this.GetMsgIdFlag(channel) -- 获取当前最新消息号
|
local msgIdFlag = this.GetMsgIdFlag(channel) -- 获取当前最新消息号
|
||||||
__DebugLog("--")
|
__DebugLog("--")
|
||||||
LogGreen("消息内容:"..newChat.msg)
|
LogGreen("消息内容:"..newChat.msg)
|
||||||
|
LogGreen("消息类型:"..newChat.messageType)
|
||||||
LogGreen("本地最新消息"..msgIdFlag..",新消息的消息号:"..newMsgId)
|
LogGreen("本地最新消息"..msgIdFlag..",新消息的消息号:"..newMsgId)
|
||||||
local msgStr = string.split(newChat.msg,"|")
|
local msgStr = string.split(newChat.msg,"|")
|
||||||
if channel == CHAT_CHANNEL.SYSTEM then
|
if channel == CHAT_CHANNEL.SYSTEM then
|
||||||
|
@ -277,6 +248,22 @@ function this.ChatDataAdapter(channel, data)
|
||||||
tostring(msgStr[5]),
|
tostring(msgStr[5]),
|
||||||
tostring(msgStr[6])
|
tostring(msgStr[6])
|
||||||
)
|
)
|
||||||
|
elseif channel == CHAT_CHANNEL.FAMILY then
|
||||||
|
local msgs = string.split(newChat.msg,"#")
|
||||||
|
-- 公会红包的消息需要处理一下
|
||||||
|
local msgType = tonumber(msgs[1])
|
||||||
|
if msgType == GLOBAL_CHAT_TYPE.GUILD_REDPACKET then
|
||||||
|
if tonumber(newChat.times) > this.LoginTimeStamp then
|
||||||
|
-- 公会红包暂时不再显示跑马灯
|
||||||
|
-- newChat.msg = this.AnalysisGlobalChat(newChat.msg).content
|
||||||
|
-- newChat.messageType = 8 -- 公会红包的类型
|
||||||
|
-- newChat.speed = this.horseRunSpeed
|
||||||
|
-- newChat.multiple = 1
|
||||||
|
|
||||||
|
GuildRedPacketManager.isCheck = true
|
||||||
|
CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
LogGreen("消息内容:"..newChat.msg)
|
LogGreen("消息内容:"..newChat.msg)
|
||||||
if msgIdFlag < newMsgId or newMsgId == -1 then
|
if msgIdFlag < newMsgId or newMsgId == -1 then
|
||||||
|
@ -284,8 +271,8 @@ function this.ChatDataAdapter(channel, data)
|
||||||
if newMsgId ~= -1 then -- 消息号为-1表示屏蔽消息,保存数据但不保存消息号,
|
if newMsgId ~= -1 then -- 消息号为-1表示屏蔽消息,保存数据但不保存消息号,
|
||||||
this.SetMsgIdFlag(channel, newMsgId) -- 保存当前消息的消息号,避免下次刷新时还会请求
|
this.SetMsgIdFlag(channel, newMsgId) -- 保存当前消息的消息号,避免下次刷新时还会请求
|
||||||
end
|
end
|
||||||
-- __DebugLog(Language[10363]..tostring(tonumber(newChat.times) <= this.LoginTimeStamp))
|
__DebugLog(Language[10363]..tostring(tonumber(newChat.times) <= this.LoginTimeStamp))
|
||||||
-- if tonumber(newChat.times) > this.LoginTimeStamp - 7200000 then -- 登录时间之前的消息都不显示
|
if channel ~= CHAT_CHANNEL.SYSTEM or tonumber(newChat.times) > this.LoginTimeStamp then -- 登录时间之前的系统消息都不显示
|
||||||
if channel ~= CHAT_CHANNEL.SYSTEM or this.IsShowInChatPanel(newChat.messageType) then
|
if channel ~= CHAT_CHANNEL.SYSTEM or this.IsShowInChatPanel(newChat.messageType) then
|
||||||
if not GoodFriendManager.IsInBlackList(newChat.senderId) then -- 判断是否在黑名单中
|
if not GoodFriendManager.IsInBlackList(newChat.senderId) then -- 判断是否在黑名单中
|
||||||
table.insert(this.ChatList[channel], newChat)
|
table.insert(this.ChatList[channel], newChat)
|
||||||
|
@ -298,7 +285,7 @@ function this.ChatDataAdapter(channel, data)
|
||||||
if this.IsShowInHorseRace(newChat.messageType) then
|
if this.IsShowInHorseRace(newChat.messageType) then
|
||||||
HorseRaceManager.AddRaceData(newChat)
|
HorseRaceManager.AddRaceData(newChat)
|
||||||
end
|
end
|
||||||
-- end
|
end
|
||||||
end
|
end
|
||||||
__DebugLog("--")
|
__DebugLog("--")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue