Include all the relevant palettes in the asset browser.

This commit is contained in:
Paul Chote
2015-04-16 19:03:26 +01:00
parent c4a63eee30
commit 8b7453070a
10 changed files with 46 additions and 18 deletions

View File

@@ -8,6 +8,7 @@
*/
#endregion
using System.Collections.Generic;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Traits;
@@ -26,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public object Create(ActorInitializer init) { return new PaletteFromCurrentTileset(init.World, this); }
}
class PaletteFromCurrentTileset : ILoadsPalettes
class PaletteFromCurrentTileset : ILoadsPalettes, IProvidesAssetBrowserPalettes
{
readonly World world;
readonly PaletteFromCurrentTilesetInfo info;
@@ -41,5 +42,7 @@ namespace OpenRA.Mods.Common.Traits
{
wr.AddPalette(info.Name, new ImmutablePalette(GlobalFileSystem.Open(world.TileSet.Palette), info.ShadowIndex), info.AllowModifiers);
}
public IEnumerable<string> PaletteNames { get { yield return info.Name; } }
}
}