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>(); } }
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); } }
public static void AddPlayerChatItem(long localPlayerId, long remotePlayerId, MyPlayerChatItem chatItem) { GetChatHistory(localPlayerId).AddPlayerChatItem(chatItem, remotePlayerId); }
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>(); } }