【跨服】开服前七天无法进入跨服

dev_chengFeng
gaoxin 2021-09-23 15:52:01 +08:00
parent e362321aa5
commit 1e011b560a
4 changed files with 55 additions and 36 deletions

View File

@ -65,12 +65,15 @@ function this.TimeUpdate()
if this.IsGetMsg > 0 then return end
-- 不包括好友数据
for _, channel in pairs(_CHANNEL) do
local msgId = this.GetMsgIdFlag(channel)
this.IsGetMsg = this.IsGetMsg + 1
NetManager.RequestChatMsg(channel, msgId, function(data)
this.IsGetMsg = this.IsGetMsg - 1
this.ChatDataAdapter(channel, data)
end)
local isOpen = this.IsChannelOpen(channel)
if isOpen then
local msgId = this.GetMsgIdFlag(channel)
this.IsGetMsg = this.IsGetMsg + 1
NetManager.RequestChatMsg(channel, msgId, function(data)
this.IsGetMsg = this.IsGetMsg - 1
this.ChatDataAdapter(channel, data)
end)
end
end
-- 刷新主界面消息
this.RefreshMainPanelShowMsg()
@ -96,6 +99,25 @@ function this.StopChatDataUpdate()
-- end
end
-- 聊天通达是否开启
function this.IsChannelOpen(channel)
if channel == CHAT_CHANNEL.FAMILY then
local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD)
if not isOpen then
return false, ActTimeCtrlManager.SystemOpenTip(FUNCTION_OPEN_TYPE.GUILD)
end
if isOpen and PlayerManager.familyId == 0 then
return false, Language[10370]
end
elseif channel == CHAT_CHANNEL.JUMP_SERVER then
-- 开服前七天, 未跨服都显示未跨服
if GetTimeStamp() - PlayerManager.GetServerOpenTime() < 7*24*60 or PlayerManager.isCross == 0 then
return false, "未划分跨服分组"
end
end
return true
end
-- 公会聊天数据由服务器推送
function this.ReceiveFamilyChat(msg)
@ -125,10 +147,13 @@ function this.InitData(func)
end
-- 开始发送请求
for _, channel in pairs(_CHANNEL) do
maxIndex = maxIndex + 1
NetManager.RequestChatMsg(channel, 0, function(data)
serverCB(channel, data)
end)
local isOpen = this.IsChannelOpen(channel)
if isOpen then
maxIndex = maxIndex + 1
NetManager.RequestChatMsg(channel, 0, function(data)
serverCB(channel, data)
end)
end
end
end
@ -237,9 +262,9 @@ function this.ChatDataAdapter(channel, data)
local newChat = data.chatInfo[i]
local newMsgId = tonumber(newChat.messageId) -- 新消息的消息号
local msgIdFlag = this.GetMsgIdFlag(channel) -- 获取当前最新消息号
LogRed("消息内容:"..newChat.msg)
LogRed("消息类型:"..newChat.messageType)
LogRed("本地最新消息"..msgIdFlag..",新消息的消息号:"..newMsgId)
__DebugLog("消息内容:"..newChat.msg)
__DebugLog("消息类型:"..newChat.messageType)
__DebugLog("本地最新消息"..msgIdFlag..",新消息的消息号:"..newMsgId)
local msgStr = string.split(newChat.msg,"|")
if channel == CHAT_CHANNEL.SYSTEM then
for i = 2, #msgStr do
@ -273,7 +298,7 @@ function this.ChatDataAdapter(channel, data)
-- newChat.speed = this.horseRunSpeed
-- newChat.multiple = 1
if PlayerManager.uid~=tonumber(msgs[2]) then
LogError("处理聊天数据")
__DebugLog("处理聊天数据")
GuildRedPacketManager.isCheck = true
--MyGuildManager.PackageNum=MyGuildManager.PackageNum+1
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
@ -299,7 +324,7 @@ function this.ChatDataAdapter(channel, data)
end
-- 跑马灯数据,保存到跑马灯管理器中
if this.IsShowInHorseRace(newChat.messageType) then
LogRed("显示跑马灯:"..newChat.msg)
__DebugLog("显示跑马灯:"..newChat.msg)
HorseRaceManager.AddRaceData(newChat)
end
end
@ -367,12 +392,15 @@ function this.RefreshMainPanelShowMsg()
local channel = nil
local msg = nil
for _, cnl in pairs(_MainChatList) do
local chatList = this.GetChatList(cnl)
local chat = chatList[#chatList]
if chat then
if not msg or msg.times < chat.times then
channel = cnl
msg = chat
local isOpen = this.IsChannelOpen(cnl)
if isOpen then
local chatList = this.GetChatList(cnl)
local chat = chatList[#chatList]
if chat then
if not msg or msg.times < chat.times then
channel = cnl
msg = chat
end
end
end
end

View File

@ -187,18 +187,9 @@ end
-- tab锁定检测
function this.TabIsLockCheck(index)
local channel = _TabData[index].channel
if channel == CHAT_CHANNEL.FAMILY then
local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD)
if not isOpen then
return true, ActTimeCtrlManager.SystemOpenTip(FUNCTION_OPEN_TYPE.GUILD)
end
if isOpen and PlayerManager.familyId == 0 then
return true, Language[10370]
end
elseif channel == CHAT_CHANNEL.JUMP_SERVER then
if PlayerManager.isCross == 0 then
return true, "未划分跨服分组"
end
local isOpen, reason = ChatManager.IsChannelOpen(channel)
if not isOpen then
return true, reason
end
return false
end

View File

@ -74,6 +74,7 @@ end
-- 设置服务器开启时间
function this.SetServerOpenTime(time)
if time then
LogRed("服务器开启时间为:"..time)
this.ServerOpenTime = time
end
end

View File

@ -72,9 +72,8 @@ function this.TabAdapter(tab, index, status)
end-- tab可用性检测
function this.PageTabIsLockCheck(index)
if index == 2 then
if PlayerManager.isCross == 1 then
return false--true, "功能尚未开启,敬请期待!"
else
-- 开服前七天, 未跨服都不打开跨服排行榜
if GetTimeStamp() - PlayerManager.GetServerOpenTime() < 7*24*60 or PlayerManager.isCross == 0 then
return true, "未划分跨服分组!"
end
else