unify C&C and RA colorpicker palette manipulation code

This commit is contained in:
Chris Forbes
2011-10-18 20:00:24 +13:00
parent bc6af1841b
commit 89ea4d1e0a
8 changed files with 20 additions and 64 deletions

View File

@@ -16,6 +16,7 @@ using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Traits;
using OpenRA.Widgets;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Widgets.Logic;
namespace OpenRA.Mods.Cnc.Widgets.Logic
@@ -32,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
string MapUid;
Map Map;
CncColorPickerPaletteModifier PlayerPalettePreview;
ColorPickerPaletteModifier PlayerPalettePreview;
readonly Action OnGameStart;
readonly Action onExit;
@@ -102,7 +103,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
Game.ConnectionStateChanged += ConnectionStateChanged;
UpdateCurrentMap();
PlayerPalettePreview = world.WorldActor.Trait<CncColorPickerPaletteModifier>();
PlayerPalettePreview = world.WorldActor.Trait<ColorPickerPaletteModifier>();
PlayerPalettePreview.Ramp = Game.Settings.Player.ColorRamp;
Players = lobby.GetWidget<ScrollPanelWidget>("PLAYERS");
EditablePlayerTemplate = Players.GetWidget("TEMPLATE_EDITABLE_PLAYER");

View File

@@ -14,6 +14,7 @@ using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.GameRules;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Widgets.Logic;
using OpenRA.Widgets;
@@ -24,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
enum PanelType { General, Input }
PanelType Settings = PanelType.General;
CncColorPickerPaletteModifier playerPalettePreview;
ColorPickerPaletteModifier playerPalettePreview;
World world;
[ObjectCreator.UseCtor]
@@ -53,7 +54,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var nameTextfield = generalPane.GetWidget<TextFieldWidget>("NAME_TEXTFIELD");
nameTextfield.Text = playerSettings.Name;
playerPalettePreview = world.WorldActor.Trait<CncColorPickerPaletteModifier>();
playerPalettePreview = world.WorldActor.Trait<ColorPickerPaletteModifier>();
playerPalettePreview.Ramp = playerSettings.ColorRamp;
var colorDropdown = generalPane.GetWidget<DropDownButtonWidget>("COLOR_DROPDOWN");