【跨服聊天】添加跨服聊天频道
parent
d7009c9950
commit
ef78e0ae21
|
|
@ -1842,6 +1842,7 @@ CHAT_CHANNEL = {
|
||||||
GLOBAL = 1, -- 世界
|
GLOBAL = 1, -- 世界
|
||||||
FAMILY = 2, -- 公会
|
FAMILY = 2, -- 公会
|
||||||
FRIEND = 3, -- 好友
|
FRIEND = 3, -- 好友
|
||||||
|
JUMP_SERVER = 4, -- 跨服
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 新关卡状态
|
-- 新关卡状态
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ local _CHANNEL = {
|
||||||
CHAT_CHANNEL.SYSTEM, -- 系统
|
CHAT_CHANNEL.SYSTEM, -- 系统
|
||||||
CHAT_CHANNEL.FAMILY, --
|
CHAT_CHANNEL.FAMILY, --
|
||||||
CHAT_CHANNEL.GLOBAL, -- 世界
|
CHAT_CHANNEL.GLOBAL, -- 世界
|
||||||
|
CHAT_CHANNEL.JUMP_SERVER,-- 跨服
|
||||||
}
|
}
|
||||||
this.SYS_MSG_TYPE = {
|
this.SYS_MSG_TYPE = {
|
||||||
[0] = {name = Language[10350]},
|
[0] = {name = Language[10350]},
|
||||||
|
|
@ -134,7 +135,7 @@ function this.RequestSendChatMsg(channel, content, func)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- 世界发言冷却时间
|
-- 世界发言冷却时间
|
||||||
if channel == CHAT_CHANNEL.GLOBAL then
|
if channel == CHAT_CHANNEL.GLOBAL or channel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
local curTimeStamp = GetTimeStamp()
|
local curTimeStamp = GetTimeStamp()
|
||||||
if curTimeStamp - this.MyChatTimeStamp < 3 then
|
if curTimeStamp - this.MyChatTimeStamp < 3 then
|
||||||
PopupTipPanel.ShowTip(Language[10355])
|
PopupTipPanel.ShowTip(Language[10355])
|
||||||
|
|
@ -349,6 +350,7 @@ local _MainChatList = {
|
||||||
CHAT_CHANNEL.GLOBAL,
|
CHAT_CHANNEL.GLOBAL,
|
||||||
CHAT_CHANNEL.SYSTEM,
|
CHAT_CHANNEL.SYSTEM,
|
||||||
CHAT_CHANNEL.FAMILY,
|
CHAT_CHANNEL.FAMILY,
|
||||||
|
CHAT_CHANNEL.JUMP_SERVER,
|
||||||
}
|
}
|
||||||
function this.RefreshMainPanelShowMsg()
|
function this.RefreshMainPanelShowMsg()
|
||||||
-- 获取当前应该显示的数据
|
-- 获取当前应该显示的数据
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ local _TabData = {
|
||||||
{text = Language[10366], channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend},
|
{text = Language[10366], channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend},
|
||||||
{text = Language[10367], channel = CHAT_CHANNEL.FAMILY},
|
{text = Language[10367], channel = CHAT_CHANNEL.FAMILY},
|
||||||
{text = Language[10368], channel = CHAT_CHANNEL.GLOBAL},
|
{text = Language[10368], channel = CHAT_CHANNEL.GLOBAL},
|
||||||
|
{text = "跨服", channel = CHAT_CHANNEL.JUMP_SERVER},
|
||||||
{text = Language[10350], channel = CHAT_CHANNEL.SYSTEM},
|
{text = Language[10350], channel = CHAT_CHANNEL.SYSTEM},
|
||||||
}
|
}
|
||||||
-- 当前所在的聊天通道
|
-- 当前所在的聊天通道
|
||||||
|
|
@ -215,8 +216,7 @@ function this.OnTabChange(index, lastIndex)
|
||||||
|
|
||||||
-- 是否能够发言
|
-- 是否能够发言
|
||||||
this._CurChannel = _TabData[index].channel
|
this._CurChannel = _TabData[index].channel
|
||||||
if this._CurChannel == 1 or this._CurChannel == 2 then
|
if this._CurChannel == CHAT_CHANNEL.FAMILY or this._CurChannel == CHAT_CHANNEL.GLOBAL or this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
|
|
||||||
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.CHAT) then
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.CHAT) then
|
||||||
this.input:SetActive(true)
|
this.input:SetActive(true)
|
||||||
this.noInputTip:SetActive(false)
|
this.noInputTip:SetActive(false)
|
||||||
|
|
@ -225,7 +225,7 @@ function this.OnTabChange(index, lastIndex)
|
||||||
this.noInputTip:SetActive(true)
|
this.noInputTip:SetActive(true)
|
||||||
this.noInputTip:GetComponent("Text").text = Language[10353]
|
this.noInputTip:GetComponent("Text").text = Language[10353]
|
||||||
end
|
end
|
||||||
elseif this._CurChannel == 0 or this._CurChannel == 3 then
|
elseif this._CurChannel == CHAT_CHANNEL.FRIEND or this._CurChannel == CHAT_CHANNEL.SYSTEM then
|
||||||
this.input:SetActive(false)
|
this.input:SetActive(false)
|
||||||
this.noInputTip:SetActive(true)
|
this.noInputTip:SetActive(true)
|
||||||
this.noInputTip:GetComponent("Text").text = Language[10371]
|
this.noInputTip:GetComponent("Text").text = Language[10371]
|
||||||
|
|
@ -308,8 +308,9 @@ end
|
||||||
|
|
||||||
-- 创建滚动列表
|
-- 创建滚动列表
|
||||||
function this.GetScrollView(index)
|
function this.GetScrollView(index)
|
||||||
|
local channel = _TabData[index].channel
|
||||||
-- 不存在则创建
|
-- 不存在则创建
|
||||||
if index == 1 then
|
if channel == CHAT_CHANNEL.FRIEND then
|
||||||
-- 判断是否存在
|
-- 判断是否存在
|
||||||
if not this.FriendScrollView then
|
if not this.FriendScrollView then
|
||||||
local rootHight = this.scrollRoot.transform.rect.height
|
local rootHight = this.scrollRoot.transform.rect.height
|
||||||
|
|
@ -322,7 +323,7 @@ function this.GetScrollView(index)
|
||||||
end
|
end
|
||||||
return this.FriendScrollView
|
return this.FriendScrollView
|
||||||
|
|
||||||
elseif index == 2 or index == 3 then
|
elseif channel == CHAT_CHANNEL.FAMILY or channel == CHAT_CHANNEL.GLOBAL or channel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
if not this.ChatScrollView then
|
if not this.ChatScrollView then
|
||||||
local rootHight = this.scrollRoot.transform.rect.height
|
local rootHight = this.scrollRoot.transform.rect.height
|
||||||
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
|
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
|
||||||
|
|
@ -334,7 +335,7 @@ function this.GetScrollView(index)
|
||||||
end
|
end
|
||||||
return this.ChatScrollView
|
return this.ChatScrollView
|
||||||
|
|
||||||
elseif index == 4 then
|
elseif channel == CHAT_CHANNEL.SYSTEM then
|
||||||
if not this.SystemScrollView then
|
if not this.SystemScrollView then
|
||||||
local rootHight = this.scrollRoot.transform.rect.height
|
local rootHight = this.scrollRoot.transform.rect.height
|
||||||
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
|
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
|
||||||
|
|
@ -520,6 +521,12 @@ function this.ChatItemAdapter(node, data, isShowTime)
|
||||||
JumpManager.GoJump(72001)
|
JumpManager.GoJump(72001)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
elseif this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
|
local chat = ChatManager.AnalysisGlobalChat(data.msg)
|
||||||
|
contentStr = chat.content
|
||||||
|
if chat.type == GLOBAL_CHAT_TYPE.COMMON then
|
||||||
|
Util.AddOnceClick(content.gameObject, function() end)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
contentStr = data.msg
|
contentStr = data.msg
|
||||||
end
|
end
|
||||||
|
|
@ -553,6 +560,10 @@ function this.ChatItemAdapter(node, data, isShowTime)
|
||||||
end
|
end
|
||||||
-- 头像添加点击事件
|
-- 头像添加点击事件
|
||||||
Util.AddOnceClick(head.gameObject, function()
|
Util.AddOnceClick(head.gameObject, function()
|
||||||
|
-- TODO:跨服角色信息待开发
|
||||||
|
if this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- 自己不做任何操作
|
-- 自己不做任何操作
|
||||||
if data.senderId ~= PlayerManager.uid then
|
if data.senderId ~= PlayerManager.uid then
|
||||||
this.playerFriend:SetActive(true)
|
this.playerFriend:SetActive(true)
|
||||||
|
|
@ -562,7 +573,7 @@ function this.ChatItemAdapter(node, data, isShowTime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--this.ShowPlayerInfo(node, data)
|
--this.ShowPlayerInfo(node, data)
|
||||||
UIManager.OpenPanel(UIName.PlayerInfoPopup,data.senderId)
|
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.senderId)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,9 @@ function ChatTipView:RefreshChatShow()
|
||||||
elseif msg.channel == CHAT_CHANNEL.FAMILY then
|
elseif msg.channel == CHAT_CHANNEL.FAMILY then
|
||||||
local chat = ChatManager.AnalysisGlobalChat(msg.chat.msg)
|
local chat = ChatManager.AnalysisGlobalChat(msg.chat.msg)
|
||||||
content = string.format(Language[12020], msg.chat.senderName, chat.content)
|
content = string.format(Language[12020], msg.chat.senderName, chat.content)
|
||||||
|
elseif msg.channel == CHAT_CHANNEL.JUMP_SERVER then
|
||||||
|
local chat = ChatManager.AnalysisGlobalChat(msg.chat.msg)
|
||||||
|
content = string.format("[跨服]%s:%s", msg.chat.senderName, chat.content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.content.text = content
|
self.content.text = content
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue