Read UseSkinSprites when decoding storyboards

This commit is contained in:
Bartłomiej Dach 2020-10-19 23:32:04 +02:00
parent e54836a63e
commit cdd56ece87
2 changed files with 21 additions and 0 deletions

View File

@ -48,6 +48,10 @@ protected override void ParseLine(Storyboard storyboard, Section section, string
switch (section)
{
case Section.General:
handleGeneral(storyboard, line);
return;
case Section.Events:
handleEvents(line);
return;
@ -60,6 +64,18 @@ protected override void ParseLine(Storyboard storyboard, Section section, string
base.ParseLine(storyboard, section, line);
}
private void handleGeneral(Storyboard storyboard, string line)
{
var pair = SplitKeyVal(line);
switch (pair.Key)
{
case "UseSkinSprites":
storyboard.UseSkinSprites = pair.Value == "1";
break;
}
}
private void handleEvents(string line)
{
var depth = 0;

View File

@ -15,6 +15,11 @@ public class Storyboard
public BeatmapInfo BeatmapInfo = new BeatmapInfo();
/// <summary>
/// Whether the storyboard can fall back to skin sprites in case no matching storyboard sprites are found.
/// </summary>
public bool UseSkinSprites { get; set; }
public bool HasDrawable => Layers.Any(l => l.Elements.Any(e => e.IsDrawable));
public double FirstEventTime => Layers.Min(l => l.Elements.FirstOrDefault()?.StartTime ?? 0);