public bool setData(ChatBubbleWndView view, uint uid, SChatMessageInfo info) { base.setData(info); m_View = view; m_UID = uid; m_Pdbid = info.senderPdbid; // 实体气泡,则更新位置 m_EntityView = EntityFactory.getEntityViewByID((int)uid); // uid获取失败,则使用pdbid if (m_EntityView == null) { m_EntityView = getEntityViewByPdbid(info.senderPdbid); } if (m_EntityView == null || !m_EntityView.IsValid) { return(false); } m_EntryProperty = m_EntityView.GetComponent <CreatureProperty>(); if (m_EntryProperty == null) { return(false); } // 设置初始位置 updatePosition(); return(true); }
public virtual void setData(SChatMessageInfo info) { ChatContentItemData itemData = new ChatContentItemData(); itemData.objList = info.objList; itemData.Height = 0; // 设置最大宽度 RectTransform rect = transform as RectTransform; rect.sizeDelta = new Vector2(MaxWidth, rect.sizeDelta.y); ChatContentItem contentItem = gameObject.GetComponent <ChatContentItem>(); if (contentItem != null) { contentItem.SetData(itemData); } else { Debug.LogError("contentItem == null, This GameObject have no ChatContentItem component."); } m_startTime = Time.time; m_isClosed = false; }
private bool isHasLargeEmotion(SChatMessageInfo info) { foreach (var item in info.objList) { if (item.type == ChatItemType.ObjType_Image && item.subType == ChatItemSubType.ObjSubType_Image_Emotion) { int type = -1; string strType = ""; if (item.param.TryGetValue("type", out strType) == false) { continue; } if (int.TryParse(strType, out type)) { if (type == (int)EMChatEmoticonType.Emoticon_Large) { return(true); } } } } return(false); }
private void showChatBubble(gamelogic_show_chat_message msgInfo, bool isShowBg = true) { string normalColor = CreateColorParam(UDefines.ChatChannelColor((int)msgInfo.channel)); SChatMessageInfo chatMsgInfo = new SChatMessageInfo(); chatMsgInfo.channel = (EMChatChannelType)msgInfo.channel; chatMsgInfo.senderKinID = msgInfo.senderKinID; chatMsgInfo.senderName = msgInfo.senderName; chatMsgInfo.senderPdbid = msgInfo.senderPdbid; chatMsgInfo.senderUdbid = msgInfo.senderUdbid; chatMsgInfo.objList = new List <SChatMessageObjectInfo>(); chatMsgInfo.strMessage = msgInfo.message; // 实体气泡 if (msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_NEARBY || msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_KIN || msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_CLAN || msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_CAMP || msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_WARSCENE) { // 战场内不显示联盟和战队的气泡 if (msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_KIN || msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_CLAN) { if (GameLogicAPI.isInWarScene() > 0) { return; } } // 解析内容 addChatContent(ref chatMsgInfo, normalColor); UChatBubbleMsgData msgData = new UChatBubbleMsgData(); msgData.msgID = (int)WndMsgID.WND_MSG_CHATBUBBLE_NEW_MESSAGE; msgData.uid = msgInfo.senderUID; msgData.info = chatMsgInfo; msgData.isShowBg = isShowBg; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_CHATBUBBLE_NEW_MESSAGE, msgData); } else if (msgInfo.channel == (int)EMChatChannelType.CHAT_CHANNEL_TEAMMATE) // 队伍聊天气泡 { if (msgInfo.senderPdbid == 0) { Debug.LogWarning("msgInfo.senderPdbid == 0"); return; } // 解析内容 addChatContent(ref chatMsgInfo, normalColor); UTeamBubbleChatMessage msgData = new UTeamBubbleChatMessage(); msgData.msgID = (int)WndMsgID.WND_MSG_CHATBUBBLE_TEAM_CHAT_MESSAGE; msgData.pdbid = msgInfo.senderPdbid; msgData.info = chatMsgInfo; // 发送到队伍UI上显示聊天气泡 UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_CHATBUBBLE_TEAM_CHAT_MESSAGE, msgData); } }
/// <summary> /// 加入聊听内容 /// </summary> /// <param name="info">聊听消息对象</param> /// <param name="normalColor">默认颜色</param> private void addChatContent(ref SChatMessageInfo info, String normalColor) { // 系统发言不过滤关键字 bool bShieldWord = (info.senderPdbid != 0); List <SChatMessageObjectInfo> tmpList = parseChatContent(info.strMessage, normalColor, bShieldWord); info.objList.AddRange(tmpList); }
public void ShowOneChatMessage() { if (m_CacheMsgInfoQueue.Count <= 0) { return; } SChatMessageInfo msgInfo = m_CacheMsgInfoQueue.Dequeue(); // 聊天对象放入列表 m_messageList.AddLast(msgInfo); if (m_messageList.Count > MAX_CHAT_CACHE_NUM) { m_messageList.RemoveFirst(); MsgIsOverLoad = true; } FillMessageShowList(); }