private void RefreshChatNotice(ScChatPrivate msg)
 {
     if (moduleAwakeMatch.IsTeamMember(msg.sendId))
     {
         chatNotice.SafeSetActive(true);
     }
 }
Example #2
0
    public void AddSelfChat(int type, string content, ulong chatId, string tag)
    {
        ScChatPrivate player = SetPrivate(modulePlayer.id_, type, content, tag);

        bool is_cun = moduleChat.Friend_Id_key.Exists(a => a == chatId);
        Queue <ScChatPrivate> aa = new Queue <ScChatPrivate>();

        if (is_cun)
        {
            moduleChat.Friend_chat_record.TryGetValue(chatId, out aa);
            if (aa != null)
            {
                moduleChat.Friend_chat_record.Remove(chatId);
                if (aa.Count >= ChatNum)
                {
                    aa.Dequeue();
                }
                aa.Enqueue(player);
            }
            else
            {
                aa = new Queue <ScChatPrivate>();
                aa.Enqueue(player);
            }
        }
        else
        {
            aa.Enqueue(player);
        }

        moduleChat.Friend_chat_record.Add(chatId, aa);
    }
Example #3
0
    public void ChatJilu(ulong cc, ScChatPrivate p)
    {
        bool is_cun = moduleChat.friend_Id_key.Exists(a => a == cc);

        if (!is_cun)
        {
            friend_Id_key.Add(cc);//不存在填进去
            Queue <ScChatPrivate> privateinfo = new Queue <ScChatPrivate>();
            privateinfo.Enqueue(p);
            friend_chat_record.Add(cc, privateinfo);
        }
        else
        {
            Queue <ScChatPrivate> outpinfo;
            friend_chat_record.TryGetValue(cc, out outpinfo);
            if (outpinfo != null)
            {
                friend_chat_record.Remove(cc);
                if (outpinfo.Count >= ChatNum)
                {
                    outpinfo.Dequeue();
                }
                outpinfo.Enqueue(p);
                friend_chat_record.Add(cc, outpinfo);
            }
        }
    }
Example #4
0
    public ScChatPrivate SetPrivate(ulong id, int type, string cont, string tag)
    {
        ScChatPrivate player = PacketObject.Create <ScChatPrivate>();

        player.sendId  = id;
        player.type    = (sbyte)type;
        player.content = cont;
        player.tag     = tag;
        return(player);
    }
Example #5
0
    void _Packet(ScChatPrivate p)
    {
        var black = moduleFriend.BlackList.Exists(a => a.roleId == p.sendId);

        if (black)
        {
            return;
        }

        ScChatPrivate pp  = p.Clone();
        var           tag = Util.Parse <int>(p.tag);

        if (tag == 1 || tag == 3)
        {
            //组队邀请图标出现
            moduleHome.UpdateIconState(HomeIcons.Friend, true, 1);
            //记录 存储为有组队信息
            moduleFriend.TeamHintCD   = GeneralConfigInfo.defaultConfig.TeamHintCD;//重置时间
            moduleFriend.TimeHintShow = true;
            var team = moduleFriend.TeamInvate.Exists(a => a == pp.sendId);
            if (!team)
            {
                moduleFriend.TeamInvate.Add(pp.sendId);
                moduleFriend.FriendList = moduleFriend.SortWay();
            }
        }
        else if (tag == 2)
        {
            if (moduleAwakeMatch.IsTeamMember(pp.sendId))
            {
                team_chat_record.Enqueue(pp);
            }
            m_newTeamMes = true;
            DispatchModuleEvent(EventChatRecTeamMes, pp);
            return;
        }

        moduleHome.UpdateIconState(HomeIcons.Friend, true);
        HavePastMes = true;

        ChatJilu(pp.sendId, pp);

        Late_reset(pp.sendId);//我收到一条消息 所以是一条置顶
        //playerid 在哪个好友的聊天记录里 type 发送的内容形式 matter 发送的具体内容 send_id 是我发的还是对方发的
        //moduleChat.Record(cc.ToString(), pp.type.ToString(), pp.content, cc.ToString());
        bool canaddlevel = past_mes.Exists(a => a == pp.sendId);

        if (!canaddlevel)
        {
            past_mes.Add(pp.sendId);
        }

        DispatchModuleEvent(EventChatRecFriendMes, pp);
    }
