Remove TileSetData and separate TileSet from Sequences
This commit is contained in:
@@ -113,7 +113,7 @@ namespace OpenRA
|
||||
|
||||
[FieldLoader.Ignore] Lazy<Ruleset> rules;
|
||||
public Ruleset Rules { get { return rules != null ? rules.Value : null; } }
|
||||
public SequenceProvider SequenceProvider { get; private set; }
|
||||
public SequenceProvider SequenceProvider { get { return Rules.Sequences[Tileset]; } }
|
||||
|
||||
public static Map FromTileset(TileSet tileset)
|
||||
{
|
||||
@@ -246,7 +246,6 @@ namespace OpenRA
|
||||
void PostInit()
|
||||
{
|
||||
rules = Exts.Lazy(() => Game.modData.RulesetCache.LoadMapRules(this));
|
||||
SequenceProvider = new SequenceProvider(this);
|
||||
}
|
||||
|
||||
public Ruleset PreloadRules()
|
||||
|
||||
@@ -12,6 +12,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -24,6 +25,7 @@ namespace OpenRA
|
||||
public readonly IReadOnlyDictionary<string, MusicInfo> Music;
|
||||
public readonly IReadOnlyDictionary<string, string> Movies;
|
||||
public readonly IReadOnlyDictionary<string, TileSet> TileSets;
|
||||
public readonly IReadOnlyDictionary<string, SequenceProvider> Sequences;
|
||||
|
||||
public Ruleset(
|
||||
IDictionary<string, ActorInfo> actors,
|
||||
@@ -32,7 +34,8 @@ namespace OpenRA
|
||||
IDictionary<string, SoundInfo> notifications,
|
||||
IDictionary<string, MusicInfo> music,
|
||||
IDictionary<string, string> movies,
|
||||
IDictionary<string, TileSet> tileSets)
|
||||
IDictionary<string, TileSet> tileSets,
|
||||
IDictionary<string, SequenceProvider> sequences)
|
||||
{
|
||||
this.Actors = new ReadOnlyDictionary<string, ActorInfo>(actors);
|
||||
this.Weapons = new ReadOnlyDictionary<string, WeaponInfo>(weapons);
|
||||
@@ -41,6 +44,7 @@ namespace OpenRA
|
||||
this.Music = new ReadOnlyDictionary<string, MusicInfo>(music);
|
||||
this.Movies = new ReadOnlyDictionary<string, string>(movies);
|
||||
this.TileSets = new ReadOnlyDictionary<string, TileSet>(tileSets);
|
||||
this.Sequences = new ReadOnlyDictionary<string, SequenceProvider>(sequences);
|
||||
}
|
||||
|
||||
public IEnumerable<KeyValuePair<string, MusicInfo>> InstalledMusic { get { return Music.Where(m => m.Value.Exists); } }
|
||||
|
||||
@@ -82,20 +82,6 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
public class TileSetData
|
||||
{
|
||||
Lazy<SpriteLoader> spriteLoader;
|
||||
public SpriteLoader SpriteLoader { get { return spriteLoader.Value; } }
|
||||
|
||||
public readonly SequenceCache SequenceCache;
|
||||
|
||||
public TileSetData(ModData modData, TileSet tileSet)
|
||||
{
|
||||
spriteLoader = Exts.Lazy(() => new SpriteLoader(tileSet.Extensions, new SheetBuilder(SheetType.Indexed)));
|
||||
SequenceCache = new SequenceCache(modData, tileSet);
|
||||
}
|
||||
}
|
||||
|
||||
public class TileSet
|
||||
{
|
||||
public readonly string Name;
|
||||
@@ -111,9 +97,6 @@ namespace OpenRA
|
||||
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "Extensions" };
|
||||
|
||||
[FieldLoader.IgnoreAttribute]
|
||||
public readonly TileSetData Data;
|
||||
|
||||
public TileSet(ModData modData, string filepath)
|
||||
{
|
||||
var yaml = MiniYaml.DictFromFile(filepath);
|
||||
@@ -128,8 +111,6 @@ namespace OpenRA
|
||||
// Templates
|
||||
Templates = yaml["Templates"].NodesDict.Values
|
||||
.Select(y => new TileTemplate(y)).ToDictionary(t => t.Id);
|
||||
|
||||
Data = new TileSetData(modData, this);
|
||||
}
|
||||
|
||||
public TileSet(string name, string id, string palette, string[] extensions)
|
||||
|
||||
Reference in New Issue
Block a user