private void LoadChatHistory(MyObjectBuilder_Checkpoint checkpoint) { if (MyFakes.ENABLE_COMMUNICATION) { foreach (var chatHistory in checkpoint.ChatHistory) { var newChatHistory = new MyChatHistory(chatHistory); ChatHistory.Add(chatHistory.IdentityId, newChatHistory); } foreach (var chatHistory in checkpoint.FactionChatHistory) { FactionChatHistory.Add(new MyFactionChatHistory(chatHistory)); } } }
static private void ConfirmMessage(long factionId1, long factionId2, long originalSenderId, long timestampTicks, long receiverId, string text, long localPlayerId) { MyChatHistory chatHistory; if (!MySession.Static.ChatHistory.TryGetValue(localPlayerId, out chatHistory)) { chatHistory = new MyChatHistory(localPlayerId); } var timestamp = new TimeSpan(timestampTicks); var chatItem = FindFactionChatItem(localPlayerId, factionId1, factionId2, timestamp, text); if (chatItem != null) { chatItem.PlayersToSendTo[receiverId] = true; if (!MySandboxGame.IsDedicated) { MySession.Static.ChatSystem.OnNewFactionMessage(factionId1, factionId2, originalSenderId, false); } } else { Debug.Fail("Could not find faction chat history between faction " + factionId1 + " and " + factionId2); } }
private static void ConfirmMessage(ref ConfirmFactionMessageMsg message, long localPlayerId) { MyChatHistory chatHistory; if (!MySession.Static.ChatHistory.TryGetValue(localPlayerId, out chatHistory)) { chatHistory = new MyChatHistory(localPlayerId); } var timestamp = new TimeSpan(message.Timestamp); var chatItem = FindFactionChatItem(localPlayerId, message.FactionId1, message.FactionId2, timestamp, message.Text); if (chatItem != null) { chatItem.PlayersToSendTo[message.ReceiverId] = true; if (!MySandboxGame.IsDedicated) { MySession.Static.ChatSystem.OnNewFactionMessage(message.FactionId1, message.FactionId2, message.OriginalSenderId, false); } } else { Debug.Fail("Could not find faction chat history between faction " + message.FactionId1 + " and " + message.FactionId2); } }