Пример #1
0
    private void OnChatNotifyRes(short state, ChatNotify down = null)
    {
        if (state != 0)
        {
            StateManager.Instance.StateShow(state, 0);
            return;
        }
        List <TalkMsg> msgs = down.msgs;

        for (int i = 0; i < msgs.get_Count(); i++)
        {
            TalkMsg talkMsg     = msgs.get_Item(i);
            int     srcChannel  = ChannelBit.Server2ClientChannel(talkMsg.type);
            int     dstChannels = ChannelBit.GetDstChannels(srcChannel, talkMsg.sender.id);
            this.Add2Channels(srcChannel, dstChannels, talkMsg);
        }
        this.RefreshCurrentChatChannel();
    }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (TalkMsg.Length != 0)
            {
                hash ^= TalkMsg.GetHashCode();
            }
            if (TalkMsgBytes.Length != 0)
            {
                hash ^= TalkMsgBytes.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
 private ChatManager.ChatInfo GetChatInfo(int srcChannel, int dstChannels, TalkMsg talkMsg)
 {
     ChatManager.ChatInfo chatInfo = new ChatManager.ChatInfo();
     chatInfo.src_channel = srcChannel;
     if (talkMsg.sender != null)
     {
         chatInfo.sender_name       = talkMsg.sender.label;
         chatInfo.sender_uid        = talkMsg.sender.id;
         chatInfo.chat_type         = talkMsg.sender.type;
         chatInfo.sender_occupation = talkMsg.sender.icon;
         chatInfo.viplevel          = (int)talkMsg.sender.num;
     }
     chatInfo.chat_content = talkMsg.content.text;
     chatInfo.items        = talkMsg.content.items;
     chatInfo.module       = this.ApplyTeamInvite(talkMsg.content.text);
     chatInfo.time         = this.GetServerTimeString(TimeManager.Instance.CalculateLocalServerTimeBySecond(talkMsg.time));
     if (srcChannel == 4 && chatInfo.sender_uid == EntityWorld.Instance.EntSelf.ID)
     {
         chatInfo.sender_name = "@" + ((talkMsg.receiver == null) ? "NONE" : talkMsg.receiver.label);
     }
     return(chatInfo);
 }
Пример #4
0
 private void Add2Channels(int srcChannel, int dstChannels, TalkMsg talkMsg)
 {
     ChatManager.ChatInfo chatInfo = this.GetChatInfo(srcChannel, dstChannels, talkMsg);
     if (chatInfo.sender_uid <= 0L)
     {
         chatInfo.sender_name = TextColorMgr.GetColor("系统消息", "AA0A00", string.Empty);
     }
     if (srcChannel == 32)
     {
         EventDispatcher.Broadcast <ChatManager.ChatInfo>("ChatManager.TeamMessage", chatInfo);
     }
     if (ChatManager.IsVoice(chatInfo))
     {
         this.Add2ChatUI(dstChannels, chatInfo);
         this.Add2ChatTipUI(dstChannels, chatInfo);
     }
     else
     {
         this.SendMessageToBulletCurtain(srcChannel, chatInfo);
         this.Add2ChatUI(dstChannels, chatInfo);
         this.Add2ChatTipUI(dstChannels, chatInfo);
     }
 }