Rewrite sequence loading logic.

Multiple layers of Lazy<T>ness are replaced with
an explicit two-part loading scheme.

Sequences are parsed immediately, without the need
for the sprite assets, and tell the SpriteCache
which frames they need. Use-cases that want the
actual sprites can then tell the SpriteCache to
load the frames and the sequences to resolve the
sprites.
This commit is contained in:
Paul Chote
2023-03-09 20:39:17 +00:00
committed by Gustas
parent 1f3403717b
commit c35ab081ff
21 changed files with 780 additions and 632 deletions

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Graphics
public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
{
return new ClassicSpriteSequence(modData, tileset, cache, this, image, sequence, data, defaults);
return new ClassicSpriteSequence(cache, this, image, sequence, data, defaults);
}
}
@@ -33,8 +33,8 @@ namespace OpenRA.Mods.Cnc.Graphics
static readonly SpriteSequenceField<bool> UseClassicFacings = new SpriteSequenceField<bool>(nameof(UseClassicFacings), false);
readonly bool useClassicFacings;
public ClassicSpriteSequence(ModData modData, string tileSet, SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults)
: base(modData, tileSet, cache, loader, image, sequence, data, defaults)
public ClassicSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults)
: base(cache, loader, image, sequence, data, defaults)
{
useClassicFacings = LoadField(UseClassicFacings, data, defaults);