Shift player palette definitions onto the player/client. Needs ui; for now everyone is teal.

This commit is contained in:
Paul Chote
2010-07-16 20:51:20 +12:00
parent 84ac8d9d16
commit 8abc8e03cb
11 changed files with 54 additions and 144 deletions

View File

@@ -23,38 +23,11 @@ using OpenRA.FileFormats;
namespace OpenRA.Traits
{
public class PlayerColorPaletteInfo : ITraitInfo
public class PlayerColorPaletteInfo : TraitInfo<PlayerColorPalette>
{
public readonly string Name = null;
public readonly string DisplayName = null;
public readonly string BasePalette = null;
public readonly int[] Color1 = { 255, 255, 255 };
public readonly int[] Color2 = { 0, 0, 0 };
public readonly bool SplitRamp = false;
public readonly int[] DisplayColor = null;
public readonly bool Playable = true;
public object Create(ActorInitializer init) { return new PlayerColorPalette(init.world, this); }
public Color Color { get { return Util.ArrayToColor(DisplayColor); } }
}
public class PlayerColorPalette
{
public PlayerColorPalette(World world, PlayerColorPaletteInfo info)
{
var wr = world.WorldRenderer;
var pal = wr.GetPalette(info.BasePalette);
var newpal = new Palette(pal, new PlayerColorRemap(
Util.ArrayToColor(info.Color1),
Util.ArrayToColor(info.Color2),
info.SplitRamp));
wr.AddPalette(info.Name, newpal);
}
}
public class PlayerColorPalette {}
}