From fa8ab19dfd95e6ea9fceca4b0dc46556821f5f4a Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 24 Sep 2017 20:51:40 +0100 Subject: [PATCH] Fix global chat history buffer timestamps. --- OpenRA.Mods.Common/Widgets/Logic/GlobalChatLogic.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/GlobalChatLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/GlobalChatLogic.cs index e99e6d6e0e..04b4f4e7ec 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/GlobalChatLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/GlobalChatLogic.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var color = message.Type == ChatMessageType.Notification ? ChromeMetrics.Get("GlobalChatNotificationColor") : ChromeMetrics.Get("GlobalChatPlayerNameColor"); var template = (ContainerWidget)chatTemplate.Clone(); - LobbyUtils.SetupChatLine(template, color, from, message.Message); + LobbyUtils.SetupChatLine(template, color, message.Time, from, message.Message); template.Id = message.UID; return template; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 772cc54b70..7e7a5d9428 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -567,7 +567,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic lobbyChatUnreadMessages += 1; var template = (ContainerWidget)chatTemplate.Clone(); - LobbyUtils.SetupChatLine(template, c, from, text); + LobbyUtils.SetupChatLine(template, c, DateTime.Now, from, text); var scrolledToBottom = lobbyChatPanel.ScrolledToBottom; lobbyChatPanel.AddChild(template); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 2df32c999d..56f5c8a207 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -542,7 +542,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return address; } - public static void SetupChatLine(ContainerWidget template, Color c, string from, string text) + public static void SetupChatLine(ContainerWidget template, Color c, DateTime time, string from, string text) { var nameLabel = template.Get("NAME"); var timeLabel = template.Get("TIME"); @@ -552,7 +552,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic var font = Game.Renderer.Fonts[nameLabel.Font]; var nameSize = font.Measure(from); - var time = DateTime.Now; timeLabel.GetText = () => "{0:D2}:{1:D2}".F(time.Hour, time.Minute); nameLabel.GetColor = () => c;