From ef78e0ae21761417726dc064be223d68e25d135d Mon Sep 17 00:00:00 2001 From: gaoxin Date: Wed, 28 Jul 2021 17:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B7=A8=E6=9C=8D=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E3=80=91=E6=B7=BB=E5=8A=A0=E8=B7=A8=E6=9C=8D=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E9=A2=91=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Common/GlobalDefine.lua | 1 + .../~Lua/Modules/Chat/ChatManager.lua | 4 ++- .../~Lua/Modules/Chat/ChatPanel.lua | 25 +++++++++++++------ .../~Lua/View/ChatTipView.lua | 3 +++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 3458445c63..1b73d88ebe 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -1842,6 +1842,7 @@ CHAT_CHANNEL = { GLOBAL = 1, -- 世界 FAMILY = 2, -- 公会 FRIEND = 3, -- 好友 + JUMP_SERVER = 4, -- 跨服 } -- 新关卡状态 diff --git a/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua b/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua index 87519062a3..011dfc0157 100644 --- a/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Chat/ChatManager.lua @@ -17,6 +17,7 @@ local _CHANNEL = { CHAT_CHANNEL.SYSTEM, -- 系统 CHAT_CHANNEL.FAMILY, -- CHAT_CHANNEL.GLOBAL, -- 世界 + CHAT_CHANNEL.JUMP_SERVER,-- 跨服 } this.SYS_MSG_TYPE = { [0] = {name = Language[10350]}, @@ -134,7 +135,7 @@ function this.RequestSendChatMsg(channel, content, func) return end -- 世界发言冷却时间 - if channel == CHAT_CHANNEL.GLOBAL then + if channel == CHAT_CHANNEL.GLOBAL or channel == CHAT_CHANNEL.JUMP_SERVER then local curTimeStamp = GetTimeStamp() if curTimeStamp - this.MyChatTimeStamp < 3 then PopupTipPanel.ShowTip(Language[10355]) @@ -349,6 +350,7 @@ local _MainChatList = { CHAT_CHANNEL.GLOBAL, CHAT_CHANNEL.SYSTEM, CHAT_CHANNEL.FAMILY, + CHAT_CHANNEL.JUMP_SERVER, } function this.RefreshMainPanelShowMsg() -- 获取当前应该显示的数据 diff --git a/Assets/ManagedResources/~Lua/Modules/Chat/ChatPanel.lua b/Assets/ManagedResources/~Lua/Modules/Chat/ChatPanel.lua index dd74051fdd..55dbbd9b49 100644 --- a/Assets/ManagedResources/~Lua/Modules/Chat/ChatPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Chat/ChatPanel.lua @@ -12,6 +12,7 @@ local _TabData = { {text = Language[10366], channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend}, {text = Language[10367], channel = CHAT_CHANNEL.FAMILY}, {text = Language[10368], channel = CHAT_CHANNEL.GLOBAL}, + {text = "跨服", channel = CHAT_CHANNEL.JUMP_SERVER}, {text = Language[10350], channel = CHAT_CHANNEL.SYSTEM}, } -- 当前所在的聊天通道 @@ -215,8 +216,7 @@ function this.OnTabChange(index, lastIndex) -- 是否能够发言 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 this.input:SetActive(true) this.noInputTip:SetActive(false) @@ -225,7 +225,7 @@ function this.OnTabChange(index, lastIndex) this.noInputTip:SetActive(true) this.noInputTip:GetComponent("Text").text = Language[10353] 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.noInputTip:SetActive(true) this.noInputTip:GetComponent("Text").text = Language[10371] @@ -308,8 +308,9 @@ end -- 创建滚动列表 function this.GetScrollView(index) + local channel = _TabData[index].channel -- 不存在则创建 - if index == 1 then + if channel == CHAT_CHANNEL.FRIEND then -- 判断是否存在 if not this.FriendScrollView then local rootHight = this.scrollRoot.transform.rect.height @@ -322,7 +323,7 @@ function this.GetScrollView(index) end 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 local rootHight = this.scrollRoot.transform.rect.height local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform, @@ -334,7 +335,7 @@ function this.GetScrollView(index) end return this.ChatScrollView - elseif index == 4 then + elseif channel == CHAT_CHANNEL.SYSTEM then if not this.SystemScrollView then local rootHight = this.scrollRoot.transform.rect.height local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform, @@ -520,6 +521,12 @@ function this.ChatItemAdapter(node, data, isShowTime) JumpManager.GoJump(72001) 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 contentStr = data.msg end @@ -553,6 +560,10 @@ function this.ChatItemAdapter(node, data, isShowTime) end -- 头像添加点击事件 Util.AddOnceClick(head.gameObject, function() + -- TODO:跨服角色信息待开发 + if this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then + return + end -- 自己不做任何操作 if data.senderId ~= PlayerManager.uid then this.playerFriend:SetActive(true) @@ -562,7 +573,7 @@ function this.ChatItemAdapter(node, data, isShowTime) end end --this.ShowPlayerInfo(node, data) - UIManager.OpenPanel(UIName.PlayerInfoPopup,data.senderId) + UIManager.OpenPanel(UIName.PlayerInfoPopup, data.senderId) end end) diff --git a/Assets/ManagedResources/~Lua/View/ChatTipView.lua b/Assets/ManagedResources/~Lua/View/ChatTipView.lua index 309b9269be..84549e36a6 100644 --- a/Assets/ManagedResources/~Lua/View/ChatTipView.lua +++ b/Assets/ManagedResources/~Lua/View/ChatTipView.lua @@ -97,6 +97,9 @@ function ChatTipView:RefreshChatShow() elseif msg.channel == CHAT_CHANNEL.FAMILY then local chat = ChatManager.AnalysisGlobalChat(msg.chat.msg) 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 self.content.text = content