1585 lines
54 KiB
Lua
1585 lines
54 KiB
Lua
local UIChatView = require("UIChat/UIChatView_Generate")
|
||
local UIChatRoot = require("UIChat/UIChatRoot")
|
||
local IconItemCtr = require("Common/IconItemCtr")
|
||
|
||
local regexPattern = "%[e%d+%]"
|
||
local emojiFormat = "[e%s]"
|
||
|
||
local BottomTabType = {
|
||
MessageTab = 1,
|
||
SearchTab = 2,
|
||
MeTab = 3
|
||
}
|
||
local ChatType = {
|
||
Private = 1,
|
||
Group = 2,
|
||
Mail = 3,
|
||
}
|
||
|
||
local BottonTabNames = {
|
||
[BottomTabType.MessageTab] = "消息",
|
||
[BottomTabType.SearchTab] = "发现",
|
||
[BottomTabType.MeTab] = "通讯录",
|
||
}
|
||
|
||
local CONST_CHANNEL_WORLD = "10000"
|
||
local CONST_CHANNEL_GUILD = "10001"
|
||
local CONST_CHANNEL_MAIL = "10002"
|
||
local CONST_CHANNEL_STORY = "20000"
|
||
local CONST_CHANNEL_STORY_AI = "30000"
|
||
|
||
local CONST_TOGGLE_EMOJI = 1
|
||
local CONST_TOGGLE_GIFT = 2
|
||
local CONST_TOGGLE_STORY = 3
|
||
local CONST_TOGGLE_DATE = 4
|
||
local CONST_TOGGLE_PHOTO = 5
|
||
|
||
local CONST_TITLE_HEIGHT = 150
|
||
local CONST_INPUT_BAR_HEIGHT = 270
|
||
local CONST_INPUT_WINDOW_HEIGHT = 730
|
||
|
||
local currInputToolBarToggleType = 0
|
||
|
||
local uIChatRootWorld
|
||
function UIChatView:OnAwake(data)
|
||
self.controller = require("UIChat/UIChatCtr")
|
||
self.controller:Init(self)
|
||
self.controller:SetData(data)
|
||
|
||
-- local itemDatasSource = ManagerContainer.DataMgr.BagData:GetAllItemDatas()
|
||
-- LogError(Inspect(itemDatasSource))
|
||
end
|
||
|
||
function UIChatView:AddEventListener()
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.REFRESH_WOLRD_CHAT, function(channelType)
|
||
local channelId = CONST_CHANNEL_WORLD
|
||
if channelType == Enum.ChatChannel.World then
|
||
channelId = CONST_CHANNEL_WORLD
|
||
elseif channelType == Enum.ChatChannel.Guild then
|
||
channelId = CONST_CHANNEL_GUILD
|
||
end
|
||
self:RefreshMessageTab()
|
||
self:RefreshChatLayer2(channelId)
|
||
end)
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.REFRESH_PRIVATE_CHAT, function(idx, uid)
|
||
local channelId = uid
|
||
self:RefreshMessageTab()
|
||
self:RefreshChatLayer2(channelId)
|
||
end)
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_CHAT_STORY_REWARD, function(story_rewards)
|
||
local rewards = {}
|
||
for k, v in pairs(story_rewards) do
|
||
table.insert(rewards,{cfgId = v.key, num = v.value})
|
||
end
|
||
ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIPOPGot, {rewards = rewards})
|
||
self:RefreshChatLayer2(self.currChatChannelId, self.currStoryData)
|
||
end)
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_CHAT_STORY_ADD_HEART_NTF, function(storyNpcId, heart, addHeart)
|
||
LogError("[EID_CHAT_STORY_ADD_HEART_NTF] storyNpcId="..storyNpcId.." heart="..heart.." addHeart="..addHeart)
|
||
self:PlayAddHeartAnimation(storyNpcId, heart, addHeart)
|
||
end)
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_CHAT_STORY_DATE_REWARD, function(story_rewards)
|
||
self:RefreshChatLayer2(self.currChatChannelId, self.currStoryData)
|
||
end)
|
||
end
|
||
|
||
function UIChatView:FillContent(data, uiBase)
|
||
self.pageToggleData = {}
|
||
self.uiBase = uiBase
|
||
local gameObject = self.uiBase:GetRoot()
|
||
if gameObject ~= nil then
|
||
self.gameObject = gameObject
|
||
self.transform = gameObject.transform
|
||
end
|
||
self:InitGenerate(self.transform, data)
|
||
|
||
self:OnceInit()
|
||
self:Init()
|
||
end
|
||
|
||
function UIChatView:OnceInit()
|
||
self:InitEmojiPanel()
|
||
self:InitGiftWindow()
|
||
self:InitDateWindow()
|
||
self:InitPhotoWindow()
|
||
end
|
||
|
||
function UIChatView:Init()
|
||
local channel = ManagerContainer.DataMgr.ChatData:GetChatChannelType()
|
||
-- if uIChatRootWorld == nil then
|
||
-- uIChatRootWorld = UIChatRoot:new()
|
||
-- uIChatRootWorld:Init(self,channel, self.chatWindow, self.chatInputField1)
|
||
-- end
|
||
self:SetToggleGroupStatus(channel)
|
||
self:OnChannelChange(nil, channel, true)
|
||
self.uiBase:AddButtonUniqueEventListener(self.chatLayer2.titleBarReturnBtn.button, self, self.Layer2_OnClickReturnBtn)
|
||
self.uiBase:AddButtonUniqueEventListener(self.chatLayer2.AnyBtn.button, self, self.OnChatLayer2AnyBtn)
|
||
self.uiBase:AddButtonUniqueEventListener(self.chatLayer2.btnSend.button, self, self.OnChatLayer2BtnSend)
|
||
self.uiBase:AddButtonUniqueEventListener(self.chatLayer2.storyInputTip.button, self, self.OnChatLayer2StoryInputTip)
|
||
|
||
self.currChatChannelId = "0"
|
||
self.tabViews = {
|
||
[BottomTabType.MessageTab] = self.chatTab,
|
||
[BottomTabType.SearchTab] = self.searchTab,
|
||
[BottomTabType.MeTab] = self.meTab
|
||
}
|
||
local openTab = self.controller:GetOpenTab()
|
||
self:RefreshTable(openTab)
|
||
|
||
self.InputBarWindows = {
|
||
[CONST_TOGGLE_EMOJI] = self.chatLayer2.emojiWindow,
|
||
[CONST_TOGGLE_GIFT] = self.chatLayer2.giftWindow,
|
||
[CONST_TOGGLE_STORY] = self.chatLayer2.storyWindow,
|
||
[CONST_TOGGLE_DATE] = self.chatLayer2.dateWindow,
|
||
[CONST_TOGGLE_PHOTO] = self.chatLayer2.photoWindow
|
||
}
|
||
|
||
self.InputBarToggles = {
|
||
[CONST_TOGGLE_EMOJI] = self.chatLayer2.emojiToggle,
|
||
[CONST_TOGGLE_GIFT] = self.chatLayer2.giftToggle,
|
||
[CONST_TOGGLE_STORY] = self.chatLayer2.storyToggle,
|
||
[CONST_TOGGLE_DATE] = self.chatLayer2.dateToggle,
|
||
[CONST_TOGGLE_PHOTO] = self.chatLayer2.photoToggle
|
||
}
|
||
|
||
-- local subType = self.controller:CheckChatSubType("[gift-2]")
|
||
-- LogError("[gift-2], "..tostring(subType))
|
||
if self.controller:IsOpenStoryMode() then
|
||
-- TODO: 这里使用storyData的channelId
|
||
local channelId = CONST_CHANNEL_STORY
|
||
local storyData = self.controller:GetOpenStoryData()
|
||
self:EnterChatLayer2(channelId, storyData)
|
||
end
|
||
end
|
||
|
||
function UIChatView:OnChatLayer2StoryInputTip()
|
||
LogError("UIChatView:OnChatLayer2StoryInputTip")
|
||
if self.currChatChannelId == CONST_CHANNEL_STORY_AI then
|
||
self.chatLayer2.AnyBtn:SetActive(true)
|
||
local inputTipData = self.controller:GetAIStoryInputTipData()
|
||
self:ShowStoryMenuWindow(inputTipData)
|
||
else
|
||
if self.currStoryChatInputOptions then
|
||
self.chatLayer2.storyInputTip.button.interactable = false
|
||
self:ShowStoryMenuWindow(self.currStoryChatInputOptions)
|
||
self.currStoryChatInputOptions = nil
|
||
end
|
||
end
|
||
end
|
||
|
||
function UIChatView:OnChatLayer2BtnSend()
|
||
if self.chatLayer2.inputField.tMP_InputField.text == "" then return end
|
||
local contentStr = self.chatLayer2.inputField.tMP_InputField.text
|
||
self.chatLayer2.inputField.tMP_InputField.text = ""
|
||
local subType = self.controller:CheckChatSubType(contentStr)
|
||
--LogError("UIChatView-OnChatLayer2BtnSend: "..contentStr..", "..subType)
|
||
self:CloseAllInputToolBarToggles()
|
||
if self.currChatChannelId == CONST_CHANNEL_STORY_AI then
|
||
if self.sendStoryId and self.sendStoryId ~= 0 then
|
||
self.controller:AIChatSend(self.sendStoryId, self.sendPerformStoryCfgId,
|
||
function(chatContent)
|
||
self:RefreshChatLayer2(CONST_CHANNEL_STORY_AI, self.aiStoryData)
|
||
end,
|
||
function()
|
||
LogError("Finish!!!")
|
||
end
|
||
)
|
||
end
|
||
elseif self.currChatChannelId == CONST_CHANNEL_STORY then
|
||
if self.sendStoryId and self.sendStoryId ~= 0 then
|
||
self.controller:SendStoryChat(self.sendStoryId, self.sendPerformStoryCfgId)
|
||
self.sendStoryId = 0
|
||
self.sendPerformStoryCfgId = 0
|
||
end
|
||
else
|
||
local chatDataType = Enum.ChatDataType.Private
|
||
if self.currChatChannelId == CONST_CHANNEL_WORLD then
|
||
chatDataType = Enum.ChatDataType.World
|
||
elseif self.currChatChannelId == CONST_CHANNEL_GUILD then
|
||
chatDataType = Enum.ChatDataType.Guild
|
||
end
|
||
self.controller:SendChatReq(contentStr, chatDataType, subType)
|
||
end
|
||
-- self.delaySendFrameTimer = FrameTimer.New(function()
|
||
-- self:CloseAllInputToolBarToggles()
|
||
-- end, 60)
|
||
-- self.delaySendFrameTimer:Start()
|
||
end
|
||
|
||
function UIChatView:OnChatLayer2AnyBtn()
|
||
self:CloseAllInputToolBarToggles()
|
||
end
|
||
|
||
function UIChatView:InitEmojiPanel()
|
||
local emojis = ManagerContainer.CfgMgr:GetEmojiCfg()
|
||
CommonUtil.LoopGridViewEleCreateNoItem(self,
|
||
self.chatLayer2.emojiWindow.loopVerticalScrollRect,
|
||
emojis, 0, self,
|
||
function (owner, go, idx, logicData)
|
||
local textTrans = go.transform:Find("Text")
|
||
local text = textTrans:GetComponent(Enum.TypeInfo.SymbolText)
|
||
local index = idx
|
||
if idx < 10 then
|
||
index = "0"..idx
|
||
end
|
||
text.text = string.format(emojiFormat, index)
|
||
local uiTrigger = textTrans:GetComponent(Enum.TypeInfo.UIEventTriggerListener)
|
||
uiTrigger.onClick = function()
|
||
self:OnEmojiClick(idx)
|
||
end
|
||
|
||
uiTrigger.onBeginDrag = function()
|
||
self.chatLayer2.emojiWindow.loopVerticalScrollRect:OnBeginDrag(UIEventTriggerListener.currentEventData)
|
||
end
|
||
|
||
uiTrigger.onDrag = function()
|
||
self.chatLayer2.emojiWindow.loopVerticalScrollRect:OnDrag(UIEventTriggerListener.currentEventData)
|
||
end
|
||
|
||
uiTrigger.onEndDrag = function()
|
||
self.chatLayer2.emojiWindow.loopVerticalScrollRect:OnEndDrag(UIEventTriggerListener.currentEventData)
|
||
end
|
||
end)
|
||
end
|
||
|
||
function UIChatView:InitGiftWindow()
|
||
local gifts = ManagerContainer.CfgMgr:GetStoryItemCfg()
|
||
CommonUtil.LoopGridViewEleCreateNoItem(
|
||
self, self.chatLayer2.giftWindow.loopVerticalScrollRect, gifts, 0, self,
|
||
function (owner, go, idx, logicData)
|
||
-- local iconPath = logicData['Icon']
|
||
-- local name = logicData['Name']
|
||
-- local id = logicData['Id']
|
||
-- local uiTrigger = go:GetComponent(Enum.TypeInfo.UIEventTriggerListener)
|
||
-- uiTrigger.onClick = function() self:OnSendItem(id) end
|
||
-- local iconImage = go.transform:Find("Icon"):GetComponent(Enum.TypeInfo.Image)
|
||
-- local title = go.transform:Find("Info/Title"):GetComponent(Enum.TypeInfo.TextMeshProUGUI)
|
||
-- title.text = name
|
||
-- CommonUtil.LoadIcon(self, iconPath, function(sprite)
|
||
-- iconImage.sprite = sprite
|
||
-- end)
|
||
|
||
local id = logicData['Id']
|
||
local itemId = logicData['ItemId']
|
||
local itemNum = ManagerContainer.DataMgr.BagData:GetItemCountByCfgId(itemId)
|
||
local data = {cfgId = itemId, num = itemNum}
|
||
local itemLua = CommonUtil.BindGridViewItem2Lua(self, "IconItem", go)
|
||
IconItemCtr:SetData(self, itemLua, data, Enum.ItemIEnterType.Bag, self, function() self:OnSendItem(id) end)
|
||
end
|
||
)
|
||
end
|
||
|
||
function UIChatView:ShowStoryMenuWindow(storyOptionDatas)
|
||
local storyDatas = CommonUtil.TableClone(storyOptionDatas)
|
||
if not storyDatas or #storyDatas == 0 then return end
|
||
self.chatLayer2.inputToolBar:SetActive(true)
|
||
self.chatLayer2.storyWindow:SetActive(true)
|
||
|
||
local width = self.chatLayer2.storyWindow.rectTransform.sizeDelta.x
|
||
local height = 0
|
||
if #storyDatas == 1 then
|
||
height = 200
|
||
elseif #storyDatas == 2 then
|
||
height = 345
|
||
elseif #storyDatas == 3 then
|
||
height = 480
|
||
end
|
||
self.chatLayer2.storyWindow.rectTransform.sizeDelta = Vector2(width, height)
|
||
self.chatLayer2.storyWindow.loopVerticalScrollRect:ClearCells()
|
||
CommonUtil.LoopGridViewEleCreateNoItem(
|
||
self, self.chatLayer2.storyWindow.loopVerticalScrollRect,
|
||
storyDatas, 0, self,
|
||
function (owner, go, idx, logicData)
|
||
local txtTrans = go.transform:Find("Txt")
|
||
local txt = txtTrans:GetComponent(Enum.TypeInfo.TextMeshProUGUI)
|
||
txt.text = logicData.optionText
|
||
local uiTrigger = go:GetComponent(Enum.TypeInfo.UIEventTriggerListener)
|
||
uiTrigger.onClick = function() self:OnStoryClick(logicData.storyId, logicData.performStoryCfgId, logicData.optionText) end
|
||
end
|
||
)
|
||
end
|
||
|
||
function UIChatView:HideStoryMenuWindow()
|
||
self.chatLayer2.inputToolBar:SetActive(false)
|
||
self.chatLayer2.storyWindow:SetActive(false)
|
||
end
|
||
|
||
function UIChatView:InitDateWindow()
|
||
local dates = ManagerContainer.CfgMgr:GetChatDateCfg()
|
||
CommonUtil.LoopGridViewEleCreateNoItem(
|
||
self, self.chatLayer2.dateWindow.loopVerticalScrollRect,
|
||
dates, 0, self,
|
||
function (owner, go, idx, logicData)
|
||
local iconPath = logicData['Icon']
|
||
local name = logicData['Name']
|
||
local id = logicData['Id']
|
||
local uiTrigger = go:GetComponent(Enum.TypeInfo.UIEventTriggerListener)
|
||
uiTrigger.onClick = function() self:OnDateClick(id) end
|
||
local iconImage = go.transform:Find("Icon"):GetComponent(Enum.TypeInfo.Image)
|
||
local title = go.transform:Find("Info/Title"):GetComponent(Enum.TypeInfo.TextMeshProUGUI)
|
||
title.text = name
|
||
CommonUtil.LoadIcon(self, iconPath, function(sprite)
|
||
iconImage.sprite = sprite
|
||
end)
|
||
end
|
||
)
|
||
end
|
||
|
||
|
||
function UIChatView:InitPhotoWindow()
|
||
local photos = ManagerContainer.CfgMgr:GetChatPhotoCfg()
|
||
CommonUtil.LoopGridViewEleCreateNoItem(
|
||
self, self.chatLayer2.photoWindow.loopVerticalScrollRect,
|
||
photos, 0, self,
|
||
function (owner, go, idx, logicData)
|
||
local iconPath = logicData['Icon']
|
||
local name = logicData['Name']
|
||
local id = logicData['Id']
|
||
local uiTrigger = go:GetComponent(Enum.TypeInfo.UIEventTriggerListener)
|
||
uiTrigger.onClick = function() self:OnPhotoClick(id) end
|
||
local iconImage = go.transform:Find("Icon"):GetComponent(Enum.TypeInfo.Image)
|
||
local title = go.transform:Find("Info/Title"):GetComponent(Enum.TypeInfo.TextMeshProUGUI)
|
||
title.text = name
|
||
CommonUtil.LoadIcon(self, iconPath, function(sprite)
|
||
iconImage.sprite = sprite
|
||
end)
|
||
end
|
||
)
|
||
end
|
||
|
||
function UIChatView:OnPhotoClick(photoId)
|
||
--LogError("OnPhotoClick: "..photoId)
|
||
local format = "[photo-%s]"
|
||
self.chatLayer2.inputField.tMP_InputField.text = string.format(format, photoId)
|
||
--self:CloseAllInputToolBarToggles()
|
||
end
|
||
|
||
function UIChatView:OnStoryClick(storyId, performStoryCfgId, optionText)
|
||
LogError("OnStoryClick: "..storyId..", "..performStoryCfgId)
|
||
self.chatLayer2.inputField.tMP_InputField.text = optionText
|
||
self:CloseAllInputToolBarToggles()
|
||
self.sendStoryId = storyId
|
||
self.sendPerformStoryCfgId = performStoryCfgId
|
||
|
||
--TODO: 如果剧情自动发送,就打开这个注释
|
||
--self:OnChatLayer2BtnSend()
|
||
end
|
||
|
||
function UIChatView:OnSendItem(storyItemId)
|
||
--LogError("OnSendItem: "..giftId)
|
||
--local format = "[gift-%s]"
|
||
--self.chatLayer2.inputField.tMP_InputField.text = string.format(format, giftId)
|
||
-- TODO: storyItemId 和 itemId 应该有一张映射表
|
||
self:CloseAllInputToolBarToggles()
|
||
local storyItemCfg = ManagerContainer.CfgMgr:GetStoryItemCfgById(storyItemId)
|
||
local costItemId = storyItemCfg.ItemId
|
||
local costItemNum = storyItemCfg.ItemNum
|
||
self:SetCurrStorySendItem(costItemId, costItemNum)
|
||
self.controller:AIChatSendItem(tonumber(storyItemId),
|
||
function(aiChatId, chatContent)
|
||
local chatType = self.controller:CheckChatSubType(chatContent)
|
||
-- TODO: 根据礼物ID,去服务器领取奖励
|
||
if chatType == Enum.ChatSubType.Gift then
|
||
local rewardId = tonumber(chatContent:match("%[giftRewardId%-(%d+)%]"))
|
||
ManagerContainer.DataMgr.StoryData:SetSendItemRewardStatus(aiChatId, 0)
|
||
elseif chatType == Enum.ChatSubType.Heart then
|
||
-- 向服务器请求加好感度:(npcId, itemId, rewardId),服务器扣除物品,并奖励好感度
|
||
-- 把原先不再需要的物品修改用途为:StoryGift送来送去,关卡奖励也奖励这个
|
||
local storyItemId,itemNum = self:GetCurrStorySendItem()
|
||
local rewardId = tonumber(chatContent:match("%[heartRewardId%-(%d+)%]"))
|
||
ManagerContainer.DataMgr.StoryData:GetSendItemReward(storyItemId, itemNum, rewardId)
|
||
elseif chatType == Enum.ChatSubType.Date then
|
||
end
|
||
self:RefreshChatLayer2(CONST_CHANNEL_STORY_AI, self.aiStoryData)
|
||
end,
|
||
function() end
|
||
)
|
||
end
|
||
|
||
function UIChatView:OnDateClick(dateId)
|
||
--LogError("OnSendItem: "..dateId)
|
||
local format = "[date-%s]"
|
||
self.chatLayer2.inputField.tMP_InputField.text = string.format(format, dateId)
|
||
--self:CloseAllInputToolBarToggles()
|
||
end
|
||
|
||
function UIChatView:OnEmojiClick(idx)
|
||
local count = 0
|
||
for k, v in string.gmatch(self.chatLayer2.inputField.tMP_InputField.text, regexPattern) do
|
||
count = count + 1
|
||
end
|
||
if count >= 5 then
|
||
ManagerContainer.LuaUIMgr:ErrorNoticeDisplay("ChatError2")
|
||
return
|
||
end
|
||
|
||
if idx < 10 then
|
||
idx = "0"..idx
|
||
end
|
||
self.chatLayer2.inputField.tMP_InputField.text = self.chatLayer2.inputField.tMP_InputField.text..string.format(emojiFormat, idx)
|
||
self:OnEmojiBgClick()
|
||
|
||
--self:CloseAllInputToolBarToggles()
|
||
end
|
||
|
||
function UIChatView:ResetInputField()
|
||
self.chatLayer2.inputField.tMP_InputField.text = ""
|
||
end
|
||
|
||
function UIChatView:OnChannelChange(toggle, chatType, isOn)
|
||
if not isOn then return end
|
||
if self:IsSomeFrameCount('ChatChannelToggle') then
|
||
return
|
||
end
|
||
ManagerContainer.DataMgr.ChatData:SetChatChannelType(chatType)
|
||
end
|
||
|
||
function UIChatView:RemoveEventListener()
|
||
ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
|
||
|
||
end
|
||
|
||
function UIChatView:OnBtnClose(button, params)
|
||
if self.chatLayer2.emojiWindow.activeSelf then
|
||
self:OnEmojiBgClick()
|
||
return
|
||
end
|
||
self:UIClose()
|
||
end
|
||
|
||
function UIChatView:OnEmojiBgClick(button, params)
|
||
self.chatLayer2.emojiWindow:SetActive(not self.chatLayer2.emojiWindow.activeSelf)
|
||
end
|
||
|
||
function UIChatView:OnBottomTabChange2(toggle, tabType, isOn)
|
||
if isOn then
|
||
self:RefreshTable(tabType)
|
||
end
|
||
end
|
||
|
||
function UIChatView:OnBottomTabChange(tabType)
|
||
--LogError("OnBottomTabChange: "..tabType)
|
||
self:RefreshTable(tabType)
|
||
end
|
||
|
||
function UIChatView:RefreshTitleBarForTab(tabType)
|
||
if tabType == BottomTabType.MessageTab then
|
||
local str = BottonTabNames[tabType]
|
||
self.chatLayer0.titleBarText.text.text = str
|
||
elseif tabType == BottomTabType.SearchTab then
|
||
local str = BottonTabNames[tabType]
|
||
self.chatLayer0.titleBarText.text.text = str
|
||
elseif tabType == BottomTabType.MeTab then
|
||
local str = BottonTabNames[tabType]
|
||
self.chatLayer0.titleBarText.text.text = str
|
||
end
|
||
end
|
||
|
||
function UIChatView:RefreshTitleBarForChatLayer2(channelId)
|
||
end
|
||
|
||
function UIChatView:RefreshTable(tabType)
|
||
self.currTabType = tabType
|
||
for k, v in pairs(self.tabViews) do
|
||
v:SetActive(k == tabType)
|
||
end
|
||
self:RefreshTitleBarForTab(tabType)
|
||
if tabType == BottomTabType.MessageTab then
|
||
self:RefreshMessageTab()
|
||
elseif tabType == BottomTabType.SearchTab then
|
||
self:RefreshSearchTab()
|
||
elseif tabType == BottomTabType.MeTab then
|
||
self:RefreshMeTab()
|
||
end
|
||
end
|
||
|
||
--[[
|
||
1. worldChats:
|
||
[
|
||
{
|
||
"isSystem": true,
|
||
"nickname": "",
|
||
"paramIds": [
|
||
15,
|
||
0
|
||
],
|
||
"sendTime": "1753858800",
|
||
"sendTime64": "1753858800268",
|
||
"type": 6
|
||
},
|
||
{
|
||
"isSystem": true,
|
||
"nickname": "",
|
||
"paramIds": [
|
||
16,
|
||
0
|
||
],
|
||
"sendTime": "1753858800",
|
||
"sendTime64": "1753858800267",
|
||
"type": 6
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_500102",
|
||
"jobId": 50010,
|
||
"level": 79,
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"titleId": 0,
|
||
"uid": "7482229966215577633",
|
||
"vipLv": 19
|
||
},
|
||
"message": {
|
||
"message": "123",
|
||
"sendTime64": "1753757369925",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_500102",
|
||
"jobId": 50010,
|
||
"level": 79,
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"titleId": 0,
|
||
"uid": "7482229966215577633",
|
||
"vipLv": 19
|
||
},
|
||
"message": {
|
||
"message": "[e01]",
|
||
"sendTime64": "1753757637655",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_500102",
|
||
"jobId": 50010,
|
||
"level": 79,
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"titleId": 0,
|
||
"uid": "7482229966215577633",
|
||
"vipLv": 19
|
||
},
|
||
"message": {
|
||
"message": "[e02]",
|
||
"sendTime64": "1753760515287",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_500102",
|
||
"jobId": 50010,
|
||
"level": 79,
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"titleId": 0,
|
||
"uid": "7482229966215577633",
|
||
"vipLv": 19
|
||
},
|
||
"message": {
|
||
"message": "[e03]",
|
||
"sendTime64": "1753761406564",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_500102",
|
||
"jobId": 50010,
|
||
"level": 79,
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"titleId": 0,
|
||
"uid": "7482229966215577633",
|
||
"vipLv": 19
|
||
},
|
||
"message": {
|
||
"message": "13441111",
|
||
"sendTime64": "1753767151426",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
}
|
||
]
|
||
|
||
2. guildChats:
|
||
|
||
3. privateChats:
|
||
[
|
||
{
|
||
"chats": [
|
||
{
|
||
"fromData": {
|
||
"imgId": "Heads/head_500102",
|
||
"nickname": "丫咩爹",
|
||
"sex": 2,
|
||
"uid": "7482229966215577633"
|
||
},
|
||
"message": {
|
||
"message": "[e09]",
|
||
"sendTime64": "1743335693618",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 325,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 119,
|
||
"nickname": "寿",
|
||
"onlineState": false,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"message": {
|
||
"message": "111",
|
||
"sendTime64": "1744085032907",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 325,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 119,
|
||
"nickname": "寿",
|
||
"onlineState": false,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"message": {
|
||
"message": "1111",
|
||
"sendTime64": "1745292716759",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 325,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 119,
|
||
"nickname": "寿",
|
||
"onlineState": false,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"message": {
|
||
"message": "[e03]",
|
||
"sendTime64": "1747211047131",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 325,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 119,
|
||
"nickname": "寿",
|
||
"onlineState": false,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"message": {
|
||
"message": "你在吗?",
|
||
"sendTime64": "1747211561438",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
},
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 325,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 119,
|
||
"nickname": "寿",
|
||
"onlineState": false,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"message": {
|
||
"message": "[e09]",
|
||
"sendTime64": "1747361099991",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"type": 1
|
||
}
|
||
],
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_200212_pro",
|
||
"jobId": 20031,
|
||
"level": 120,
|
||
"nickname": "寿",
|
||
"onlineState": true,
|
||
"sex": 2,
|
||
"titleId": 611,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 25
|
||
},
|
||
"isNew": false
|
||
},
|
||
{
|
||
"chats": Array[1],
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_100001",
|
||
"jobId": 10000,
|
||
"level": 9,
|
||
"nickname": "",
|
||
"onlineState": false,
|
||
"sex": 1,
|
||
"uid": "7483067416118820897"
|
||
},
|
||
"isNew": false
|
||
}
|
||
]
|
||
]]
|
||
function UIChatView:RefreshMessageTab()
|
||
-- channelId-10000-世界,channelId-10001-工会,channelId-uid-私聊
|
||
local chatTabDataList = {}
|
||
|
||
-------------------------- 0. 邮箱 -----------------------------
|
||
table.insert(chatTabDataList, {
|
||
chatType = ChatType.Mail,
|
||
channelId = CONST_CHANNEL_MAIL,
|
||
title = I18N.T("邮箱"),
|
||
headIcons = {"PlayerHeads/player_head_mail"},
|
||
subTitle = I18N.T("打开看看,说不定有好东西"),
|
||
})
|
||
|
||
-------------------------- 1. 世界群聊 --------------------------
|
||
local worldChats = ManagerContainer.DataMgr.ChatData:GetWorldChatDatas()
|
||
local worldHeadIcons = {}
|
||
for k, v in pairs(worldChats) do
|
||
if v.type == Enum.ChatSystemType.Hero then
|
||
local headIconPath = "PlayerHeads/player_head_"..v.fromData.imgId
|
||
table.insert(worldHeadIcons, headIconPath)
|
||
end
|
||
if #worldHeadIcons >= 9 then break end
|
||
end
|
||
|
||
local worldTitle = "世界"
|
||
local worldSubTitle = "给世界发一条消息吧!"
|
||
if #worldHeadIcons > 0 and worldChats[#worldChats].fromData then
|
||
worldSubTitle = worldChats[#worldChats].fromData.nickname..": "..worldChats[#worldChats].message.message
|
||
else
|
||
worldHeadIcons = {"PlayerHeads/player_head_world"}
|
||
end
|
||
table.insert(chatTabDataList, {
|
||
chatType = ChatType.Group,
|
||
channelId = CONST_CHANNEL_WORLD,
|
||
title = worldTitle,
|
||
headIcons = worldHeadIcons,
|
||
subTitle = worldSubTitle
|
||
})
|
||
|
||
-------------------------- 2. 公会群聊 --------------------------
|
||
local guildChats = ManagerContainer.DataMgr.ChatData:GetGuildChatDatas()
|
||
local guildHeadIcons = {}
|
||
for k, v in pairs(guildChats) do
|
||
if v.type == Enum.ChatSystemType.Hero then
|
||
table.insert(guildHeadIcons, v.fromData.imgId)
|
||
end
|
||
if #guildHeadIcons >= 9 then break end
|
||
end
|
||
|
||
if #guildHeadIcons > 0 then
|
||
table.insert(chatTabDataList, {
|
||
chatType = ChatType.Group,
|
||
channelId = CONST_CHANNEL_GUILD,
|
||
title = "公会",
|
||
headIcons = guildHeadIcons,
|
||
subTitle = guildChats[#guildChats].fromData.nickname..": "..guildChats[#guildChats].message.message,
|
||
})
|
||
else
|
||
guildHeadIcons = {"PlayerHeads/player_head_gonghui"}
|
||
table.insert(chatTabDataList, {
|
||
chatType = ChatType.Group,
|
||
channelId = CONST_CHANNEL_GUILD,
|
||
title = "公会",
|
||
headIcons = guildHeadIcons,
|
||
subTitle = "",
|
||
})
|
||
end
|
||
|
||
-------------------------- 3. 剧情聊天 --------------------------
|
||
local storyChatDatas = self.controller:GetStoryChatDatasForMessageTab()
|
||
for i = 1, #storyChatDatas do
|
||
local storyCfg = storyChatDatas[i]
|
||
local firstStoryPerformCfg = ManagerContainer.CfgMgr:GetFirstStoryPerformCfg(storyCfg.StoryId)
|
||
LogError("firstStoryPerformCfg: "..Inspect(firstStoryPerformCfg))
|
||
local headImg, name
|
||
if firstStoryPerformCfg.SpeakSite == 1 then
|
||
headImg = firstStoryPerformCfg.LeftImg
|
||
name = firstStoryPerformCfg.LeftName
|
||
else
|
||
headImg = firstStoryPerformCfg.RightImg
|
||
name = firstStoryPerformCfg.RightName
|
||
end
|
||
local chatTabData = {
|
||
chatType = ChatType.Private,
|
||
channelId = CONST_CHANNEL_STORY,
|
||
title = I18N.T(name),
|
||
headIcons = {headImg},
|
||
subTitle = I18N.T(firstStoryPerformCfg.SpeakId),
|
||
storyCfg = storyCfg
|
||
}
|
||
table.insert(chatTabDataList, chatTabData)
|
||
end
|
||
|
||
-------------------------- 4. 好友私聊 --------------------------
|
||
local privateChats = ManagerContainer.DataMgr.ChatData:GetPrivateSortChatDatas()
|
||
for k, v in pairs(privateChats) do
|
||
local privateChat = v
|
||
local newestIdx = #privateChat.chats
|
||
if newestIdx > 0 then
|
||
local headIconPath = privateChat.fromData.imgId
|
||
local chatTabData = {
|
||
chatType = ChatType.Private,
|
||
channelId = privateChat.fromData.uid,
|
||
title = privateChat.fromData.nickname,
|
||
headIcons = { headIconPath },
|
||
subTitle = privateChat.chats[newestIdx].message.message,
|
||
}
|
||
table.insert(chatTabDataList, chatTabData)
|
||
end
|
||
end
|
||
|
||
CommonUtil.LoopGridViewEleCreateNew(self,
|
||
self.chatTab.chatTabLoopScrollView.loopVerticalScrollRect,
|
||
self.chatTab.chatTabContent.verticalLayoutGroup,
|
||
chatTabDataList, 0, self, self.SetChatTabItem)
|
||
end
|
||
|
||
function UIChatView:SetChatTabItem(itemLua, idx, itemData)
|
||
itemLua.title.text.text = itemData.title
|
||
itemLua.subTitle.text.text = itemData.subTitle
|
||
for i = 1, 9 do
|
||
itemLua["c"..i]:SetActive(false)
|
||
end
|
||
for i = 1, #itemData.headIcons do
|
||
local icon = itemLua["c"..i]
|
||
icon:SetActive(true)
|
||
local iconPath = itemData.headIcons[i]
|
||
CommonUtil.LoadIcon(self, iconPath, function (sprite)
|
||
icon.image.sprite = sprite
|
||
end)
|
||
end
|
||
if #itemData.headIcons == 1 then
|
||
itemLua.headIcons.gridLayoutGroup.cellSize = Vector2(150, 150)
|
||
elseif #itemData.headIcons >= 3 and #itemData.headIcons <= 4 then
|
||
itemLua.headIcons.gridLayoutGroup.cellSize = Vector2(60, 60)
|
||
elseif #itemData.headIcons >= 5 and #itemData.headIcons <= 9 then
|
||
itemLua.headIcons.gridLayoutGroup.cellSize = Vector2(40, 40)
|
||
end
|
||
self.uiBase:AddButtonUniqueEventListener(itemLua.button, self, self.OnClickChatItem, itemLua, itemData)
|
||
end
|
||
|
||
|
||
function UIChatView:OnClickChatItem(btn, params)
|
||
local itemLua = params[0]
|
||
local chatItemData = params[1]
|
||
local channelId = chatItemData.channelId
|
||
if channelId == CONST_CHANNEL_MAIL then
|
||
-- Open Mail UI
|
||
ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIMailBox)
|
||
else
|
||
local storyCfg = chatItemData.storyCfg
|
||
self:EnterChatLayer2(channelId, storyCfg)
|
||
end
|
||
end
|
||
|
||
function UIChatView:RefreshSearchTab()
|
||
local storyDatas = ManagerContainer.DataMgr.StoryData:GetStoryDatas()
|
||
--LogError("-RefreshSearchTab-"..Inspect(storyDatas))
|
||
local searchTabDataList = ManagerContainer.CfgMgr:GetStoryNpcCfgNotIn(storyDatas)
|
||
CommonUtil.LoopGridViewEleCreateNew(
|
||
self, self.searchTab.searchTabLoopScrollView.loopVerticalScrollRect,
|
||
self.searchTab.searchTabContent.verticalLayoutGroup,
|
||
searchTabDataList, 0, self, self.SetSearchTabItem
|
||
)
|
||
end
|
||
|
||
function UIChatView:SetSearchTabItem(itemLua, idx, itemData)
|
||
local mapLevel = self.controller:GetMapLevel()
|
||
local isUnlock = false
|
||
if itemData['MapLevel'] <= mapLevel then
|
||
isUnlock = true
|
||
end
|
||
|
||
itemLua.name.text.text = I18N.T(itemData['Name'])
|
||
itemLua.location.text.text = I18N.T(itemData['Location'])
|
||
itemLua.age.text.text = itemData['Age']
|
||
itemLua.nation.text.text = I18N.T(itemData['Nation'])
|
||
itemLua.marry.text.text = I18N.T(itemData['Marry'])
|
||
itemLua.post.text.text = I18N.T(itemData['Post'])
|
||
itemLua.upVote.text.text = itemData['Upvote']
|
||
itemLua.commentNum.text.text = itemData['Comment']
|
||
|
||
CommonUtil.LoadIcon(self, itemData['Head'], function(sprite)
|
||
itemLua.headIconNode.headIcon.image.sprite = sprite
|
||
end)
|
||
itemLua.photoPart:SetActive(itemData['Photos'] and #itemData['Photos'] > 0)
|
||
for i = 1, 3 do
|
||
if itemData['Photos'] and itemData['Photos'][i] then
|
||
itemLua.photoPart['mask'..i]:SetActive(true)
|
||
CommonUtil.LoadIcon(self, itemData['Photos'][i], function(sprite)
|
||
itemLua.photoPart['photo'..i].image.sprite = sprite
|
||
end)
|
||
else
|
||
itemLua.photoPart['mask'..i]:SetActive(false)
|
||
end
|
||
end
|
||
|
||
if idx == 0 then
|
||
self['searchTabGreetBtn1'] = itemLua.greetBtn
|
||
end
|
||
|
||
itemLua.greetBtn.lock:SetActive(isUnlock==false)
|
||
itemLua.greetBtn.button.interactable = isUnlock
|
||
if isUnlock then
|
||
self.uiBase:AddButtonUniqueEventListener(itemLua.greetBtn.button, self, function() self:OnGreetBtn(itemData) end)
|
||
end
|
||
end
|
||
|
||
function UIChatView:OnGreetBtn(itemData)
|
||
LogError("OnGreetBtn: for StoryId "..itemData['StoryId'])
|
||
local storyId = itemData['StoryId']
|
||
local channelId = CONST_CHANNEL_STORY
|
||
local storyCfgData = ManagerContainer.CfgMgr:GetStoryDataById(storyId)
|
||
self:EnterChatLayer2(channelId, storyCfgData)
|
||
end
|
||
|
||
function UIChatView:RefreshMeTab()
|
||
local contactDatas = {}
|
||
local wiftNum = 0
|
||
local npcDatas = ManagerContainer.DataMgr.StoryData:GetStoryNpcDatas()
|
||
for k, v in pairs(npcDatas) do
|
||
local npcId = k
|
||
local heart = v
|
||
local storyNpcCfg = ManagerContainer.CfgMgr:GetStoryNpcCfgByChatNpcId(tonumber(npcId))
|
||
if storyNpcCfg and storyNpcCfg.Type == 1 then
|
||
wiftNum = wiftNum + 1
|
||
table.insert(contactDatas, {type = 1, name = I18N.T(storyNpcCfg.NameKey), heart = heart, storyNpcId=npcId})
|
||
end
|
||
end
|
||
table.insert(contactDatas, 1, {type = 2, name = I18N.T("妻子"), num = wiftNum})
|
||
|
||
local loverNum = 0
|
||
local loverGroup = {type = 2, name = I18N.T("情人"), num = loverNum}
|
||
table.insert(contactDatas, loverGroup)
|
||
for k, v in pairs(npcDatas) do
|
||
local npcId = k
|
||
local heart = v
|
||
local storyNpcCfg = ManagerContainer.CfgMgr:GetStoryNpcCfgByChatNpcId(tonumber(npcId))
|
||
if storyNpcCfg and storyNpcCfg.Type == 2 then
|
||
loverNum = loverNum + 1
|
||
table.insert(contactDatas, {type = 1, name = I18N.T(storyNpcCfg.NameKey), heart = heart, storyNpcId=npcId})
|
||
end
|
||
end
|
||
loverGroup.num = loverNum
|
||
|
||
local paNum = 0
|
||
local paGroup = {type = 2, name = I18N.T("朋友"), num = paNum}
|
||
table.insert(contactDatas, paGroup)
|
||
for k, v in pairs(npcDatas) do
|
||
local npcId = k
|
||
local heart = v
|
||
local storyNpcCfg = ManagerContainer.CfgMgr:GetStoryNpcCfgByChatNpcId(tonumber(npcId))
|
||
if storyNpcCfg and storyNpcCfg.Type == 3 then
|
||
paNum = paNum + 1
|
||
table.insert(contactDatas, {type = 1, name = I18N.T(storyNpcCfg.NameKey), heart = heart, storyNpcId=npcId})
|
||
end
|
||
end
|
||
paGroup.num = paNum
|
||
|
||
CommonUtil.LoopGridViewEleCreateNew(
|
||
self, self.meTab.meTabLoopScrollView.loopVerticalScrollRect,
|
||
self.meTab.meTabContent.verticalLayoutGroup,
|
||
contactDatas, 0, self, self.SetMeTabItem
|
||
)
|
||
end
|
||
|
||
function UIChatView:SetMeTabItem(itemLua, idx, itemData)
|
||
local isGroup = itemData.type == 2
|
||
local height = 190
|
||
if isGroup then height = 100 end
|
||
itemLua.layoutElement.preferredHeight = height
|
||
itemLua.contact:SetActive(isGroup == false)
|
||
itemLua.contactGroupTitle:SetActive(isGroup == true)
|
||
if isGroup then
|
||
itemLua.groupName.text.text = itemData.name
|
||
itemLua.contactNum.text.text = itemData.num
|
||
else
|
||
itemLua.name.text.text = itemData.name
|
||
itemLua.heartNum.text.text = itemData.heart
|
||
itemLua.progress.image.fillAmount = itemData.heart/100
|
||
CommonUtil.LoadIcon(self, itemData.head, function(sprite)
|
||
itemLua.headIcon.image.sprite = sprite
|
||
end)
|
||
self.uiBase:AddButtonUniqueEventListener(itemLua.button, self, self.OnClickContactItem, itemLua, itemData)
|
||
end
|
||
end
|
||
|
||
function UIChatView:OnClickContactItem(btn, params)
|
||
local itemLua = params[0]
|
||
local itemData = params[1]
|
||
PrintJson("OnClickContactItem: ", itemData)
|
||
local storyNpcId = itemData.storyNpcId
|
||
local storyNpcCfg = ManagerContainer.CfgMgr:GetStoryNpcCfgByChatNpcId(tonumber(storyNpcId))
|
||
-- local storyId = itemData['StoryId']
|
||
-- local channelId = CONST_CHANNEL_STORY
|
||
-- local storyCfgData = ManagerContainer.CfgMgr:GetStoryDataById(storyId)
|
||
self:EnterChatLayer2(CONST_CHANNEL_STORY_AI, storyNpcCfg)
|
||
end
|
||
|
||
function UIChatView:Layer2_OnClickReturnBtn()
|
||
self.chatLayer2:SetActive(false)
|
||
self.currChatChannelId = "0"
|
||
self:RefreshTable(self.currTabType)
|
||
end
|
||
|
||
|
||
function UIChatView:EnterChatLayer2(channelId, storyData)
|
||
self.currChatChannelId = channelId
|
||
self.chatLayer2:SetActive(true)
|
||
self:CloseAllInputToolBarToggles()
|
||
self:RefreshTitleBarForChatLayer2(channelId)
|
||
self:ResetInputField()
|
||
--self.chatLayer2.loopListView.layoutElement.preferredHeight = UnityEngine.Screen.height - CONST_TITLE_HEIGHT - CONST_INPUT_BAR_HEIGHT
|
||
|
||
-- 开启聊天模拟
|
||
if channelId == CONST_CHANNEL_STORY then
|
||
self.controller:ResetStoryChatDatas()
|
||
local newMessageNtfFunc = function(currStoryId, currStoryPerformCfgId)
|
||
-- TODO: Check chatContent type If Reward Message: [Gift-11111]
|
||
LogError("currStoryId: "..currStoryId..", currStoryPerformCfgId-"..currStoryPerformCfgId)
|
||
local tmpStoryCfg = ManagerContainer.CfgMgr:GetStoryDataById(currStoryId)
|
||
local storyPerformCfg = ManagerContainer.CfgMgr:GetStoryPerformCfgV2(currStoryPerformCfgId)
|
||
if storyPerformCfg then
|
||
local chatContent = I18N.T(storyPerformCfg.SpeakId)
|
||
local subType = self.controller:CheckChatSubType(chatContent)
|
||
if subType == Enum.ChatSubType.Heart then
|
||
local rewardId = chatContent:match("%[heartRewardId%-(%d+)%]")
|
||
local rewardIdNum = tonumber(rewardId)
|
||
if rewardIdNum ~= nil then
|
||
ManagerContainer.DataMgr.StoryData:AddHeart(currStoryId, rewardIdNum)
|
||
end
|
||
end
|
||
end
|
||
self:RefreshChatLayer2(channelId, tmpStoryCfg)
|
||
end
|
||
local chatInputNtfFunc = function(options)
|
||
--self:ShowInputToolBarWindow(CONST_TOGGLE_STORY, options)
|
||
--PrintJson("UIChatView:OnChatLayer2StoryInputTip", options)
|
||
self.chatLayer2.storyInputTip.button.interactable = true
|
||
--self.currStoryChatInputOptions = options
|
||
self:ShowStoryMenuWindow(options)
|
||
end
|
||
local storyPlayFinishNtfFunc = function()
|
||
local data = self.controller:GetData()
|
||
if data.onStoryFinish then data.onStoryFinish() end
|
||
self.chatLayer2.titleBarReturnBtn.button.interactable = true
|
||
end
|
||
local storyRecordDatas = ManagerContainer.DataMgr.StoryData:GetStoryDatas()
|
||
--LogError("storyRecordDatas: "..Inspect(storyRecordDatas))
|
||
if true or not storyRecordDatas[storyData.StoryId] then
|
||
self:SetUIStoryMode(true)
|
||
self.controller:StartStoryChat(storyData.Id, newMessageNtfFunc, chatInputNtfFunc, storyPlayFinishNtfFunc, true)
|
||
else
|
||
-- 显示历史聊天剧情
|
||
self:SetUIStoryMode(false)
|
||
end
|
||
self:RefreshChatLayer2(channelId, storyData)
|
||
|
||
-- Chat With Story Npc AI
|
||
elseif channelId == CONST_CHANNEL_STORY_AI then
|
||
self:SetStoryAIMode()
|
||
self.aiStoryData = storyData
|
||
self.controller:SetAIStoryParam(self.aiStoryData)
|
||
self:RefreshChatLayer2(channelId, storyData)
|
||
else
|
||
self:SetUIStoryMode(false)
|
||
self:RefreshChatLayer2(channelId, storyData)
|
||
end
|
||
end
|
||
|
||
function UIChatView:SetUIStoryMode(isStoryMode)
|
||
local canInteractable = (isStoryMode == false)
|
||
for k, v in pairs(self.InputBarToggles) do
|
||
v:SetActive(not isStoryMode)
|
||
end
|
||
for k, v in pairs(self.InputBarToggles) do
|
||
v.toggle.interactable = canInteractable
|
||
end
|
||
self.chatLayer2.titleBarHeart:SetActive(isStoryMode)
|
||
self.chatLayer2.storyInputTip:SetActive(isStoryMode)
|
||
self.chatLayer2.titleBarReturnBtn.button.interactable = canInteractable
|
||
self.chatLayer2.AnyBtn.button.interactable = canInteractable
|
||
if isStoryMode then
|
||
self.chatLayer2.inputField.tMP_InputField.readOnly = true
|
||
else
|
||
self.chatLayer2.inputField.tMP_InputField.readOnly = false
|
||
end
|
||
end
|
||
|
||
function UIChatView:SetStoryAIMode()
|
||
for k, v in pairs(self.InputBarToggles) do
|
||
v:SetActive(false)
|
||
end
|
||
for k, v in pairs(self.InputBarToggles) do
|
||
v.toggle.interactable = true
|
||
end
|
||
self.chatLayer2.titleBarHeart:SetActive(true)
|
||
self.chatLayer2.storyInputTip:SetActive(true)
|
||
self.chatLayer2.titleBarReturnBtn.button.interactable = true
|
||
self.chatLayer2.AnyBtn.button.interactable = true
|
||
self.InputBarToggles[CONST_TOGGLE_GIFT]:SetActive(true)
|
||
currInputToolBarToggleType = CONST_TOGGLE_GIFT
|
||
end
|
||
|
||
function UIChatView:UpdateChatLayer2Item(gridView, itemIndex)
|
||
local datas = self.currChatData.chats
|
||
if not datas then return nil end
|
||
local logicData = datas[itemIndex + 1]
|
||
if not logicData then return nil end
|
||
local item = gridView:NewListViewItem(Enum.PrefabNames.ChatContentItem)
|
||
item.gameObject.name = itemIndex
|
||
local itemLua = CommonUtil.BindGridViewItem2Lua(self, Enum.PrefabNames.ChatContentItem, item.gameObject)
|
||
CommonUtil.UpdateItemPrefab(self, itemLua, logicData, Enum.ItemIEnterType.System, self, self.OnChatContentItemClicked)
|
||
return item
|
||
end
|
||
|
||
--[[
|
||
params[0]:
|
||
{
|
||
fromData = {
|
||
headFrameId = 300,
|
||
imgId = "PlayerHeads/player_head_furuiya",
|
||
nickname = "芙蕾雅",
|
||
uid = "1000"
|
||
},
|
||
message = {
|
||
message = "[gift-1]",
|
||
sendTime64 = "1742893748043",
|
||
subType = 3,
|
||
used = false
|
||
},
|
||
targetId = "58017",
|
||
type = 2
|
||
}
|
||
]]
|
||
function UIChatView:OnChatContentItemClicked(button, params)
|
||
local p1 = params[0]
|
||
LogError("[UIChatView] OnChatContentItemClicked " .. Inspect(p1))
|
||
local storyPerformCfgId = p1.targetId
|
||
local contentStr = p1.message.message
|
||
if self.currChatChannelId == CONST_CHANNEL_STORY then
|
||
if p1.message.subType == Enum.ChatSubType.Gift then
|
||
local rewardId = tonumber(contentStr:match("%[giftRewardId%-(%d+)%]"))
|
||
local storyPerformCfgV2 = ManagerContainer.CfgMgr:GetStoryPerformCfgV2(storyPerformCfgId)
|
||
local storyId = storyPerformCfgV2.StoryId
|
||
LogError("OnChatContentItemClicked: rewardId="..rewardId)
|
||
ManagerContainer.DataMgr.StoryData:RecordGetReward(storyId, rewardId)
|
||
end
|
||
elseif self.currChatChannelId == CONST_CHANNEL_STORY_AI then
|
||
if p1.message.subType == Enum.ChatSubType.Gift then
|
||
local chatId = storyPerformCfgId
|
||
local rewardId = tonumber(contentStr:match("%[giftRewardId%-(%d+)%]"))
|
||
if ManagerContainer.DataMgr.StoryData:IsGetSendItemReward(storyPerformCfgId) == false then
|
||
local itemId, itemNum = self:GetCurrStorySendItem()
|
||
ManagerContainer.DataMgr.StoryData:GetSendItemReward(chatId, itemId, itemNum, rewardId)
|
||
end
|
||
elseif p1.message.subType == Enum.ChatSubType.Date then
|
||
local chatId = storyPerformCfgId
|
||
local rewardId = tonumber(contentStr:match("%[dateRewardId%-(%d+)%]"))
|
||
if ManagerContainer.DataMgr.StoryData:IsGetSendItemReward(storyPerformCfgId) == false then
|
||
local itemId, itemNum = self:GetCurrStorySendItem()
|
||
LogError("~~GetCurrStorySendItem~~")
|
||
ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIStoryDate, {chatId=chatId, itemId=itemId, itemNum=itemNum, rewardId=rewardId})
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
function UIChatView:SetCurrStorySendItem(itemId, itemNum)
|
||
self.currStorySendItemId = itemId
|
||
self.currStorySendItemNum = itemNum
|
||
end
|
||
function UIChatView:GetCurrStorySendItem()
|
||
return self.currStorySendItemId, self.currStorySendItemNum
|
||
end
|
||
|
||
function UIChatView:RefreshChatLayer2(channelId, storyData)
|
||
if self.currChatChannelId ~= channelId then return end
|
||
self.currChatData = {}
|
||
|
||
-- world chat
|
||
if channelId == CONST_CHANNEL_WORLD then
|
||
self.currChatData.fromData = {
|
||
["headFrameId"] = 300,
|
||
["imgId"] = "Heads/head_100001",
|
||
["jobId"] = 10000,
|
||
["level"] = 9,
|
||
["nickname"] = "世界",
|
||
["onlineState"] = false,
|
||
["sex"] = 1,
|
||
["uid"] = channelId
|
||
}
|
||
self.currChatData.chats = ManagerContainer.DataMgr.ChatData:GetWorldChatDatas()
|
||
if self.currChatData.fromData then
|
||
self.chatLayer2.titleBarText.text.text = self.currChatData.fromData.nickname
|
||
end
|
||
PrintJson("TAG-World", self.currChatData.chats)
|
||
|
||
-- guild chat
|
||
elseif channelId == CONST_CHANNEL_GUILD then
|
||
self.currChatData.fromData = {
|
||
["headFrameId"] = 300,
|
||
["imgId"] = "Heads/head_100001",
|
||
["jobId"] = 10000,
|
||
["level"] = 9,
|
||
["nickname"] = "工会",
|
||
["onlineState"] = false,
|
||
["sex"] = 1,
|
||
["uid"] = channelId
|
||
}
|
||
self.currChatData.chats = ManagerContainer.DataMgr.ChatData:GetGuildChatDatas()
|
||
if self.currChatData.fromData then
|
||
self.chatLayer2.titleBarText.text.text = self.currChatData.fromData.nickname
|
||
end
|
||
|
||
-- story chat
|
||
elseif channelId == CONST_CHANNEL_STORY then
|
||
if storyData == nil then return end
|
||
--[[ storyData:
|
||
{AddHeart = 2, ForceGuideGroup = 0, HideUi = false, Id = 301, NeedBg = false,
|
||
NeedSave = false, PlayInterval = 5, ProgramControl = true, Skip = false,
|
||
StoryId = 301, StoryNpcId = 20001, Transition = false, TransitionType = 3, Type = 1} ]]
|
||
self:RefreshTitleForStoryNpc(storyData.StoryNpcId)
|
||
self.currStoryData = storyData
|
||
self.currChatData.fromData = {
|
||
["headFrameId"] = 300,
|
||
["imgId"] = "Heads/head_100001",
|
||
["jobId"] = 10000,
|
||
["level"] = 9,
|
||
["nickname"] = "剧情",
|
||
["onlineState"] = false,
|
||
["sex"] = 1,
|
||
["uid"] = channelId
|
||
}
|
||
local storyPerformCfgId = self.controller:GetCurrStoryPerformCfgId(storyData.StoryId)
|
||
self.currChatData.chats = self.controller:GetStoryChatDatas(storyData.StoryId, storyPerformCfgId)
|
||
|
||
elseif channelId == CONST_CHANNEL_STORY_AI then
|
||
self.currStoryData = storyData
|
||
local currAIStoryNpcCfg = storyData
|
||
self:RefreshTitleForStoryNpc(currAIStoryNpcCfg.StoryNpcId)
|
||
self.currChatData.chats = self.controller:GetStoryAIChatDatas()
|
||
|
||
-- private chat
|
||
else
|
||
self.currChatData.chats = {}
|
||
local privateChats = ManagerContainer.DataMgr.ChatData:GetPrivateSortChatDatas()
|
||
for k, v in pairs(privateChats) do
|
||
if v.fromData.uid == channelId then
|
||
chatData = v
|
||
break
|
||
end
|
||
end
|
||
if self.currChatData.fromData then
|
||
self.chatLayer2.titleBarText.text.text = self.currChatData.fromData.nickname
|
||
end
|
||
end
|
||
|
||
-- table.insert(chatData.chats, {
|
||
-- type = 2,
|
||
-- targetId = "0",
|
||
-- fromData = {},
|
||
-- message = {
|
||
-- message = "这是系统通知消息",
|
||
-- sendTime64 = "1756966829316",
|
||
-- used = false,
|
||
-- subType = 7
|
||
-- }
|
||
-- })
|
||
|
||
local datas = self.currChatData.chats
|
||
local max = datas and #datas or 0
|
||
if self.chatLayer2.loopListView.loopListView.ListViewInited == false then
|
||
self.chatLayer2.loopListView.loopListView:InitListView(0, function(gridView, itemIndex)
|
||
return self:UpdateChatLayer2Item(gridView, itemIndex)
|
||
end)
|
||
end
|
||
|
||
self.chatLayer2.loopListView.loopListView:ResetListView(true)
|
||
self.chatLayer2.loopListView.loopListView:SetListItemCount(max)
|
||
self.chatLayer2.loopListView.loopListView:RefreshAllShownItem()
|
||
self.chatLayer2.loopListView.loopListView:MovePanelToItemIndex(#self.currChatData.chats, 0)
|
||
end
|
||
|
||
function UIChatView:PlayAddHeartAnimation(storyNpcId, heart, addHeart)
|
||
if storyNpcId and storyNpcId > 0 then
|
||
self:RefreshTitleForStoryNpc(storyNpcId)
|
||
else
|
||
LogError("[PlayAddHeartAnimation] storyNpcId: "..storyNpcId)
|
||
end
|
||
end
|
||
|
||
function UIChatView:RefreshTitleForStoryNpc(storyNpcId)
|
||
local storyNpcCfg = ManagerContainer.CfgMgr:GetStoryNpcCfgByChatNpcId(tonumber(storyNpcId))
|
||
local heart = ManagerContainer.DataMgr.StoryData:GetStoryNpcHeart(storyNpcId)
|
||
self.chatLayer2.heartNum.text.text = heart
|
||
self.chatLayer2.titleBarText.text.text = I18N.T(storyNpcCfg.NameKey)
|
||
end
|
||
|
||
-- itemData format:
|
||
--[[
|
||
{
|
||
"isSystem": true,
|
||
"nickname": "",
|
||
"paramIds": [15, 0],
|
||
"sendTime": "1747292400",
|
||
"sendTime64": "1747292400020",
|
||
"type": 6
|
||
}
|
||
|
||
{
|
||
"fromData": {
|
||
"headFrameId": 300,
|
||
"imgId": "Heads/head_400212_pro",
|
||
"jobId": 40031,
|
||
"level": 95,
|
||
"nickname": "寿",
|
||
"sex": 2,
|
||
"titleId": 423,
|
||
"uid": "7482034996175175713",
|
||
"vipLv": 24
|
||
},
|
||
"message": {
|
||
"message": "[e03][e03][e03][e03][e03]",
|
||
"sendTime64": "1742893748043",
|
||
"subType": 0,
|
||
"used": false
|
||
},
|
||
"targetId": "0",
|
||
"type": 2
|
||
}
|
||
]]
|
||
|
||
|
||
function UIChatView:AddUIEventListener()
|
||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name)
|
||
|
||
-- CommonUtil.CreateToggleMouduleOnlyBtns(self, self.pageToggleData, self.toggle, Enum.ChatChannel.World, self.OnChannelChange)
|
||
self.uiBase:AddToggleEventListener(self.chWorld.toggle, self, self.OnChannelChange, Enum.ChatChannel.World)
|
||
self.uiBase:AddToggleEventListener(self.chGuild.toggle, self, self.OnChannelChange, Enum.ChatChannel.Guild)
|
||
self.uiBase:AddToggleEventListener(self.chSystem.toggle, self, self.OnChannelChange, Enum.ChatChannel.System)
|
||
|
||
--self.uiBase:AddButtonEventListener(self.AnyBtn.button, self, self.OnBtnClose)
|
||
|
||
--uIChatRootWorld:AddUIEventListener()
|
||
|
||
self.uiBase:AddButtonEventListener(self.BtnClose.button, self, self.OnBtnClose)
|
||
|
||
--self.uiBase:AddToggleEventListener(self.messageTabBtn.toggle, self, self.OnBottomTabChange, BottomTabType.MessageTab)
|
||
--self.uiBase:AddToggleEventListener(self.searchTabBtn.toggle, self, self.OnBottomTabChange, BottomTabType.SearchTab)
|
||
--self.uiBase:AddToggleEventListener(self.meTabBtn.toggle, self, self.OnBottomTabChange, BottomTabType.MeTab)
|
||
self.bottomTabToggleData = {}
|
||
local openTab = self.controller:GetOpenTab()
|
||
CommonUtil.CreateToggleMouduleOnlyBtns(self, self.bottomTabToggleData, self.bottomTabBar.toggleGroup, openTab, self.OnBottomTabChange, self)
|
||
|
||
self.uiBase:AddToggleEventListener(self.chatLayer2.emojiToggle.toggle, self, self.OnValueChanged_InputToolBarToggleGroup, CONST_TOGGLE_EMOJI)
|
||
self.uiBase:AddToggleEventListener(self.chatLayer2.giftToggle.toggle, self, self.OnValueChanged_InputToolBarToggleGroup, CONST_TOGGLE_GIFT)
|
||
self.uiBase:AddToggleEventListener(self.chatLayer2.storyToggle.toggle, self, self.OnValueChanged_InputToolBarToggleGroup, CONST_TOGGLE_STORY)
|
||
self.uiBase:AddToggleEventListener(self.chatLayer2.dateToggle.toggle, self, self.OnValueChanged_InputToolBarToggleGroup, CONST_TOGGLE_DATE)
|
||
self.uiBase:AddToggleEventListener(self.chatLayer2.photoToggle.toggle, self, self.OnValueChanged_InputToolBarToggleGroup, CONST_TOGGLE_PHOTO)
|
||
|
||
self.uiBase:AddButtonEventListener(self.btnBack.button, self, self.OnBtnBack)
|
||
end
|
||
|
||
|
||
function UIChatView:OnValueChanged_InputToolBarToggleGroup(toggle, toggleType, isOn)
|
||
--LogError("toggle: "..tostring(toggleType).."-"..tostring(isOn))
|
||
if isOn == false then
|
||
self:CloseAllInputToolBarToggles()
|
||
return
|
||
end
|
||
if currInputToolBarToggleType == toggleType then
|
||
--LogError("UIChatView: close "..tostring(toggleType))
|
||
self:CloseAllInputToolBarToggles()
|
||
else
|
||
LogError("UIChatView: open "..tostring(toggleType))
|
||
self:ShowInputToolBarWindow(toggleType)
|
||
end
|
||
end
|
||
|
||
function UIChatView:ShowInputToolBarWindow(toggleType, windowData)
|
||
--self:CloseAllInputToolBarToggles()
|
||
self.InputBarToggles[toggleType].on:SetActive(true)
|
||
self.InputBarToggles[toggleType].off:SetActive(false)
|
||
self.InputBarWindows[toggleType]:SetActive(true)
|
||
--self.chatLayer2.loopListView.layoutElement.preferredHeight = UnityEngine.Screen.height - CONST_TITLE_HEIGHT - CONST_INPUT_BAR_HEIGHT - CONST_INPUT_WINDOW_HEIGHT
|
||
|
||
self.chatLayer2.AnyBtn:SetActive(true)
|
||
self.chatLayer2.inputToolBar:SetActive(true)
|
||
currInputToolBarToggleType = toggleType
|
||
self:UpInputBar()
|
||
|
||
if toggleType == CONST_TOGGLE_STORY then
|
||
local storyDatas = windowData
|
||
-- storyDatas = {
|
||
-- {storyId=10089, performStoryCfgId=100000, optionText="好的好的!"},
|
||
-- {storyId=20098, performStoryCfgId=100000, optionText="不行啊,我有事"},
|
||
-- {storyId=20198, performStoryCfgId=100000, optionText="让我考虑一下!"}
|
||
-- }
|
||
self:ShowStoryMenuWindow(storyDatas)
|
||
end
|
||
end
|
||
|
||
function UIChatView:UpInputBar()
|
||
--[[
|
||
self.chatLayer2.inputPanel.layoutElement.preferredHeight = 1000
|
||
if self.currChatData then
|
||
self.delayShowInputFrameTimer = FrameTimer.New(function()
|
||
self.chatLayer2.loopListView.loopListView:ResetListView(false)
|
||
self.chatLayer2.loopListView.loopListView:MovePanelToItemIndex(#self.currChatData.chats, 0)
|
||
self.chatLayer2.loopListView.loopListView:RefreshAllShownItem()
|
||
end, 3)
|
||
self.delayShowInputFrameTimer:Start()
|
||
end
|
||
]]
|
||
end
|
||
|
||
function UIChatView:DownInputBar()
|
||
--[[
|
||
self.chatLayer2.inputPanel.layoutElement.preferredHeight = 270
|
||
--self.chatLayer2.loopListView.layoutElement.preferredHeight = UnityEngine.Screen.height - CONST_TITLE_HEIGHT - CONST_INPUT_BAR_HEIGHT
|
||
if self.currChatData then
|
||
self.delayHideInputFrameTimer = FrameTimer.New(function()
|
||
self.chatLayer2.loopListView.loopListView:ResetListView(false)
|
||
self.chatLayer2.loopListView.loopListView:MovePanelToItemIndex(#self.currChatData.chats, 0)
|
||
self.chatLayer2.loopListView.loopListView:RefreshAllShownItem()
|
||
end, 3)
|
||
self.delayHideInputFrameTimer:Start()
|
||
end
|
||
]]
|
||
end
|
||
|
||
function UIChatView:CloseAllInputToolBarToggles()
|
||
self:DownInputBar()
|
||
for k, v in pairs(self.InputBarToggles) do
|
||
v.on:SetActive(false)
|
||
v.off:SetActive(true)
|
||
end
|
||
for k, v in pairs(self.InputBarWindows) do
|
||
v:SetActive(false)
|
||
end
|
||
self.chatLayer2.AnyBtn:SetActive(false)
|
||
self.chatLayer2.inputToolBar:SetActive(false)
|
||
currInputToolBarToggleType = 0
|
||
end
|
||
|
||
function UIChatView:OnBtnBack(btn)
|
||
self.chatLayer2.loopListView.loopListView:Dispose()
|
||
ManagerContainer.LuaUIMgr:ClosePage(Enum.UIPageName.UIChat)
|
||
end
|
||
|
||
function UIChatView:OnHide()
|
||
end
|
||
|
||
function UIChatView:OnShow(data)
|
||
self:OnChannelChange(nil, ManagerContainer.DataMgr.ChatData:GetChatChannelType(), true)
|
||
self:Init()
|
||
end
|
||
|
||
function UIChatView:OnClose()
|
||
if not self.closed then
|
||
self.closed = true
|
||
end
|
||
|
||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.WORLD_CHAT_UI_CLOSE)
|
||
|
||
-- if uIChatRootWorld then
|
||
-- uIChatRootWorld:Dispose()
|
||
-- uIChatRootWorld = nil
|
||
-- end
|
||
end
|
||
|
||
function UIChatView:OnDispose()
|
||
self.chatLayer2.emojiWindow:SetActive(false)
|
||
self.chatLayer2.inputField.tMP_InputField:DeactivateInputField()
|
||
self.chatLayer2.emojiWindow.loopVerticalScrollRect:ClearCells()
|
||
self.chatLayer2.loopListView.loopListView:Dispose()
|
||
end
|
||
|
||
function UIChatView:IsSomeFrameCount(keyName)
|
||
local value = self[keyName]
|
||
if value and value >= Time.frameCount then
|
||
return true
|
||
end
|
||
self[keyName] = Time.frameCount
|
||
return false
|
||
end
|
||
|
||
function UIChatView:SetToggleGroupStatus(chatChannelType)
|
||
local toggleGroup = self.toggle.toggleGroup
|
||
local oldAllowSwitchOff = toggleGroup.allowSwitchOff
|
||
toggleGroup.allowSwitchOff = false
|
||
self.chWorld.toggle.isOn = (chatChannelType == Enum.ChatChannel.World)
|
||
self.chGuild.toggle.isOn = (chatChannelType == Enum.ChatChannel.Guild)
|
||
self.chSystem.toggle.isOn = (chatChannelType == Enum.ChatChannel.System)
|
||
toggleGroup.allowSwitchOff = oldAllowSwitchOff
|
||
end
|
||
|
||
return UIChatView
|
||
|