Add an EditorTilesetFilter trait for filtering the actor palette based on tileset.

This commit is contained in:
Paul Chote
2011-07-27 02:56:29 +12:00
parent 9f7c5791f9
commit 17d72f17d9
3 changed files with 28 additions and 0 deletions

View File

@@ -155,6 +155,13 @@ namespace OpenRA.Editor
{
var info = Rules.Info[a];
if (!info.Traits.Contains<RenderSimpleInfo>()) continue;
var etf = info.Traits.GetOrDefault<EditorTilesetFilterInfo>();
if (etf != null && etf.ExcludeTilesets != null
&& etf.ExcludeTilesets.Contains(tileset.Id)) continue;
if (etf != null && etf.RequireTilesets != null
&& !etf.RequireTilesets.Contains(tileset.Id)) continue;
var template = RenderUtils.RenderActor(info, tileset, palette);
var ibox = new PictureBox
{

View File

@@ -184,6 +184,7 @@
<Compile Include="Download.cs" />
<Compile Include="ActorMap.cs" />
<Compile Include="Graphics\AnimationWithOffset.cs" />
<Compile Include="Traits\EditorTilesetFilter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,20 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
namespace OpenRA.Traits
{
public class EditorTilesetFilterInfo : TraitInfo<EditorTilesetFilter>
{
public readonly string[] RequireTilesets = null;
public readonly string[] ExcludeTilesets = null;
}
public class EditorTilesetFilter { }
}