示例#1
0
 public MyPlayerChatHistory(MyObjectBuilder_PlayerChatHistory chatBuilder)
     : this(chatBuilder.IdentityId)
 {
     if (chatBuilder.Chat != null)
     {
         m_chat = new Queue <MyPlayerChatItem>(chatBuilder.Chat.Count);
         foreach (var chatItem in chatBuilder.Chat)
         {
             MyPlayerChatItem newChatItem = new MyPlayerChatItem();
             newChatItem.Init(chatItem);
             m_chat.Enqueue(newChatItem);
         }
     }
     else
     {
         m_chat = new Queue <MyPlayerChatItem>();
     }
 }
示例#2
0
        public void AddPlayerChatItem(MyPlayerChatItem chatItem, long senderId)
        {
            MyPlayerChatHistory playerChat;

            if (PlayerChatHistory.TryGetValue(senderId, out playerChat))
            {
                if (playerChat.Chat.Count == MyChatConstants.MAX_PLAYER_CHAT_HISTORY_COUNT)
                {
                    playerChat.Chat.Dequeue();
                }
                playerChat.Chat.Enqueue(chatItem);
            }
            else
            {
                var newChatHistory = new Entities.Character.MyPlayerChatHistory(senderId);
                newChatHistory.Chat.Enqueue(chatItem);

                PlayerChatHistory.Add(senderId, newChatHistory);
            }
        }
示例#3
0
 public static void AddPlayerChatItem(long localPlayerId, long remotePlayerId, MyPlayerChatItem chatItem)
 {
     GetChatHistory(localPlayerId).AddPlayerChatItem(chatItem, remotePlayerId);
 }
示例#4
0
 public MyPlayerChatHistory(MyObjectBuilder_PlayerChatHistory chatBuilder)
     : this(chatBuilder.IdentityId)
 {
     if (chatBuilder.Chat != null)
     {
         m_chat = new Queue<MyPlayerChatItem>(chatBuilder.Chat.Count);
         foreach (var chatItem in chatBuilder.Chat)
         {
             MyPlayerChatItem newChatItem = new MyPlayerChatItem();
             newChatItem.Init(chatItem);
             m_chat.Enqueue(newChatItem);
         }
     }
     else
     {
         m_chat = new Queue<MyPlayerChatItem>();
     }
 }
示例#5
0
 public void AddPlayerChatItem(MyPlayerChatItem chatItem, long senderId)
 {
     MyPlayerChatHistory playerChat;
     if (PlayerChatHistory.TryGetValue(senderId, out playerChat))
     {
         if (playerChat.Chat.Count == MyChatConstants.MAX_PLAYER_CHAT_HISTORY_COUNT)
         {
             playerChat.Chat.Dequeue();
         }
         playerChat.Chat.Enqueue(chatItem);
     }
     else
     {
         var newChatHistory = new Entities.Character.MyPlayerChatHistory(senderId);
         newChatHistory.Chat.Enqueue(chatItem);
         
         PlayerChatHistory.Add(senderId, newChatHistory);
     }
 }