Shift player palette definitions onto the player/client. Needs ui; for now everyone is teal.
This commit is contained in:
@@ -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 {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user