Esempio n. 1
0
    public void AddChat(GameCmd.stCommonMChatUserCmd_CS cmd)
    {
        if (cmd.byChatType != CHATTYPE.CHAT_SILENT)
        {
            return;
        }
        if (!ChatDataManager.CanRecieveChatMsgWithBlack(cmd.dwOPDes))
        {
            //Engine.Utility.Log.Info("player {0} is in black not recieve chat msg!", cmd.dwOPDes);
            return;
        }

        CircularQueue <ChatInfo> chatList;

        if (!m_dictChatInfo.TryGetValue(cmd.dwOPDes, out chatList))
        {
            chatList = new CircularQueue <ChatInfo>()
            {
                Capacity = 50
            };
            m_dictChatInfo.Add(cmd.dwOPDes, chatList);
            m_dictMsgTips[cmd.dwOPDes] = false;
        }

        ChatInfo chatInfo = ToChatInfo(cmd);

        chatList.Enqueue(chatInfo);

        if (chatInfo.Id != 0)
        {
            if (chatInfo.IsMe)
            {
                //DateTime UnixBase = new DateTime(1970, 1, 1, 0, 0, 0);
                //TimeSpan ts = (UserData.ServerTime - UnixBase );

                //chatInfo.Timestamp = (uint)ts.TotalSeconds - (uint)UserData.ServerTimeDelta;
                chatInfo.Timestamp = (uint)DateTimeHelper.Instance.Now;
            }
            UpdateMsgTipsUI(chatInfo);
            DataManager.Manager <RelationManager>().UpdateContactTimestamp(chatInfo.Id, chatInfo.Timestamp);
        }
        else
        {
            UpdateMsgTipsUI(chatInfo);
        }
    }
Esempio n. 2
0
 private void SendMyChatCmdM(GameCmd.stCommonMChatUserCmd_CS cmd)
 {
     cmd.szOPDes = Client.ClientGlobal.Instance().MainPlayer.GetName();
     AddChat(cmd);
 }
Esempio n. 3
0
 ChatInfo ToChatInfo(GameCmd.stCommonMChatUserCmd_CS cmd)
 {
     return(ToChatInfo(cmd.dwOPDes, cmd.szInfo, cmd.szOPDes, cmd.byChatType, (uint)cmd.profession, cmd.timestamp, cmd.voiceFildId, cmd.voiceLength));
 }