diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs index b47a68617..28a2c716c 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/GameLobbyBase.cs @@ -255,7 +255,7 @@ public override void Initialize() ddGameModeMapFilter.AddItem(CreateGameFilterItem(gm.UIName, new GameModeMapFilter(GetGameModeMaps(gm)))); lblGameModeSelect = FindChild(nameof(lblGameModeSelect)); - + InitBtnMapSort(); tbMapSearch = FindChild(nameof(tbMapSearch)); @@ -784,9 +784,14 @@ protected void InitPlayerOptionDropdowns() ddPlayerColor.ClientRectangle = new Rectangle( ddPlayerSide.Right + playerOptionHorizontalMargin, ddPlayerName.Y, colorWidth, DROP_DOWN_HEIGHT); - ddPlayerColor.AddItem("Random".L10N("UI:Main:RandomColor"), AssetLoader.GetColorFromString(randomColor)); + ddPlayerColor.AddItem(MultiplayerColor.GetRandomColorLabel(), AssetLoader.GetColorFromString(randomColor)); foreach (MultiplayerColor mpColor in MPColors) - ddPlayerColor.AddItem(mpColor.Name, mpColor.XnaColor); + { + if(mpColor.Name.StartsWith("$")) + ddPlayerColor.AddItem(string.Empty, AssetLoader.CreateTexture(mpColor.XnaColor, ddPlayerColor.Width - 2, ddPlayerColor.ItemHeight)); + else + ddPlayerColor.AddItem(mpColor.Name, mpColor.XnaColor); + } ddPlayerColor.AllowDropDown = false; ddPlayerColor.SelectedIndexChanged += CopyPlayerDataFromUI; ddPlayerColor.Tag = false; diff --git a/DXMainClient/Domain/Multiplayer/MultiplayerColor.cs b/DXMainClient/Domain/Multiplayer/MultiplayerColor.cs index 14224bbd7..fe2dc9ad1 100644 --- a/DXMainClient/Domain/Multiplayer/MultiplayerColor.cs +++ b/DXMainClient/Domain/Multiplayer/MultiplayerColor.cs @@ -3,6 +3,7 @@ using Rampastring.Tools; using System; using System.Collections.Generic; +using Localization; namespace DTAClient.Domain.Multiplayer { @@ -17,6 +18,10 @@ public class MultiplayerColor private static List colorList; + private static string randomColorLabel; + + private static readonly string RandomColorDefaultLabel = "Random".L10N("UI:Main:RandomSide"); + /// /// Creates a new multiplayer color from data in a string array. /// @@ -68,8 +73,15 @@ public static List LoadColors() } } + var randomColorSection = gameOptionsIni.GetSection("MPColorsRandomLabel"); + if (randomColorSection != null) + randomColorLabel = randomColorSection.GetStringValue("Text", null); + colorList = mpColors; return new List(colorList); } + + public static string GetRandomColorLabel() + => string.IsNullOrEmpty(randomColorLabel) ? RandomColorDefaultLabel : randomColorLabel; } } diff --git a/DXMainClient/Resources/DTA/GameOptions.ini b/DXMainClient/Resources/DTA/GameOptions.ini index 69ed39467..72176c04b 100644 --- a/DXMainClient/Resources/DTA/GameOptions.ini +++ b/DXMainClient/Resources/DTA/GameOptions.ini @@ -11,6 +11,8 @@ ReservedStartingLocationAngularVelocity=0.01 RandomColor=136,121,114 ;189,166,111 matches civilian color ; The multiplayer colors. Syntax: =R,G,B, +; To show actual colors instead of color names/labels, prefix each key with "$" + [MPColors] Gold=255,227,140,0 Red=222,77,49,1 @@ -24,6 +26,10 @@ White=255,255,255,15 Pink=255,20,169,35 Cyan=132,239,255,59 ;,53 +[MPColorsRandomLabel] +; This is the text that will appear for the "Random" option in the color drop down +Text=Random + [MultiplayerGameLobby] ; Defines if a side or multiple sides need specific DropDown values to be usable. ; Each side needs 3 entries: side name, DropDown name, and DropDown value index.