Example #6
0
    void _Packet(ScFriendAgree p)
    {
        //同意结果
        ScFriendAgree pp = p.Clone();

        if (pp.result == 0)
        {
            if (pp.friend_ == null)
            {
                return;
            }
            var apply = Apply_playerList.Find(a => a.roleId == pp.friend_.roleId);
            if (apply != null)
            {
                RemoveApply(apply);
            }

            //添加好友信息 每当我在申请列表里统一的时候
            FriendList.Add(pp.friend_);                       //好友的详细信息加进去了
            My_FriendList.Add(pp.friend_.roleId, pp.friend_); //把这个信息加进去

            ulong         idid = pp.friend_.roleId;
            ScChatPrivate hjhj = moduleChat.SetPrivate(pp.friend_.roleId, 0, ConfigText.GetDefalutString(218, 44), "0");

            //填进聊天记录
            moduleChat.ChatJilu(idid, hjhj);//添加入friend_Id_key和friend_chat_recor

            if (modulePlayer.BanChat != 2)
            {
                moduleChat.SendFriendMessage(hjhj.content, hjhj.type, pp.friend_.roleId); //发一条消息
            }
            moduleChat.Late_reset(idid);                                                  //这里添加到最近里
            moduleFriend.FriendList = moduleFriend.SortWay();
            DispatchModuleEvent(EventFriendAgree, pp.friend_);
        }
        else if (pp.result == 1 || pp.result == 4)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(218, 52));
            SendReplyRefusedMes(p.applyId);
        }
        else if (pp.result == 2)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(218, 13));
        }
        else if (pp.result == 3)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(218, 53));
        }
        else
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(218, 44));
        }
    }
Example #7
0
    public void GetChatjilu()
    {
        friend_chat_record.Clear();
        friend_Id_key.Clear();
        past_mes.Clear();

        PMessage[] meslist = localMessage.messages;
        for (int i = 0; i < meslist.Length; i++)
        {
            if (meslist[i].tag == "2")
            {
                continue;
            }

            ulong Chatid = meslist[i].from;
            if (meslist[i].from == modulePlayer.roleInfo.roleId)
            {
                Chatid = meslist[i].to;
            }

            //如果是离线消息则加进去
            if (meslist[i].leave)
            {
                Islevel(meslist[i]);
            }
            else
            {
                ScChatPrivate scf = SetPrivate(meslist[i].from, meslist[i].type, meslist[i].content, meslist[i].tag);

                Queue <ScChatPrivate> past;
                friend_chat_record.TryGetValue(Chatid, out past);
                if (past == null)
                {
                    past = new Queue <ScChatPrivate>();
                }
                else
                {
                    friend_chat_record.Remove(Chatid);
                    friend_Id_key.Remove(Chatid);
                }
                if (past.Count >= ChatNum)
                {
                    past.Dequeue();
                }
                past.Enqueue(scf);
                friend_chat_record.Add(Chatid, past);
                friend_Id_key.Add(Chatid);
            }
        }
    }
Example #8
0
    private void Islevel(PMessage mess)//如果是离线消息
    {
        if (mess.leave)
        {
            ulong ididid = mess.from;
            if (mess.from == modulePlayer.roleInfo.roleId)
            {
                ididid = mess.to;
            }

            bool o = friend_Id_key.Exists(a => a == ididid);

            Queue <ScChatPrivate> chat;
            ScChatPrivate         scchat = SetPrivate(ididid, mess.type, mess.content, mess.tag);

            bool canaddlevel = past_mes.Exists(a => a == ididid);
            if (!canaddlevel)
            {
                moduleHome.UpdateIconState(HomeIcons.Friend, true);
                HavePastMes = true;
                past_mes.Add(ididid);
            }

            if (o)
            {
                friend_chat_record.TryGetValue(ididid, out chat);
                if (chat != null)
                {
                    if (chat.Count >= ChatNum)
                    {
                        chat.Dequeue();
                    }
                    chat.Enqueue(scchat);
                    friend_chat_record.Remove(ididid);
                    friend_chat_record.Add(ididid, chat);
                }
            }
            else
            {
                Queue <ScChatPrivate> ppp = new Queue <ScChatPrivate>();
                ppp.Enqueue(scchat);
                friend_chat_record.Add(ididid, ppp);
                friend_Id_key.Add(ididid);
            }
            // Record(ididid.ToString(), typea.ToString(), conten, ididid.ToString());
        }
    }
Example #9
0
    private void RecieveMsg(ScChatPrivate msg)
    {
        if (!moduleAwakeMatch.IsTeamMember(msg.sendId))
        {
            return;
        }
        var info = moduleAwakeMatch.GetMatchInfo(msg.sendId);

        var tag = Util.Parse <int>(msg.tag);

        if (tag == 2)
        {
            tag = 0;
        }
        AllChatMesClone(false, msg.type, msg.content, other_speak, info.roleName, info.avatar, info.roleId, info.gender, info.headBox, info.roleProto, tag);

        moduleChat.DispatchModuleEvent(Module_Chat.EventChatSeeTeamMsg);
    }