untangling WorldRenderer from World
This commit is contained in:
@@ -11,21 +11,21 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets.Delegates;
|
||||
using OpenRA.Widgets.Delegates;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ColorPickerPaletteModifierInfo : TraitInfo<ColorPickerPaletteModifier> {}
|
||||
|
||||
class ColorPickerPaletteModifier : IPaletteModifier, IWorldLoaded
|
||||
class ColorPickerPaletteModifier : IPalette, IPaletteModifier
|
||||
{
|
||||
PaletteFormat format;
|
||||
public void WorldLoaded(World w)
|
||||
{
|
||||
// Copy the base palette for the colorpicker
|
||||
var info = Rules.Info["world"].Traits.Get<PlayerColorPaletteInfo>();
|
||||
public void InitPalette( WorldRenderer wr )
|
||||
{
|
||||
var info = Rules.Info["player"].Traits.Get<PlayerColorPaletteInfo>();
|
||||
format = info.PaletteFormat;
|
||||
w.WorldRenderer.AddPalette("colorpicker", w.WorldRenderer.GetPalette(info.BasePalette));
|
||||
wr.AddPalette("colorpicker", wr.GetPalette(info.BasePalette));
|
||||
}
|
||||
|
||||
public void AdjustPalette(Dictionary<string, Palette> palettes)
|
||||
@@ -33,6 +33,6 @@ namespace OpenRA.Mods.RA
|
||||
palettes["colorpicker"] = new Palette(palettes["colorpicker"],
|
||||
new PlayerColorRemap(LobbyDelegate.CurrentColorPreview1,
|
||||
LobbyDelegate.CurrentColorPreview2, format));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user