public void AddReplyHistory(CG_CHAT pak) { if (pak != null) { // 记录历史回复 // 如果重复发言 把之前的记录提前 不新增 foreach (ChatHistoryItem item in m_ReplyHistoryList) { if (item.ChatInfo == pak.Chatinfo) { m_ReplyHistoryList.Remove(item); break; } } ChatHistoryItem history = new ChatHistoryItem(); history.CleanUp(); history.ChatInfo = pak.Chatinfo; history.ELinkType.Add((GC_CHAT.LINKTYPE)pak.Linktype); for (int i = 0; i < pak.intdataList.Count; ++i) { history.IntData.Add(pak.intdataList[i]); } for (int i = 0; i < pak.strdataList.Count; ++i) { history.StrData.Add(pak.strdataList[i]); } if (m_ReplyHistoryList.Count >= ReplyHistoryNum) { m_ReplyHistoryList.RemoveAt(0); } m_ReplyHistoryList.Add(history); } }
public bool OnReceiveChat(GC_CHAT pak) { if (pak == null) { return(false); } if (pak.Chattype - 1 >= m_ChannelHistory.Length || pak.Chattype - 1 >= Channel_HistoryCount.Length || pak.Chattype - 1 < 0) { return(false); } if (pak.HasSenderguid) { if (pak.Chattype != (int)GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM) { if (pak.Senderguid != Singleton <ObjManager> .Instance.MainPlayer.GUID) { if (Utils.IsStrFilter_Abuse(pak.Chatinfo)) { return(false); } } } } else { if (Utils.IsStrFilter_Abuse(pak.Chatinfo)) { return(false); } } if (m_ChannelHistory[pak.Chattype - 1].Count >= Channel_HistoryCount[pak.Chattype - 1]) { ChatHistoryItem item = m_ChannelHistory[pak.Chattype - 1][0]; m_ChannelHistory[pak.Chattype - 1].RemoveAt(0); m_ChatHistoryList.Remove(item); if (item.VoiceChatIndex != GlobeVar.INVALID_ID) { GameManager.gameManager.PlayerDataPool.VoiceChatDownloadRecord.DelVoice(item.VoiceChatIndex); } } // 记录聊天历史 ChatHistoryItem history = new ChatHistoryItem(); history.CleanUp(); //string ChatInfo = ""; if (pak.HasSenderguid) { history.SenderGuid = pak.Senderguid; } if (pak.HasSendername) { history.SenderName = pak.Sendername; if (pak.HasAnoymousState) { if (pak.AnoymousState == (int)GC_CHAT.ANOYMOUS_STATE.ANOYMOUS_SUCCESS) { history.SenderName = StrDictionary.GetClientDictionaryString("#{10566}"); } } } if (pak.HasReceiverguid) { history.ReceiverGuid = pak.Receiverguid; } if (pak.HasReceivername) { history.ReceiverName = pak.Receivername; } if (pak.HasSenderLevel) { history.SenderLevel = pak.SenderLevel; } if (pak.HasSenderProfession) { history.SenderPro = pak.SenderProfession; } if (pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM) { history.ChatInfo = pak.Chatinfo; } else { //history.ChatInfo = Utils.StrFilter_Chat(pak.Chatinfo); } history.ChatInfo = pak.Chatinfo; history.ChatInfo = history.ChatInfo.Replace(" ", " "); history.EChannel = (GC_CHAT.CHATTYPE)pak.Chattype; for (int i = 0; i < pak.linktypeCount; i++) { history.ELinkType.Add((GC_CHAT.LINKTYPE)pak.linktypeList[i]); } for (int i = 0; i < pak.intdataList.Count; ++i) { history.IntData.Add(pak.intdataList[i]); } for (int i = 0; i < pak.strdataList.Count; ++i) { history.StrData.Add(pak.strdataList[i]); } if (pak.HasSenderVIPLevel) { history.SenderVIPLevel = pak.SenderVIPLevel; } Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; if (null == mainPlayer) { return(false); } if (pak.HasVoiceChatIndex && pak.HasSenderguid) { // LogModule.DebugLog("ReeiveGCCHATVoice"); history.VoiceChatIndex = pak.VoiceChatIndex; if (mainPlayer.GUID != pak.Senderguid && IsCanAutoDownloadVoiceChat(history)) { if (ChatInfoSetupLogic.IsChannelReceiveChat(GameManager.gameManager.PlayerDataPool.ChooseChannel, history.EChannel)) { // 不是自己发送的 又通过语音设置的 又通过聊天频道接收设置的 才去自动下载 LogModule.DebugLog("AddGCCHATVoice"); GameManager.gameManager.PlayerDataPool.VoiceChatDownloadRecord.ReqDownload(history.VoiceChatIndex, history.SenderGuid); } } } m_ChannelHistory[pak.Chattype - 1].Add(history); //LogModule.DebugLog ("add ----------- " + history.ChatInfo + " " + history.StrData[0] +" " + history.IntData.Count); m_ChatHistoryList.Add(history); if (pak.HasSenderguid && (pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_NORMAL || pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM)) { if (pak.Senderguid == mainPlayer.GUID) { mainPlayer.ShowChatBubble(history); } else { Obj_OtherPlayer player = Singleton <ObjManager> .GetInstance().FindOtherPlayerInScene(pak.Senderguid); if (player != null) { player.ShowChatBubble(history); } } } // 好友频道消息 if (pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_FRIEND) { // 发送者不是玩家自己 if (pak.HasSenderguid && pak.Senderguid != mainPlayer.GUID) { // 如果当前是好友频道 且选中的不是该好友 才向list添加 if (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType == ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_FRIEND && ChatInfoLogic.Instance().FriendChatReceiverGuid == pak.Senderguid) { } else { if (!m_FriendSendList.Contains(pak.Senderguid)) { m_FriendSendList.Add(pak.Senderguid); } } // 聊天界面关闭或者打开但不是好友频道时 if (ChatInfoLogic.Instance() == null || (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType != ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_FRIEND)) { // 通知ChatFrame显示提示红点 if (ChatFrameLogic.Instance() != null) { ChatFrameLogic.Instance().m_InformSprite.SetActive(true); } m_HasNewFriendChat = true; } } } if (pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_TELL) { if (pak.HasSenderguid && pak.Senderguid != mainPlayer.GUID) { // 聊天界面关闭或者打开但不是密聊频道时 if (ChatInfoLogic.Instance() == null || (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType != ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_TELL)) { // 通知ChatFrame显示提示红点 if (ChatFrameLogic.Instance() != null) { ChatFrameLogic.Instance().m_InformSprite.SetActive(true); m_HasNewTellChat = true; } // 如果打开但不是密聊频道 通知聊天界面显示密聊频道标签上的红点 if (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType != ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_TELL) { ChatInfoLogic.Instance().m_TellInformSprite.SetActive(true); } } } } if (pak.Chattype == (int)GC_CHAT.CHATTYPE.CHAT_TYPE_TEAM) { if (pak.HasSenderguid && pak.Senderguid != mainPlayer.GUID) { // 聊天界面关闭或者打开但不是密聊频道时 if (ChatInfoLogic.Instance() == null || (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType != ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_TEAM)) { // 通知ChatFrame显示提示红点 if (ChatFrameLogic.Instance() != null) { ChatFrameLogic.Instance().m_InformSprite.SetActive(true); m_HasTeamInfoChat = true; } // 如果打开但不是密聊频道 通知聊天界面显示密聊频道标签上的红点 if (ChatInfoLogic.Instance() != null && ChatInfoLogic.Instance().CurChannelType != ChatInfoLogic.CHANNEL_TYPE.CHAT_TYPE_TEAM) { ChatInfoLogic.Instance().m_TeamInfoSprite.SetActive(true); } } } } return(true); }