Beispiel #1
0
        //私聊请求聊天返回
        private void Fun_10_2(INetData data)
        {
            ChatPrivateChatMsg_10_2 privateChatReqMsg_10_2 = new ChatPrivateChatMsg_10_2();

            privateChatReqMsg_10_2.read(data.GetMemoryStream());

            if (privateChatReqMsg_10_2.code != 0)
            {
                ErrorCodeManager.ShowError(privateChatReqMsg_10_2.code);
                return;
            }
//			Singleton<ChatMode>.Instance.ReciveNameSL = privateChatReqMsg_10_2.roleName;

            ChatVo newMSg = new ChatVo();

            newMSg.chatType   = 7;
            newMSg.senderId   = MeVo.instance.Id;
            newMSg.serverId   = (ushort)MeVo.instance.serverId;
            newMSg.senderName = MeVo.instance.Name;
            newMSg.senderSex  = MeVo.instance.sex;
            newMSg.senderJob  = MeVo.instance.job;
            newMSg.senderLvl  = (byte)MeVo.instance.Level;
            newMSg.senderVip  = MeVo.instance.vip;
            newMSg.content    = Singleton <ChatView> .Instance.sendMessage.content;
//			updateChatVO.goods = Singleton<ChatMode>.Instance.goods.Count > 0?Singleton<ChatMode>.Instance.goods[0]:null;
            newMSg.nationId = MeVo.instance.nation;

            Singleton <ChatMode> .Instance.AddChatMsg(newMSg);

            Singleton <ChatMode> .Instance.UpdateMainChatContent(newMSg.senderName, newMSg.chatType, newMSg.content);

            Singleton <ChatView> .Instance.msgInput.value = "";
        }
Beispiel #2
0
        private void SendChatMsg(ChatVo recChat)
        {
            //Log.error(this, "new message come! , msg" + recChatMsg.senderName);
            //如果不是自己发出的消息,就要给出消息提示
            if (recChat.senderName != MeVo.instance.Name)
            {
                if (Singleton <MainBottomLeftView> .Instance.liaotianBg)
                {
                    Singleton <MainBottomLeftView> .Instance.NewMsgAlarm(Singleton <MainBottomLeftView> .Instance.liaotianBg, true);
                }

                if (Singleton <BattleView> .Instance.BtnChatBg)
                {
                    Singleton <BattleView> .Instance.NewMsgAlarm(Singleton <BattleView> .Instance.BtnChatBg, true);
                }
            }
            //记录名字对应的ID号
            if (Singleton <ChatMode> .Instance.nameToIdDic.ContainsKey(recChat.senderName))
            {
                Singleton <ChatMode> .Instance.nameToIdDic[recChat.senderName] = recChat.senderId;
            }
            else
            {
                Singleton <ChatMode> .Instance.nameToIdDic.Add(recChat.senderName, recChat.senderId);
            }

            Singleton <ChatMode> .Instance.AddChatMsg(recChat);

            Singleton <ChatMode> .Instance.UpdateMainChatContent(recChat.senderName, recChat.chatType, recChat.content);
        }
Beispiel #3
0
        private void SendNoticeMsg(string content)
        {
            ChatVo recChat = new ChatVo();

            recChat.chatType   = (byte)ChatType.ZongHe;
            recChat.senderName = LanguageManager.GetWord("ChatView.SysNotice");
            recChat.senderId   = GameConst.SystemNoticeId;
            recChat.content    = content;

            SendChatMsg(recChat);
        }
Beispiel #4
0
 //添加消息到缓存
 public void AddChatMsg(ChatVo addMsg)
 {
     Log.info(this, "将收到的消息添加到消息列表中,最多保留三十条");
     if (_recMsgList.Count < 30)
     {
         _recMsgList.Add(addMsg);
     }
     else
     {
         _recMsgList.Remove(_recMsgList[0]);
         _recMsgList.Add(addMsg);
     }
     DataUpdate(UPDATE_CHAT_MSG);
 }
Beispiel #5
0
        //聊天内容推送
        private void Fun_10_3(INetData data)
        {
            ChatContentPushMsg_10_3 recChatMsg = new ChatContentPushMsg_10_3();

            recChatMsg.read(data.GetMemoryStream());

            if (!IsValidMsg(recChatMsg.chatType))
            {
                return;
            }

            if (IsBlackListMan(recChatMsg.senderName))
            {
                return;
            }

            Log.info(this, "判断是否接收该频道消息");
            switch (recChatMsg.chatType)
            {
            case (byte)ChatType.SiLiao:
                if (LocalVarManager.GetInt(LocalVarManager.CHAT_REC_SL_CHANNEL, 0) == (int)ReceiveState.REJECT)
                {
                    return;
                }
                else
                {
                    break;
                }

            case (byte)ChatType.ZongHe:
                if (LocalVarManager.GetInt(LocalVarManager.CHAT_REC_ZH_CHANNEL, 0) == (int)ReceiveState.REJECT)
                {
                    return;
                }
                else
                {
                    break;
                }

            case (byte)ChatType.ZhenYing:
                if (LocalVarManager.GetInt(LocalVarManager.CHAT_REC_ZY_CHANNEL, 0) == (int)ReceiveState.REJECT)
                {
                    return;
                }
                else
                {
                    break;
                }

            default:
                break;
            }

            ChatVo recChat = new ChatVo();

            recChat.chatType   = recChatMsg.chatType;
            recChat.senderId   = recChatMsg.senderId;
            recChat.serverId   = recChatMsg.serverId;
            recChat.senderName = recChatMsg.senderName;
            recChat.senderSex  = recChatMsg.senderSex;
            recChat.senderJob  = recChatMsg.senderJob;
            recChat.senderLvl  = recChatMsg.senderLvl;
            recChat.senderVip  = recChatMsg.senderVip;
            recChat.content    = recChatMsg.content;
            recChat.goods      = recChatMsg.goodsList.Count > 0?recChatMsg.goodsList[0]:null;
            recChat.nationId   = recChatMsg.senderNation;

            SendChatMsg(recChat);
        }