miduo_client/Assets/ManagedResources/~Lua/Modules/Chat/ChatPanel.lua

637 lines
26 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
local ChatPanel = Inherit(BasePanel)
local this = ChatPanel
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local TabBox = require("Modules/Common/TabBox")
local _TabFontColor = { default = Color.New(130 / 255, 128 / 255, 120 / 255, 1),
lock = Color.New(130 / 255, 128 / 255, 120 / 255, 1),
select = Color.New(243 / 255, 235 / 255, 202 / 255, 1) }
local _TabImage = { default = "r_tongyong_xiaanniu_02", lock = "r_tongyong_xiaanniu_02", select = "r_tongyong_xiaanniu_01"}
local _TabData = {
2023-11-08 15:52:49 +08:00
{text = Language[10366], channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend,default = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31"},
{text = Language[10367], channel = CHAT_CHANNEL.FAMILY, default = "UI_hz_gonghui_32", select = "UI_hz_gonghui_32"},
{text = Language[10368], channel = CHAT_CHANNEL.GLOBAL,default = "UI_hz_gonghui_33", select = "UI_hz_gonghui_33"},
{text = "跨服", channel = CHAT_CHANNEL.JUMP_SERVER,default = "UI_hz_gonghui_34", select = "UI_hz_gonghui_34"},
{text = Language[10350], channel = CHAT_CHANNEL.SYSTEM,default = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31"},
2020-05-09 13:31:21 +08:00
}
-- 当前所在的聊天通道
this._CurChannel = 1
-- 称号
local titleList={}
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function ChatPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
this.tabbox = Util.GetGameObject(self.gameObject, "frame/tabbox")
this.btnBack = Util.GetGameObject(self.gameObject, "frame/btnBack")
this.frameCanvas=Util.GetGameObject(self.gameObject, "frame"):GetComponent("Canvas")
2020-05-09 13:31:21 +08:00
this.scrollRoot = Util.GetGameObject(self.gameObject, "content/scrollroot")
this.friendItem = Util.GetGameObject(self.gameObject, "content/friend")
this.systemItem = Util.GetGameObject(self.gameObject, "content/system")
this.chatItem = Util.GetGameObject(self.gameObject, "content/chat")
this.input = Util.GetGameObject(self.gameObject, "frame/bottom/input")
this.inputText = Util.GetGameObject(self.gameObject, "frame/bottom/input/InputField"):GetComponent("InputField")
this.btnSend = Util.GetGameObject(self.gameObject, "frame/bottom/input/send")
2020-05-09 13:31:21 +08:00
this.noInputTip = Util.GetGameObject(self.gameObject, "frame/bottom/tip")
2020-05-09 13:31:21 +08:00
this.playerInfo = Util.GetGameObject(self.gameObject, "playerInfo")
this.playerBg = Util.GetGameObject(this.playerInfo, "bg")
this.playerHead = Util.GetGameObject(this.playerBg, "head"):GetComponent("Image")
this.playerHeadKuang = Util.GetGameObject(this.playerBg, "headkuang"):GetComponent("Image")
this.playerLv = Util.GetGameObject(this.playerBg, "lv"):GetComponent("Text")
this.playerName = Util.GetGameObject(this.playerBg, "name"):GetComponent("Text")
this.playerPower = Util.GetGameObject(this.playerBg, "power"):GetComponent("Text")
this.playerInvite = Util.GetGameObject(this.playerBg, "btnInvite")
this.playerFriend = Util.GetGameObject(this.playerBg, "btnFriend")
-- this.shader1 = Util.GetGameObject(self.gameObject, "Image"):GetComponent("Image").material.shader
-- this.shader2 = Util.GetGameObject(self.gameObject, "Image1"):GetComponent("Image").material.shader
-- this.shader3 = Util.GetGameObject(self.gameObject, "Image2"):GetComponent("Image").material.shader
-- this.shader4 = Util.GetGameObject(self.gameObject, "Image3"):GetComponent("Image").material.shader
-- this.shader5 = Util.GetGameObject(self.gameObject, "Image4"):GetComponent("Image").material.shader
-- this.shader6 = Util.GetGameObject(self.gameObject, "Image5"):GetComponent("Image").material.shader
-- this.shader7 = Util.GetGameObject(self.gameObject, "Image6"):GetComponent("Image").material.shader
2020-05-09 13:31:21 +08:00
-- 上部货币显示
this.UpView = SubUIManager.Open(SubUIConfig.UpView, Util.GetGameObject(self.gameObject, "frame").transform, { showType = UpViewOpenType.ShowLeft})
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function ChatPanel:BindEvent()
-- 关闭界面
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
-- todo:添加公会界面打开聊天,关闭时跳转至主界面的处理
if this._JumpType == 1 then
this:ClosePanel()
UIManager.OpenPanel(UIName.MainPanel)
else
this:ClosePanel()
end
end)
-- 发送消息
Util.AddClick(this.btnSend, function()
local content = this.inputText.text
ChatManager.RequestSendChatMsg(this._CurChannel, content, function()
-- 清空聊天显示
this.inputText.text = ""
end)
end)
-- 关闭玩家信息界面
Util.AddClick(this.playerInfo, function()
this.playerInfo:SetActive(false)
end)
-- 创建一个tab管理
this.TabCtrl = TabBox.New()
this.TabCtrl:SetTabAdapter(this.TabAdapter)
this.TabCtrl:SetTabIsLockCheck(this.TabIsLockCheck)
this.TabCtrl:SetChangeTabCallBack(this.OnTabChange)
this.TabCtrl:Init(this.tabbox, _TabData)
end
--添加事件监听(用于子类重写)
function ChatPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Chat.OnChatDataChanged, this.OnChatDataChanged)
end
--移除事件监听(用于子类重写)
function ChatPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Chat.OnChatDataChanged, this.OnChatDataChanged)
end
function ChatPanel:OnSortingOrderChange()
if titleList then
for node, playerTitle in pairs(titleList) do
playerTitle:SetLayer(this.sortingOrder)
end
end
end
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
function ChatPanel:OnOpen(...)
-- 参数保存
local args = {...}
this._CurTabIndex = args[1] or 3
this._JumpType = args[2] or 1
this._CurChannel = _TabData[this._CurTabIndex].channel
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function ChatPanel:OnShow()
if this.TabCtrl then
this.TabCtrl:ChangeTab(this._CurTabIndex or 3)
end
-- 货币界面
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
this.frameCanvas.sortingOrder=this.sortingOrder+100
2020-05-09 13:31:21 +08:00
-- 开始定时刷新数据
ChatManager.StartChatDataUpdate()
end
--界面关闭时调用(用于子类重写)
function ChatPanel:OnClose()
-- 关闭定时刷新数据
ChatManager.StopChatDataUpdate()
end
--界面销毁时调用(用于子类重写)
function ChatPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
--
SubUIManager.Close(this.UpView)
this.FriendScrollView = nil
this.ChatScrollView = nil
this.SystemScrollView = nil
-- 资源回收
-- if this.ChatScrollView then
-- this.ChatScrollView:RecycleNode()
-- this.ChatScrollView = nil
-- end
-- -- 资源回收
-- if this.SystemScrollView then
-- this.SystemScrollView:RecycleNode()
-- this.SystemScrollView = nil
-- end
-- 清除红点绑定
for _, v in ipairs(_TabData) do
if v.rpType then
ClearRedPointObject(v.rpType)
end
end
if titleList then
for node, playerTitle in pairs(titleList) do
SubUIManager.Close(playerTitle)
end
end
titleList = {}
2020-05-09 13:31:21 +08:00
end
-- tab节点自定义设置
function this.TabAdapter(tab, index, status)
local tabLab = Util.GetGameObject(tab, "Text")
tabLab:GetComponent("Text").text = _TabData[index].text
tabLab:GetComponent("Text").color = _TabFontColor[status]
local tabImg = Util.GetGameObject(tab, "Image")
2023-11-08 15:52:49 +08:00
tabImg:GetComponent("Image").sprite = this.spLoader:LoadSprite(_TabData[index].default)
Util.GetGameObject(tab, "select"):SetActive(status=="select")
2020-05-09 13:31:21 +08:00
local redpot = Util.GetGameObject(tab, "redpot")
if _TabData[index].rpType then
BindRedPointObject(_TabData[index].rpType, redpot)
else
redpot:SetActive(false)
end
end
-- tab锁定检测
function this.TabIsLockCheck(index)
local channel = _TabData[index].channel
local isOpen, reason = ChatManager.IsChannelOpen(channel)
if not isOpen then
return true, reason
2020-05-09 13:31:21 +08:00
end
return false
end
-- 节点状态改变回调事件
function this.OnTabChange(index, lastIndex)
-- 关闭上个界面
if lastIndex then
local lastSV = this.GetScrollView(lastIndex)
-- if lastIndex ~= 1 then
-- lastSV:RecycleNode()
-- end
lastSV.gameObject:SetActive(false)
end
-- 打开当前界面
this._CurTabIndex = index
local curSV = this.GetScrollView(index)
curSV.gameObject:SetActive(true)
-- 是否能够发言
this._CurChannel = _TabData[index].channel
local chanel= AppConst.SdkChannel
if this._CurChannel == CHAT_CHANNEL.FAMILY or this._CurChannel == CHAT_CHANNEL.GLOBAL or this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then
2022-11-22 14:23:35 +08:00
local mission=ActivityGiftManager.GetActivityInfo(ActivityTypeDef.shuaChongTeQuan,2202)
local state=mission.state
LogError("VipManager.GetChargedNum()=="..VipManager.GetChargedNum())
--ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.CHAT)
--xiao7 渠道
if VipManager.GetChargedNum()>=5000 and chanel and chanel=="XQDC" then
this.input:SetActive(true)
this.noInputTip:SetActive(false)
--其他渠道及本地
elseif VipManager.GetChargedNum()>=10000 then
2020-05-09 13:31:21 +08:00
this.input:SetActive(true)
this.noInputTip:SetActive(false)
else
this.input:SetActive(false)
this.noInputTip:SetActive(true)
if chanel and chanel=="XQDC" then
this.noInputTip:GetComponent("Text").text = "折扣后实际充值50元可发言"
else
this.noInputTip:GetComponent("Text").text = "折扣后实际充值100元可发言"
end
2020-05-09 13:31:21 +08:00
end
elseif this._CurChannel == CHAT_CHANNEL.FRIEND or this._CurChannel == CHAT_CHANNEL.SYSTEM then
2020-05-09 13:31:21 +08:00
this.input:SetActive(false)
this.noInputTip:SetActive(true)
2021-04-09 12:26:35 +08:00
this.noInputTip:GetComponent("Text").text = Language[10371]
2020-05-09 13:31:21 +08:00
end
-- 刷新显示
this.RefreshShow(true)
end
-- 数据变化回调
function this.OnChatDataChanged(channel)
if channel == this._CurChannel then
this.RefreshShow(false)
end
end
-- 刷新当前显示
function this.RefreshShow(isForceBottom)
-- 刷新数据
local curSV = this.GetScrollView(this._CurTabIndex)
local datalist = ChatManager.GetChatList(this._CurChannel)
local _GoToIndex = nil
if this._CurChannel ~= CHAT_CHANNEL.FRIEND then
_GoToIndex = #datalist
end
curSV:SetData(datalist, function(dataIndex, go)
-- 判断是否要显示聊天的时间
local isShowTime = false
if dataIndex == 1 then
isShowTime = true
elseif dataIndex > 1 then
local deltaTime = datalist[dataIndex].times - datalist[dataIndex - 1].times
isShowTime = deltaTime >= ChatManager.ShowTimeDT
end
-- 设置数据
local data = datalist[dataIndex]
if this._CurChannel == CHAT_CHANNEL.FRIEND then
this.FriendItemAdapter(go, data)
elseif this._CurChannel == CHAT_CHANNEL.SYSTEM then
this.SystemItemAdapter(go, data, isShowTime)
else
this.ChatItemAdapter(go, data, isShowTime)
end
-- local particles=this.scrollRoot:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem))
-- for key, value in pairs(particles:ToTable()) do
-- local mat=value:GetComponent(typeof(UnityEngine.Renderer))
-- if mat.material.shader.name=="CGwell FX/Additive Lv1" then
-- mat.material.shader=this.shader1
-- elseif mat.material.shader.name=="Shader Forge/shuibowen" then
-- mat.material.shader=this.shader4
-- elseif mat.material.shader.name=="MagesBox/UVPanner_Add" then
-- mat.material.shader=this.shader5
-- elseif mat.material.shader.name=="CGwell FX/Add Lv4" then
-- mat.material.shader=this.shader3
-- elseif mat.material.shader.name=="Shader Forge/shuibowen_Alpha Blend" then
-- mat.material.shader=this.shader6
-- elseif mat.material.shader.name=="CGwell FX/Alpha Blend Lv4" then
-- mat.material.shader=this.shader7
-- end
-- -- mat.material.shader=Shader.Find("CGwell FX/Additive Lv1_1")
-- --mat.material= resMgr:LoadAsset("chenghao_mat1")
-- end
-- local meshs=this.scrollRoot:GetComponentsInChildren(typeof(UnityEngine.MeshRenderer))
-- for key, value in pairs(meshs:ToTable()) do
-- -- value.material.shader=Shader.Find("Custom/S_03_UV_alpha_add_1")
-- --value.material= resMgr:LoadAsset("chenghao_mat2")
-- value.material.shader=this.shader2
-- end
2020-05-09 13:31:21 +08:00
end, _GoToIndex)
-- 好友数据置顶
if this._CurChannel == CHAT_CHANNEL.FRIEND then
curSV:SetIndex(1)
end
end
-- 创建滚动列表
function this.GetScrollView(index)
local channel = _TabData[index].channel
2020-05-09 13:31:21 +08:00
-- 不存在则创建
if channel == CHAT_CHANNEL.FRIEND then
2020-05-09 13:31:21 +08:00
-- 判断是否存在
if not this.FriendScrollView then
local rootHight = this.scrollRoot.transform.rect.height
local sv = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollRoot.transform,
this.friendItem, nil, Vector2.New(1080, rootHight - 10), 1, 1, Vector2.New(0, 10))
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
-- 保存
this.FriendScrollView = sv
end
return this.FriendScrollView
elseif channel == CHAT_CHANNEL.FAMILY or channel == CHAT_CHANNEL.GLOBAL or channel == CHAT_CHANNEL.JUMP_SERVER then
2020-05-09 13:31:21 +08:00
if not this.ChatScrollView then
local rootHight = this.scrollRoot.transform.rect.height
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
this.chatItem, Vector2.New(1080, rootHight - 10), 1, 10)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
-- 保存
this.ChatScrollView = sv
end
return this.ChatScrollView
elseif channel == CHAT_CHANNEL.SYSTEM then
2020-05-09 13:31:21 +08:00
if not this.SystemScrollView then
local rootHight = this.scrollRoot.transform.rect.height
local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
this.systemItem, Vector2.New(1080, rootHight - 10), 1, 10)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
-- 保存
this.SystemScrollView = sv
end
return this.SystemScrollView
end
end
-- 好友节点数据匹配
function this.FriendItemAdapter(node, data)
-- 获取节点
local bg = Util.GetGameObject(node, "bg")
local content = Util.GetGameObject(node, "content"):GetComponent("Text")
local name = Util.GetGameObject(node, "name"):GetComponent("Text")
local lv = Util.GetGameObject(node, "lv"):GetComponent("Text")
local head = Util.GetGameObject(node, "head"):GetComponent("Image")
local frame = Util.GetGameObject(node, "headkuang"):GetComponent("Image")
local redpot = Util.GetGameObject(node, "redpot")
local titlePar =Util.GetGameObject(node, "titlePar")
2020-05-09 13:31:21 +08:00
-- 数据匹配
local fdata = GoodFriendManager.GetFriendInfo(data.friendId)
content.text = data.content
name.text = fdata.name
lv.text = fdata.lv
2021-04-21 13:12:04 +08:00
head.sprite = GetPlayerHeadSprite(this.spLoader, fdata.head)
frame.sprite = GetPlayerHeadFrameSprite(this.spLoader, fdata.frame)
2020-05-09 13:31:21 +08:00
redpot:SetActive(FriendChatManager.IsFriendNewChat(data.friendId))
local title = fdata.userTitle
if title and title > 0 then
titlePar:SetActive(true)
if not titleList[node] then
titleList[node] = SubUIManager.Open(SubUIConfig.PlayerTitle, titlePar.transform)
titleList[node]:RemoveCanvas()
end
titleList[node]:SetShow(title, Vector3.zero, 0.4, 0.4, this.sortingOrder)
else
titlePar:SetActive(false)
end
2020-05-09 13:31:21 +08:00
-- 头像添加点击事件
Util.AddOnceClick(bg, function()
UIManager.OpenPanel(UIName.FriendChatPanel, data.friendId)
end)
end
-- 系统消息节点数据匹配
function this.SystemItemAdapter(node, data, isShowTime)
local time = Util.GetGameObject(node, "time")
local bg = Util.GetGameObject(node, "bg")
local content = Util.GetGameObject(node, "bg/content"):GetComponent("Text")
local sType = Util.GetGameObject(node, "bg/content/type")
local sTypeStr = Util.GetGameObject(node, "bg/content/type/Text"):GetComponent("Text")
time:SetActive(isShowTime)
if isShowTime then
time:GetComponent("Text").text = TimeStampToDateStr(tonumber(data.times)/1000)
end
local sTypeInfo = ChatManager.SYS_MSG_TYPE[data.messageType]
if sTypeInfo then
sType:SetActive(true)
sTypeStr.text = sTypeInfo.name
content.text = "   " .. data.msg
else
sType:SetActive(false)
content.text = data.msg
end
Util.AddOnceClick(bg, function()
-- 内容包含异妖的不显示
2021-04-09 12:26:35 +08:00
local pos = string.find(data.msg, Language[10372])
2020-05-09 13:31:21 +08:00
if pos then return end
-- 其他的按物品显示
local itemDataConFig = itemConfig[data.itemId]
if not itemDataConFig then return end
if itemDataConFig.ItemType == ItemType.Hero then
local heroConfigData=ConfigManager.GetConfigData(ConfigName.HeroConfig, itemConfig[data.itemId].HeroStar[1])
2021-04-09 12:26:35 +08:00
local showStarNum = string.find(data.msg, Language[10373]) and heroConfigData.MaxRank or itemConfig[data.itemId].HeroStar[2]
if showStarNum == HeroManager.awakeStarIndex then--只有觉醒有点击事件
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,heroConfigData.Id,showStarNum)
end
2020-05-09 13:31:21 +08:00
elseif itemDataConFig.ItemType == ItemType.Equip then
2021-04-09 20:31:45 +08:00
-- UIManager.OpenPanel(UIName.HandBookEquipInfoPanel, data.itemId)
local itemData = {}
itemData.id = data.itemId
2021-11-09 10:22:16 +08:00
-- UIManager.OpenPanel(UIName.RoleEquipChangePopup, nil, 4, nil, itemData, nil, nil)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,self, itemData,0)
elseif itemDataConFig.ItemType == ItemType.Talisman then
-- UIManager.OpenPanel(UIName.TalismanInfoPopup, data.itemId, 2, 1)
2020-05-09 13:31:21 +08:00
else
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, data.itemId)
end
end)
end
-- 聊天节点数据匹配
function this.ChatItemAdapter(node, data, isShowTime)
local right = Util.GetGameObject(node, "rightchat")
2022-05-30 14:59:16 +08:00
if not right then
return
end
2020-05-09 13:31:21 +08:00
local left = Util.GetGameObject(node, "leftchat")
local isMyChat = data.senderId == PlayerManager.uid
2022-05-30 14:59:16 +08:00
if right then
right:SetActive(isMyChat)
end
if left then
left:SetActive(not isMyChat)
end
2020-05-09 13:31:21 +08:00
node = isMyChat and right or left
local time = Util.GetGameObject(node, "time")
local timeLab = Util.GetGameObject(node, "time/Text"):GetComponent("Text")
local content = Util.GetGameObject(node, "contentroot/bg/content"):GetComponent("Text")
local head = Util.GetGameObject(node, "base/head"):GetComponent("Image")
local headKuang = Util.GetGameObject(node, "base/headkuang"):GetComponent("Image")
local lv = Util.GetGameObject(node, "base/lv"):GetComponent("Text")
local name = Util.GetGameObject(node, "base/name"):GetComponent("Text")
local zw = Util.GetGameObject(node, "base/zhiwei")
local zwName = Util.GetGameObject(node, "base/zhiwei/Text"):GetComponent("Text")
local titlePar =Util.GetGameObject(node, "base/titlePar")
2020-05-09 13:31:21 +08:00
-- 判断是否显示时间
time:SetActive(isShowTime)
if isShowTime then
timeLab.text = TimeStampToDateStr(tonumber(data.times)/1000)
end
local contentStr = ""
if this._CurChannel == CHAT_CHANNEL.GLOBAL then
local chat = ChatManager.AnalysisGlobalChat(data.msg)
contentStr = chat.content
if chat.type == GLOBAL_CHAT_TYPE.COMMON then
Util.AddOnceClick(content.gameObject, function() end)
elseif chat.type == GLOBAL_CHAT_TYPE.GUILD_INVITE then
Util.AddOnceClick(content.gameObject, function()
if PlayerManager.familyId ~= 0 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10374])
2020-05-09 13:31:21 +08:00
return
end
--local _IsInFight = GuildFightManager.IsInGuildFight()
--if _IsInFight then
-- PopupTipPanel.ShowTip("公会战期间无法加入公会")
-- return
--end
2021-04-09 12:26:35 +08:00
MsgPanel.ShowTwo(string.format(Language[10375], chat.gName),nil, function()
2020-05-09 13:31:21 +08:00
if PlayerManager.level < chat.gLimitLv then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10376])
2020-05-09 13:31:21 +08:00
return
end
if chat.joinType == GUILD_JOIN_TYPE.NO_LIMIT then
GuildManager.RequestJoinGuild(chat.gId, function ()
-- 关闭当前界面
if this._JumpType == 1 then
this:ClosePanel()
UIManager.OpenPanel(UIName.MainPanel)
else
this:ClosePanel()
end
-- 打开公会主城
UIManager.OpenPanel(UIName.GuildMainCityPanel)
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10377])
2020-05-09 13:31:21 +08:00
end)
elseif chat.joinType == GUILD_JOIN_TYPE.LIMIT then
GuildManager.RequestApplyManyGuilds({chat.gId}, function()
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10378])
2020-05-09 13:31:21 +08:00
end)
elseif chat.joinType == GUILD_JOIN_TYPE.FORBID then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10379])
2020-05-09 13:31:21 +08:00
end
end)
end)
end
elseif this._CurChannel == CHAT_CHANNEL.FAMILY then
local chat = ChatManager.AnalysisGlobalChat(data.msg)
contentStr = chat.content
if chat.type == GLOBAL_CHAT_TYPE.COMMON then
Util.AddOnceClick(content.gameObject, function() end)
elseif chat.type == GLOBAL_CHAT_TYPE.GUILD_REDPACKET then
contentStr=chat.content
2020-05-15 17:03:13 +08:00
elseif chat.type == GLOBAL_CHAT_TYPE.GUILD_AID then
Util.AddOnceClick(content.gameObject, function()
JumpManager.GoJump(72001)
2020-05-15 17:03:13 +08:00
end)
2020-05-09 13:31:21 +08:00
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
2020-05-09 13:31:21 +08:00
else
contentStr = data.msg
end
-- 基础信息
content.text = contentStr
local title=0
2020-05-09 13:31:21 +08:00
if data.senderId == PlayerManager.uid then
lv.text = PlayerManager.level
2021-05-17 17:28:37 +08:00
name.text = PracticeManager.SetNameColor(PlayerManager.nickName,PracticeManager.PracticeLevel)
-- if data.serverName and data.serverName ~= "" then
-- name.text = name.text.." "..data.serverName
-- end
2021-04-21 13:12:04 +08:00
head.sprite = GetPlayerHeadSprite(this.spLoader, PlayerManager.head)
headKuang.sprite = GetPlayerHeadFrameSprite(this.spLoader, HeadManager.GetCurFrameId())
title=PlayerManager.GetPlayerDesignation()
2020-05-09 13:31:21 +08:00
else
lv.text = data.senderlevel
name.text = data.senderName
-- if data.serverName and data.serverName ~= "" then
-- name.text = data.serverName .." "..data.senderName
-- end
2021-04-21 13:12:04 +08:00
head.sprite = GetPlayerHeadSprite(this.spLoader, data.head)
headKuang.sprite = GetPlayerHeadFrameSprite(this.spLoader, data.frame)
title=data.userTitle
end
if title and title>0 then
titlePar:SetActive(true)
if not titleList[node] then
titleList[node] = SubUIManager.Open(SubUIConfig.PlayerTitle, titlePar.transform)
titleList[node]:RemoveCanvas()
end
titleList[node]:SetShow(title, Vector3.zero, 0.4, 0.4, this.sortingOrder)
else
titlePar:SetActive(false)
2020-05-09 13:31:21 +08:00
end
-- 头像添加点击事件
Util.AddOnceClick(head.gameObject, function()
-- 自己不做任何操作
if data.senderId ~= PlayerManager.uid then
this.playerFriend:SetActive(true)
for i,v in pairs(GoodFriendManager.friendAllData) do
if(i==data.senderId and v~=nil) then
this.playerFriend:SetActive(false)
end
end
--this.ShowPlayerInfo(node, data)
if this._CurChannel == CHAT_CHANNEL.JUMP_SERVER then
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.senderId, PLAYER_INFO_VIEW_TYPE.JUPMSERVER_NORMAL, data.serverName)
else
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.senderId)
end
2020-05-09 13:31:21 +08:00
end
end)
zw:SetActive(false)
end
--- 显示玩家信息
function this.ShowPlayerInfo(node, data)
-- 显示
this.playerInfo:SetActive(true)
-- 设置位置
local v2 = RectTransformUtility.WorldToScreenPoint(UIManager.camera, node.transform.position)
this.playerBg.transform.localPosition = Vector3(v2.x + 200, v2.y, 0)
-- 设置内容
this.playerLv.text = data.senderlevel
this.playerName.text = data.senderName
this.playerPower.text = data.soulVal
2021-04-21 13:12:04 +08:00
this.playerHead.sprite = GetPlayerHeadSprite(this.spLoader, data.head)
this.playerHeadKuang.sprite = GetPlayerHeadFrameSprite(this.spLoader, data.frame)
2020-05-09 13:31:21 +08:00
-- 邀请加入公会
Util.AddOnceClick(this.playerInvite, function()
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10380])
2020-05-09 13:31:21 +08:00
end)
-- 添加好友
Util.AddOnceClick(this.playerFriend, function()
GoodFriendManager.InviteFriendRequest(data.senderId, function()
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10381])
2020-05-09 13:31:21 +08:00
this.playerInfo:SetActive(false)
end)
end)
end
2021-04-21 13:12:04 +08:00
return ChatPanel