Branch_DNA
zhangjiannan 2025-09-16 17:38:16 +08:00
parent a8f8a12afe
commit 45b3c365e1
1 changed files with 92 additions and 82 deletions

View File

@ -7,15 +7,15 @@ local ArtResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig
local expressionConfig = ConfigManager.GetAllConfigsData(ConfigName.ExpressionConfig)
local TabBox = require("Modules/Common/TabBox")
local _TabData = {
{text = GetLanguageStrById(10401), channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend, image = "X1_guaji_liaotiantubiao_04"},
{text = GetLanguageStrById(10402), channel = CHAT_CHANNEL.FAMILY, image = "X1_guaji_liaotiantubiao_03"},
{text = GetLanguageStrById(10403), channel = CHAT_CHANNEL.GLOBAL, image = "X1_guaji_liaotiantubiao_02"},
{text = GetLanguageStrById(23004), channel = CHAT_CHANNEL.CrossRealm, image = "X1_guaji_liaotiantubiao_05"},
{text = GetLanguageStrById(10384), channel = CHAT_CHANNEL.SYSTEM, image = "X1_guaji_liaotiantubiao_01"},
{ text = GetLanguageStrById(10401), channel = CHAT_CHANNEL.FRIEND, rpType = RedPointType.Chat_Friend, image = "X1_guaji_liaotiantubiao_04" },
{ text = GetLanguageStrById(10402), channel = CHAT_CHANNEL.FAMILY, image = "X1_guaji_liaotiantubiao_03" },
{ text = GetLanguageStrById(10403), channel = CHAT_CHANNEL.GLOBAL, image = "X1_guaji_liaotiantubiao_02" },
{ text = GetLanguageStrById(23004), channel = CHAT_CHANNEL.CrossRealm, image = "X1_guaji_liaotiantubiao_05" },
{ text = GetLanguageStrById(10384), channel = CHAT_CHANNEL.SYSTEM, image = "X1_guaji_liaotiantubiao_01" },
}
local txtColor = {
default = Color.New(199/255,190/255,220/255,153/255),
select = Color.New(255/255,209/255,43/255,255/255),
default = Color.New(199 / 255, 190 / 255, 220 / 255, 153 / 255),
select = Color.New(255 / 255, 209 / 255, 43 / 255, 255 / 255),
}
local chatImgViewShow = false
-- 当前所在的聊天通道
@ -84,7 +84,7 @@ function ChatPanel:BindEvent()
-- this:ClosePanel()
-- UIManager.OpenPanel(UIName.MainPanel)
-- else
this:ClosePanel()
this:ClosePanel()
-- end
end)
Util.AddClick(this.chatImgBtn, function()
@ -109,7 +109,6 @@ function ChatPanel:BindEvent()
return
end
end
end
ChatManager.RequestSendChatMsg(this.curChannel, content, function()
-- 清空聊天显示
@ -119,11 +118,13 @@ function ChatPanel:BindEvent()
this.freeCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) > 0)
this.buyCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) <= 0)
if PrivilegeManager.GetPrivilegeRemainValue(91001) > 0 then
this.freeCount:GetComponent("Text").text = string.format(GetLanguageStrById(10647),PrivilegeManager.GetPrivilegeRemainValue(91001))
this.freeCount:GetComponent("Text").text = string.format(GetLanguageStrById(10647),
PrivilegeManager.GetPrivilegeRemainValue(91001))
else
local costItem = string.split(G_SpecialConfig[155].Value,"#")
this.buyCount:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(G_ItemConfig[tonumber(costItem[1])].ResourceID))
this.buyCountText:GetComponent("Text").text = "x"..costItem[2]
local costItem = string.split(G_SpecialConfig[155].Value, "#")
this.buyCount:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(G_ItemConfig
[tonumber(costItem[1])].ResourceID))
this.buyCountText:GetComponent("Text").text = "x" .. costItem[2]
end
end
--this.RefreshShow(true)
@ -140,7 +141,7 @@ function ChatPanel:BindEvent()
this.playerInfo:SetActive(false)
end)
Util.AddClick(this.btnNew, function ()
Util.AddClick(this.btnNew, function()
this.RefreshShow(true)
end)
@ -165,11 +166,10 @@ end
--界面打开时调用(用于子类重写)
function ChatPanel:OnOpen(...)
-- 参数保存
local args = {...}
local args = { ... }
this.jumpType = args[2] or 1
this.curTabIndex = args[1] or 4
this.curChannel = _TabData[this.curTabIndex].channel
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
@ -280,6 +280,7 @@ function this.TabIsLockCheck(index)
end
return false
end
-- 节点状态改变回调事件
function this.OnTabChange(index, lastIndex)
-- 关闭上个界面
@ -298,7 +299,7 @@ function this.OnTabChange(index, lastIndex)
-- 是否能够发言
this.curChannel = _TabData[index].channel
if this.curChannel == 1 or this.curChannel == 2 then
if this.curChannel == 1 or this.curChannel == 2 then
ChatPanel:SetInputPosition(1)
elseif this.curChannel == 16 then
ChatPanel:SetInputPosition(2)
@ -307,36 +308,46 @@ function this.OnTabChange(index, lastIndex)
end
if this.curChannel == 1 or this.curChannel == 2 or this.curChannel == 16 then
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.CHAT) then
this.input:SetActive(true)
this.chatImgBtn:SetActive(true)
this.noInputTip:SetActive(false)
if this.curChannel == 16 then
this.btncount:SetActive(true)
this.freeCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) > 0)
this.buyCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) <= 0)
if PrivilegeManager.GetPrivilegeRemainValue(91001)>0 then
this.freeCount:GetComponent("Text").text = string.format(GetLanguageStrById(10647),PrivilegeManager.GetPrivilegeRemainValue(91001))
else
local costItem = string.split(G_SpecialConfig[155].Value,"#")
this.buyCount:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(G_ItemConfig[tonumber(costItem[1])].ResourceID))
this.buyCountText:GetComponent("Text").text = "x"..costItem[2]
end
if this.curChannel == 1 and VipManager.GetChargedNum() < 30 then
this.chatImgBtn:SetActive(false)
this.chatImgBtn:SetActive(false)
this.input:SetActive(false)
this.noInputTip:SetActive(true)
this.noInputTip:GetComponent("Text").text = "充值30元可解锁发言"
else
this.btncount:SetActive(false)
this.input:SetActive(true)
this.chatImgBtn:SetActive(true)
this.noInputTip:SetActive(false)
if this.curChannel == 16 then
this.btncount:SetActive(true)
this.freeCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) > 0)
this.buyCount:SetActive(PrivilegeManager.GetPrivilegeRemainValue(91001) <= 0)
if PrivilegeManager.GetPrivilegeRemainValue(91001) > 0 then
this.freeCount:GetComponent("Text").text = string.format(GetLanguageStrById(10647),
PrivilegeManager.GetPrivilegeRemainValue(91001))
else
local costItem = string.split(G_SpecialConfig[155].Value, "#")
this.buyCount:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(G_ItemConfig
[tonumber(costItem[1])].ResourceID))
this.buyCountText:GetComponent("Text").text = "x" .. costItem[2]
end
else
this.btncount:SetActive(false)
end
end
else
this.chatImgBtn:SetActive(false)
this.chatImgBtn:SetActive(false)
this.input:SetActive(false)
this.noInputTip:SetActive(true)
local dataLv = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,2024).Value)
this.noInputTip:GetComponent("Text").text = string.format(GetLanguageStrById(10387),dataLv)
local dataLv = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 2024).Value)
this.noInputTip:GetComponent("Text").text = string.format(GetLanguageStrById(10387), dataLv)
end
elseif this.curChannel == 0 or this.curChannel == 3 then
this.chatImgBtn:SetActive(false)
this.input:SetActive(false)
this.chatImgBtn:SetActive(false)
this.noInputTip:SetActive(true)
this.noInputTip:SetActive(true)
this.noInputTip:GetComponent("Text").text = GetLanguageStrById(10406)
end
-- 刷新显示
@ -354,20 +365,19 @@ function ChatPanel:SetScrollItem(go, data, index)
-- local desc = Util.GetGameObject(go.gameObject, "desc"):GetComponent("Text")
img.sprite = Util.LoadSprite(data.ResourceName)
Util.AddOnceClick(go.gameObject, function()
this.inputText.text = this.inputText.text..data.Esc
this.inputText.text = this.inputText.text .. data.Esc
end)
end
-- 数据变化回调
function this.RefreshBottomShow()
local data = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,2015).Value)
local dataLv = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,2024).Value)
local data = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 2015).Value)
local dataLv = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 2024).Value)
if data == 0 then
this.bottomTip:SetActive(false)
elseif data > 0 then
this.bottomTip:SetActive(true)
local str = FirstRechargeManager.GetAccumRechargeValue().."/"..data
local str = FirstRechargeManager.GetAccumRechargeValue() .. "/" .. data
if FirstRechargeManager.GetAccumRechargeValue() >= data then
str = string.format("<color=#32e17c>%s</color>", str)
if PlayerManager.level >= dataLv then
@ -377,7 +387,7 @@ function this.RefreshBottomShow()
str = string.format("<color=#bd3937>%s</color>", str)
end
this.tips_1.text = string.format(GetLanguageStrById(50409),dataLv,str)
this.tips_1.text = string.format(GetLanguageStrById(50409), dataLv, str)
this.tips_2.text = GetLanguageStrById(50410)
end
end
@ -398,7 +408,7 @@ function this.RefreshShow(isForceBottom)
if this.curChannel ~= CHAT_CHANNEL.FRIEND then
GoToIndex = #datalist
end
curSV:SetData(datalist, function(dataIndex, go)
-- 判断是否要显示聊天的时间
local isShowTime = false
@ -415,12 +425,12 @@ function this.RefreshShow(isForceBottom)
this.ChatItemAdapter(go, data, false, false, true)
elseif this.curChannel == CHAT_CHANNEL.SYSTEM then
this.SystemItemAdapter(go, data, isShowTime)
-- elseif this.curChannel == CHAT_CHANNEL.CrossRealm then
-- this.CrossRealmChatItemAdapter(go, data, isShowTime)
-- elseif this.curChannel == CHAT_CHANNEL.CrossRealm then
-- this.CrossRealmChatItemAdapter(go, data, isShowTime)
else
this.ChatItemAdapter(go, data, isShowTime, this.curChannel == CHAT_CHANNEL.CrossRealm)
end
end)--, _GoToIndex)
end) --, _GoToIndex)
if isForceBottom and GoToIndex then
@ -442,18 +452,17 @@ function this.GetScrollView(index)
if not this.FriendScrollView 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)
this.chatItem, Vector2.New(1080, rootHight - 10), 1, 10)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
this.FriendScrollView = sv
end
return this.FriendScrollView
elseif index == 2 then
if not this.GongHuiScrollView 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)
this.chatItem, Vector2.New(1080, rootHight - 10), 1, 10)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
this.GongHuiScrollView = sv
@ -463,7 +472,7 @@ function this.GetScrollView(index)
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)
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
@ -473,7 +482,7 @@ function this.GetScrollView(index)
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(980, rootHight - 10), 1, 20)
this.systemItem, Vector2.New(980, rootHight - 10), 1, 20)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
this.SystemScrollView = sv
@ -483,7 +492,7 @@ function this.GetScrollView(index)
if not this.CrossRealmScrollView 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)
this.chatItem, Vector2.New(1080, rootHight - 10), 1, 10)
sv.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, -5)
sv.moveTween.Strength = 2
this.CrossRealmScrollView = sv
@ -503,17 +512,17 @@ function this.SystemItemAdapter(node, data, isShowTime)
isShowTime = false
time:SetActive(isShowTime)
if isShowTime then
time:GetComponent("Text").text = TimeStampToDateStr(tonumber(data.times)/1000)
time:GetComponent("Text").text = TimeStampToDateStr(tonumber(data.times) / 1000)
end
local sTypeInfo = ChatManager.SYS_MSG_TYPE[data.messageType]
if sTypeInfo then
this.SetActive(sType,true)
this.SetActive(sType, true)
sTypeStr.text = sTypeInfo.name
content.text = GetMailConfigDesc(data.msg,data.chatparms)
content.text = GetMailConfigDesc(data.msg, data.chatparms)
else
this.SetActive(sType,false)
content.text = GetMailConfigDesc(data.msg,data.chatparms)
this.SetActive(sType, false)
content.text = GetMailConfigDesc(data.msg, data.chatparms)
end
Util.AddOnceClick(bg, function()
@ -524,8 +533,9 @@ function this.SystemItemAdapter(node, data, isShowTime)
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])
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,heroConfigData.Id,itemConfig[data.itemId].HeroStar[2])
local heroConfigData = ConfigManager.GetConfigData(ConfigName.HeroConfig, itemConfig[data.itemId].HeroStar
[1])
UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, heroConfigData.Id, itemConfig[data.itemId].HeroStar[2])
elseif itemDataConFig.ItemType == ItemType.Equip then
UIManager.OpenPanel(UIName.HandBookEquipInfoPanel, data.itemId)
else
@ -556,9 +566,9 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
local name = Util.GetGameObject(node, "contentroot/bg/info/name/name"):GetComponent("Text")
local zw = Util.GetGameObject(node, "contentroot/bg/info/pos")
local zwName = Util.GetGameObject(node, "contentroot/bg/info/pos/pos/Text"):GetComponent("Text")
local CH = Util.GetGameObject(node, "contentroot/bg/info/title/title"):GetComponent("Image")
local CH = Util.GetGameObject(node, "contentroot/bg/info/title/title"):GetComponent("Image")
local CHEffect = Util.GetGameObject(node, "contentroot/bg/info/title/title/Image"):GetComponent("Image")
local CHison = Util.GetGameObject(node, "contentroot/bg/info/title")
local CHison = Util.GetGameObject(node, "contentroot/bg/info/title")
local vip = Util.GetGameObject(node, "base/vip"):GetComponent("Image")
-- 判断是否显示时间
-- time:SetActive(isShowTime)
@ -586,13 +596,13 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
-- PopupTipPanel.ShowTip("公会战期间无法加入公会")
-- return
--end
MsgPanel.ShowTwo(string.format(GetLanguageStrById(10409), chat.gName),nil, function()
MsgPanel.ShowTwo(string.format(GetLanguageStrById(10409), chat.gName), nil, function()
if PlayerManager.level < chat.gLimitLv then
PopupTipPanel.ShowTipByLanguageId(10410)
return
end
if chat.joinType == GUILD_JOIN_TYPE.NO_LIMIT then
GuildManager.RequestJoinGuild(chat.gId, function ()
GuildManager.RequestJoinGuild(chat.gId, function()
-- -- 关闭当前界面
-- if this._JumpType == 1 then
-- this:ClosePanel()
@ -605,17 +615,15 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
PopupTipPanel.ShowTipByLanguageId(10411)
end)
elseif chat.joinType == GUILD_JOIN_TYPE.LIMIT then
GuildManager.RequestApplyManyGuilds({chat.gId}, function()
GuildManager.RequestApplyManyGuilds({ chat.gId }, function()
PopupTipPanel.ShowTipByLanguageId(10412)
end)
elseif chat.joinType == GUILD_JOIN_TYPE.FORBID then
PopupTipPanel.ShowTipByLanguageId(10413)
end
end)
end)
end
elseif this.curChannel == CHAT_CHANNEL.FAMILY then
local chat = ChatManager.AnalysisGlobalChat(data.msg)
contentStr = chat.content
@ -650,7 +658,7 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
CHison:SetActive(false)
vip.gameObject:SetActive(false)
local fdata = GoodFriendManager.GetFriendInfo(data.friendId)
name.text = fdata.name.."[Lv."..fdata.lv.."]"
name.text = fdata.name .. "[Lv." .. fdata.lv .. "]"
head.sprite = GetPlayerHeadSprite(fdata.head)
headKuang.sprite = GetPlayerHeadFrameSprite(fdata.frame)
-- redpot:SetActive(FriendChatManager.IsFriendNewChat(data.friendId))
@ -662,7 +670,8 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
if data.senderId == PlayerManager.uid then
-- lv.text = "Lv." .. PlayerManager.level
if isShowServerName then
name.text = PlayerManager.nickName .. "[Lv." .. PlayerManager.level .. "]" .. "<color='#9fff88'> [" .. data.serverName .. "]</color>"
name.text = PlayerManager.nickName ..
"[Lv." .. PlayerManager.level .. "]" .. "<color='#9fff88'> [" .. data.serverName .. "]</color>"
else
name.text = PlayerManager.nickName .. "[Lv." .. PlayerManager.level .. "]"
end
@ -678,7 +687,7 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
else
vip.gameObject:SetActive(false)
end
if PlayerManager.designation > 0 then
CHison:SetActive(true)
CH.sprite = this.GetTitleIcon(PlayerManager.designation)
@ -692,7 +701,8 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
else
-- lv.text = "Lv." .. data.senderlevel
if isShowServerName then
name.text = data.senderName .. "[Lv." .. data.senderlevel .. "]" .. "<color='#9fff88'> [" .. data.serverName .. "]</color>"
name.text = data.senderName ..
"[Lv." .. data.senderlevel .. "]" .. "<color='#9fff88'> [" .. data.serverName .. "]</color>"
else
name.text = data.senderName .. "[Lv." .. data.senderlevel .. "]"
end
@ -719,7 +729,7 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
CHison:SetActive(false)
end
end
-- 头像添加点击事件
Util.AddOnceClick(head.gameObject, function()
if this.curChannel == CHAT_CHANNEL.CrossRealm then
@ -728,13 +738,13 @@ function this.ChatItemAdapter(node, data, isShowTime, isShowServerName, isFriend
-- 自己不做任何操作
if data.senderId ~= PlayerManager.uid then
this.playerFriend:SetActive(true)
for i,v in pairs(GoodFriendManager.friendAllData) do
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)
UIManager.OpenPanel(UIName.PlayerInfoPopup,data.senderId)
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.senderId)
end
end)
end
@ -765,7 +775,7 @@ end
--显示玩家信息
function this.ShowPlayerInfo(node, data)
-- 显示
this.SetActive(this.playerInfo,true)
this.SetActive(this.playerInfo, true)
-- 设置位置
local v2 = RectTransformUtility.WorldToScreenPoint(UIManager.camera, node.transform.position)
this.playerBg.transform.localPosition = Vector3(v2.x + 200, v2.y, 0)
@ -785,7 +795,7 @@ function this.ShowPlayerInfo(node, data)
Util.AddOnceClick(this.playerFriend, function()
GoodFriendManager.InviteFriendRequest(data.senderId, function()
PopupTipPanel.ShowTip(GetLanguageStrById(10415))
this.SetActive(this.playerInfo,false)
this.SetActive(this.playerInfo, false)
end)
end)
end
@ -798,13 +808,13 @@ function this.MoveTip()
local finalPos = 1080 + tipRect.rect.width
DoTween.To(DG.Tweening.Core.DOGetter_int(function()
return 0
end),
DG.Tweening.Core.DOSetter_int(function(progress)
tipRect.anchoredPosition3D = Vector3.New(0 - progress, 0, 0)
end),
finalPos,
finalPos/100):SetEase(Ease.Linear):OnComplete(function()
return 0
end),
DG.Tweening.Core.DOSetter_int(function(progress)
tipRect.anchoredPosition3D = Vector3.New(0 - progress, 0, 0)
end),
finalPos,
finalPos / 100):SetEase(Ease.Linear):OnComplete(function()
this.SetActive(this.tip, false)
end)
end
@ -828,4 +838,4 @@ function this:SetInputPosition(type)
end
end
return ChatPanel
return ChatPanel