Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        // 队伍聊天气泡
        public void onAddTeamChatMessage(UTeamBubbleChatMessage msgData)
        {
            if (msgData == null)
            {
                return;
            }

            uint pdbid = msgData.pdbid;

            foreach (var item in teammateInfo)
            {
                if (item.nPDBID == pdbid)
                {
                    item.AddChatMessage(msgData.info);
                    break;
                }
            }
        }