Пример #1
0
 public void AddPrivateChatData(long playerId, ChatDataStruct chatData)
 {
     if (privateChatDataDic.ContainsKey(playerId))
     {
         privateChatDataDic[playerId].Add(chatData);
     }
     else
     {
         privateChatDataDic.Add(playerId, new List <ChatDataStruct> ()
         {
             chatData
         });
     }
 }
Пример #2
0
        private void HandForwardChatFeedback(byte[] data)
        {
            ForwardChatS2C feedback = ProtobufUtils.Deserialize <ForwardChatS2C>(data);

            ChatPlayerInfo chatPlayerInfo = feedback.chatPlayerInfo;
            ChatDataStruct chatData       = new ChatDataStruct();

            chatData.chatPlayerInfo = chatPlayerInfo;
            chatData.message        = feedback.chatContent;
            chatData.playerId       = feedback.sendPlayerId;

            if (DataManager.GetInstance().GetPlayerId() != feedback.sendPlayerId)
            {
                chatData.isLeft = true;
            }
            else
            {
                chatData.isLeft = false;
            }

            if (feedback.chatConsumptionType == ChatConsumptionType.ChatItem)
            {
                MessageDispatcher.PostMessage(Constants.MessageType.RefreshHornNotificationData, chatData);
                return;
            }

            switch (feedback.chatType)
            {
            case ChatType.WorldChat:

                worldChatDataList.Add(chatData);

                break;

            case ChatType.FriendsChat:

                AddPrivateChatData(feedback.sendPlayerId, chatData);

                break;

            case ChatType.GuildChat:

                break;
            }

            MessageDispatcher.PostMessage(Constants.MessageType.RefreshPlayerChatData, feedback.chatType, feedback.sendPlayerId);
        }