Split chat lines into pools

- Add a common class for passing around chat lines
- Add wrapper methods for adding chat lines
- Combine repeated chat lines in the display widget
This commit is contained in:
Ivaylo Draganov
2020-02-29 22:31:29 +02:00
committed by Paul Chote
parent 0a02bd524a
commit 6af354ff99
11 changed files with 175 additions and 88 deletions

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Network
if (orderManager.LocalClient != null && client != orderManager.LocalClient && client.Team > 0 && client.Team == orderManager.LocalClient.Team)
suffix += " (Ally)";
TextNotificationsManager.AddChatLine(client.Name + suffix, client.Color, message);
TextNotificationsManager.AddChatLine(client.Name + suffix, message, client.Color);
break;
}
@@ -79,7 +79,7 @@ namespace OpenRA.Network
{
var prefix = order.ExtraData == uint.MaxValue ? "[Spectators] " : "[Team] ";
if (orderManager.LocalClient != null && client.Team == orderManager.LocalClient.Team)
TextNotificationsManager.AddChatLine(prefix + client.Name, client.Color, message);
TextNotificationsManager.AddChatLine(prefix + client.Name, message, client.Color);
break;
}
@@ -93,7 +93,7 @@ namespace OpenRA.Network
{
// Validate before adding the line
if (client.IsObserver || (player != null && player.WinState != WinState.Undefined))
TextNotificationsManager.AddChatLine("[Spectators] " + client.Name, client.Color, message);
TextNotificationsManager.AddChatLine("[Spectators] " + client.Name, message, client.Color);
break;
}
@@ -103,7 +103,7 @@ namespace OpenRA.Network
&& world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined;
if (valid && (isSameTeam || world.IsReplay))
TextNotificationsManager.AddChatLine("[Team" + (world.IsReplay ? " " + order.ExtraData : "") + "] " + client.Name, client.Color, message);
TextNotificationsManager.AddChatLine("[Team" + (world.IsReplay ? " " + order.ExtraData : "") + "] " + client.Name, message, client.Color);
break;
}