diff --git a/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs b/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs index 7865b835f4..9f2b34e269 100644 --- a/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs +++ b/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs @@ -27,6 +27,7 @@ namespace OpenRA.Mods.Cnc { CncColorPickerPaletteModifierInfo Info; PaletteFormat format; + public ColorRamp Ramp; public CncColorPickerPaletteModifier(CncColorPickerPaletteModifierInfo info) { Info = info; } @@ -42,7 +43,7 @@ namespace OpenRA.Mods.Cnc public void AdjustPalette(Dictionary palettes) { palettes["colorpicker"] = new Palette(palettes["colorpicker"], - new PlayerColorRemap(CncLobbyLogic.CurrentColorPreview, format)); + new PlayerColorRemap(Ramp, format)); } } } diff --git a/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs index c3cd145861..7e578d6072 100755 --- a/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncLobbyLogic.cs @@ -31,11 +31,12 @@ namespace OpenRA.Mods.Cnc.Widgets string MapUid; Map Map; + CncColorPickerPaletteModifier PlayerPalettePreview; + readonly Action OnGameStart; readonly Action onExit; readonly OrderManager orderManager; - public static ColorRamp CurrentColorPreview; static bool staticSetup; public static CncLobbyLogic GetHandler() { @@ -118,6 +119,7 @@ namespace OpenRA.Mods.Cnc.Widgets [ObjectCreator.UseCtor] internal CncLobbyLogic([ObjectCreator.Param( "widget" )] Widget lobby, + [ObjectCreator.Param] World world, // Shellmap world [ObjectCreator.Param] OrderManager orderManager, [ObjectCreator.Param] Action onExit, [ObjectCreator.Param] Action onStart) @@ -136,8 +138,8 @@ namespace OpenRA.Mods.Cnc.Widgets } UpdateCurrentMap(); - CurrentColorPreview = Game.Settings.Player.ColorRamp; - + PlayerPalettePreview = world.WorldActor.Trait(); + PlayerPalettePreview.Ramp = Game.Settings.Player.ColorRamp; Players = lobby.GetWidget("PLAYERS"); LocalPlayerTemplate = Players.GetWidget("TEMPLATE_LOCAL"); RemotePlayerTemplate = Players.GetWidget("TEMPLATE_REMOTE"); @@ -399,7 +401,7 @@ namespace OpenRA.Mods.Cnc.Widgets Action onChange = c => { - CurrentColorPreview = c; + PlayerPalettePreview.Ramp = c; }; var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs() @@ -409,8 +411,6 @@ namespace OpenRA.Mods.Cnc.Widgets { "initialRamp", orderManager.LocalClient.ColorRamp } }); - Console.WriteLine(colorChooser.Id); - CncDropDownButtonWidget.ShowDropPanel(color, colorChooser, new List() { colorChooser.GetWidget("SAVE_BUTTON") }, () => true); return true; }