public void Init() { m_Instance = this; m_nCurSetupIndex = (int)SETUP_TYPE.TYPE_VARIOUS; InitSetupTypePosInfo(); LoadChannelSetupValue(); }
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); }
// public GameObject m_setUpBtn; // private Transform m_setUpBtn_transform; void Awake() { m_Instance = this; }
public void OnCloseChat() { m_Instance = null; }
public void InitCurChat() { int HistoryCount = GameManager.gameManager.PlayerDataPool.ChatHistory.ChatHistoryList.Count; if (HistoryCount > 0) { int nLastLoudSpeakerIndex = -1; List <ChatHistoryItem> listChatHistory = GameManager.gameManager.PlayerDataPool.ChatHistory.ChatHistoryList; for (int i = listChatHistory.Count - 1; i >= 0; i--) { if (listChatHistory[i].EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER && listChatHistory[i].ChatInfo != null && (listChatHistory[i].ChatInfo != "" || (!PlatformHelper.IsChannelMainland() && listChatHistory[i].VoiceChatIndex != GlobeVar.INVALID_ID)) && ChatInfoSetupLogic.IsChannelReceiveChat(GameManager.gameManager.PlayerDataPool.ChooseChannel, listChatHistory[i].EChannel)) { nLastLoudSpeakerIndex = i; break; } } if (nLastLoudSpeakerIndex != -1) { // 显示聊天信息 ChatHistoryItem LastHistory = listChatHistory[nLastLoudSpeakerIndex]; string strChannelName = Utils.GetChannelName((int)LastHistory.EChannel); string strSenderName = ""; string strLastChatInfo = LastHistory.ChatInfo; if (LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_TELL || LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_FRIEND) { if (LastHistory.SenderName == Singleton <ObjManager> .Instance.MainPlayer.BaseAttr.RoleName) { //strSenderName = "你对[" + LastHistory.ReceiverName + "]说:"; strSenderName = StrDictionary.GetClientDictionaryString("#{2822}", LastHistory.ReceiverName); } else { //strSenderName = "[" + LastHistory.SenderName + "]对你说:"; strSenderName = StrDictionary.GetClientDictionaryString("#{2823}", LastHistory.SenderName); } if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#') { strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo); } } else if (LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM || LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD) { if (strLastChatInfo == null) { return; } // 台湾版本需要发送纯语音 if (strLastChatInfo == "" && (PlatformHelper.IsChannelMainland() || LastHistory.VoiceChatIndex == GlobeVar.INVALID_ID)) { return; } // 系统频道可能无发送人 if (LastHistory.SenderGuid != GlobeVar.INVALID_GUID && LastHistory.SenderName != "") { //strSenderName = "[" + LastHistory.SenderName + "]说:"; strSenderName = StrDictionary.GetClientDictionaryString("#{2824}", LastHistory.SenderName); } // 解析# 字典 if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#') { strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo); } } else { //strSenderName = "[" + LastHistory.SenderName + "]说:"; if (LastHistory.ELinkType.Count > 0 && LastHistory.GetLinkIntDataCountByIndex(0) == (int)GC_CHAT.LINKTYPE.LINK_TYPE_GUILDCRUITE) { strSenderName = "[" + StrDictionary.GetClientDictionaryString("#{3108}", "") + "]:"; } else { strSenderName = StrDictionary.GetClientDictionaryString("#{2824}", LastHistory.SenderName); } // 解析# 字典 if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#') { strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo); } } SelectTextNumber(); string strChatInfo = strLastChatInfo; string strChatFull = strChannelName + strSenderName + strChatInfo; strChatFull = ShowVIPIcon(strChatFull, ref strSenderName, LastHistory); strChatFull = ShowPlayVoiceBtn(strChatFull, strSenderName, LastHistory); if (LastHistory.ELinkType.Count > 0) { strChatFull = MakeLinkEnabled(strChatFull, LastHistory); } strChatFull = MakeEmotionEnabled(strChatFull); if (!(LastHistory.ELinkType.Count > 0 && LastHistory.GetLinkIntDataCountByIndex(0) == (int)GC_CHAT.LINKTYPE.LINK_TYPE_GUILDCRUITE)) { strChatFull = MakeNameLinkEnabled(strChatFull, LastHistory); } string strChannelColor = Utils.GetChannelColor(LastHistory); strChatFull = strChannelColor + strChatFull; ConfirmEllipsis(ref strChatFull); labelChatText.text = strChatFull; UpdateEmotionLinkPos(NGUITools.StripSymbols(strChatFull)); } } }