diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerBrowserLogic.cs index 567d6bdcc0..72ee81d390 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerBrowserLogic.cs @@ -24,6 +24,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic { static readonly Action DoNothing = () => { }; + readonly Color incompatibleProtectedGameColor; + readonly Color protectedGameColor; + readonly Color incompatibleWaitingGameColor; + readonly Color waitingGameColor; + readonly Color incompatibleGameStartedColor; + readonly Color gameStartedColor; + readonly Color incompatibleGameColor; + readonly Color cantJoinGameColor; + GameServer currentServer; ScrollItemWidget serverTemplate; ScrollItemWidget headerTemplate; @@ -57,6 +66,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic panel = widget; this.onStart = onStart; + incompatibleGameColor = ChromeMetrics.Get("IncompatibleGameColor"); + cantJoinGameColor = ChromeMetrics.Get("CantJoinGameColor"); + protectedGameColor = ChromeMetrics.Get("ProtectedGameColor"); + incompatibleProtectedGameColor = ChromeMetrics.Get("IncompatibleProtectedGameColor"); + waitingGameColor = ChromeMetrics.Get("WaitingGameColor"); + incompatibleWaitingGameColor = ChromeMetrics.Get("IncompatibleWaitingGameColor"); + gameStartedColor = ChromeMetrics.Get("GameStartedColor"); + incompatibleGameStartedColor = ChromeMetrics.Get("IncompatibleGameStartedColor"); + serverList = panel.Get("SERVER_LIST"); headerTemplate = serverList.Get("HEADER_TEMPLATE"); serverTemplate = serverList.Get("SERVER_TEMPLATE"); @@ -217,7 +235,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (title != null) { title.GetText = () => game.Name; - title.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : title.TextColor; + title.GetColor = () => !compatible ? incompatibleGameColor : !canJoin ? cantJoinGameColor : title.TextColor; } var maptitle = item.GetOrNull("MAP"); @@ -232,7 +250,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { players.GetText = () => "{0} / {1}".F(game.Players, game.MaxPlayers) + (game.Spectators > 0 ? " ({0} Spectator{1})".F(game.Spectators, game.Spectators > 1 ? "s" : "") : ""); - players.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : players.TextColor; + players.GetColor = () => !compatible ? incompatibleGameColor : !canJoin ? cantJoinGameColor : players.TextColor; } var state = item.GetOrNull("STATE"); @@ -246,7 +264,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (ip != null) { ip.GetText = () => game.Address; - ip.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : ip.TextColor; + ip.GetColor = () => !compatible ? incompatibleGameColor : !canJoin ? cantJoinGameColor : ip.TextColor; } var location = item.GetOrNull("LOCATION"); @@ -254,7 +272,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var cachedServerLocation = GeoIP.LookupCountry(game.Address.Split(':')[0]); location.GetText = () => cachedServerLocation; - location.GetColor = () => !compatible ? Color.DarkGray : !canJoin ? Color.LightGray : location.TextColor; + location.GetColor = () => !compatible ? incompatibleGameColor : !canJoin ? cantJoinGameColor : location.TextColor; } rows.Add(item); @@ -362,16 +380,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic return "Unknown server state"; } - static Color GetStateColor(GameServer game, LabelWidget label, bool darkened) + Color GetStateColor(GameServer game, LabelWidget label, bool darkened) { if (game.Protected && game.State == (int)ServerState.WaitingPlayers) - return darkened ? Color.DarkRed : Color.Red; + return darkened ? incompatibleProtectedGameColor : protectedGameColor; if (game.State == (int)ServerState.WaitingPlayers) - return darkened ? Color.LimeGreen : Color.Lime; + return darkened ? incompatibleWaitingGameColor : waitingGameColor; if (game.State == (int)ServerState.GameStarted) - return darkened ? Color.Chocolate : Color.Orange; + return darkened ? incompatibleGameStartedColor : gameStartedColor; return label.TextColor; } diff --git a/mods/cnc/metrics.yaml b/mods/cnc/metrics.yaml index 81e18610c7..64dcaa7846 100644 --- a/mods/cnc/metrics.yaml +++ b/mods/cnc/metrics.yaml @@ -25,3 +25,11 @@ Metrics: SpawnColor: 255,255,255 SpawnContrastColor: 0,0,0 SpawnLabelOffset: 0,1 + IncompatibleGameColor: 169,169,169 + CantJoinGameColor: 211,211,211 + ProtectedGameColor: 255,0,0 + IncompatibleProtectedGameColor: 139,0,0 + WaitingGameColor: 0,255,0 + IncompatibleWaitingGameColor: 50,205,50 + GameStartedColor: 255,165,0 + IncompatibleGameStartedColor: 210,105,30 \ No newline at end of file diff --git a/mods/d2k/metrics.yaml b/mods/d2k/metrics.yaml index b0cd208e75..895fd06d63 100644 --- a/mods/d2k/metrics.yaml +++ b/mods/d2k/metrics.yaml @@ -25,3 +25,11 @@ Metrics: SpawnColor: 255,255,255 SpawnContrastColor: 0,0,0 SpawnLabelOffset: 0,1 + IncompatibleGameColor: 169,169,169 + CantJoinGameColor: 211,211,211 + ProtectedGameColor: 255,0,0 + IncompatibleProtectedGameColor: 139,0,0 + WaitingGameColor: 0,255,0 + IncompatibleWaitingGameColor: 50,205,50 + GameStartedColor: 255,165,0 + IncompatibleGameStartedColor: 210,105,30 \ No newline at end of file diff --git a/mods/ra/metrics.yaml b/mods/ra/metrics.yaml index 7e05014dc7..703550e5dc 100644 --- a/mods/ra/metrics.yaml +++ b/mods/ra/metrics.yaml @@ -32,3 +32,11 @@ Metrics: RaceSuffix-soviet: soviet RaceSuffix-russia: soviet RaceSuffix-ukraine: soviet + IncompatibleGameColor: 169,169,169 + CantJoinGameColor: 211,211,211 + ProtectedGameColor: 255,0,0 + IncompatibleProtectedGameColor: 139,0,0 + WaitingGameColor: 0,255,0 + IncompatibleWaitingGameColor: 50,205,50 + GameStartedColor: 255,165,0 + IncompatibleGameStartedColor: 210,105,30 \ No newline at end of file diff --git a/mods/ts/metrics.yaml b/mods/ts/metrics.yaml index ee97b3c6f5..c079cfcac9 100644 --- a/mods/ts/metrics.yaml +++ b/mods/ts/metrics.yaml @@ -25,3 +25,11 @@ Metrics: SpawnColor: 255,255,255 SpawnContrastColor: 0,0,0 SpawnLabelOffset: 0,1 + IncompatibleGameColor: 169,169,169 + CantJoinGameColor: 211,211,211 + ProtectedGameColor: 255,0,0 + IncompatibleProtectedGameColor: 139,0,0 + WaitingGameColor: 0,255,0 + IncompatibleWaitingGameColor: 50,205,50 + GameStartedColor: 255,165,0 + IncompatibleGameStartedColor: 210,105,30 \ No newline at end of file