mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Merge branch 'master' into legacy-font-fixed-width
This commit is contained in:
commit
6526955b09
@ -287,5 +287,26 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(manyTimes.EndTime, Is.EqualTo(9000 + loop_duration));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestVideoAndBackgroundEventsDoNotAffectStoryboardBounds()
|
||||
{
|
||||
var decoder = new LegacyStoryboardDecoder();
|
||||
|
||||
using var resStream = TestResources.OpenResource("video-background-events-ignored.osb");
|
||||
using var stream = new LineBufferedReader(resStream);
|
||||
|
||||
var storyboard = decoder.Decode(stream);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(storyboard.GetLayer(@"Video").Elements, Has.Count.EqualTo(1));
|
||||
Assert.That(storyboard.GetLayer(@"Video").Elements.Single(), Is.InstanceOf<StoryboardVideo>());
|
||||
Assert.That(storyboard.GetLayer(@"Video").Elements.Single().StartTime, Is.EqualTo(-5678));
|
||||
|
||||
Assert.That(storyboard.EarliestEventTime, Is.Null);
|
||||
Assert.That(storyboard.LatestEventTime, Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
osu file format v14
|
||||
|
||||
[Events]
|
||||
0,-1234,"BG.jpg",0,0
|
||||
Video,-5678,"Video.avi",0,0
|
@ -30,8 +30,12 @@ namespace osu.Game.Storyboards
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This iterates all elements and as such should be used sparingly or stored locally.
|
||||
/// Sample events use their start time as "end time" during this calculation.
|
||||
/// Video and background events are not included to match stable.
|
||||
/// </remarks>
|
||||
public double? EarliestEventTime => Layers.SelectMany(l => l.Elements).MinBy(e => e.StartTime)?.StartTime;
|
||||
public double? EarliestEventTime => Layers.SelectMany(l => l.Elements)
|
||||
.Where(e => e is not StoryboardVideo)
|
||||
.MinBy(e => e.StartTime)?.StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// Across all layers, find the latest point in time that a storyboard element ends at.
|
||||
@ -39,9 +43,12 @@ namespace osu.Game.Storyboards
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This iterates all elements and as such should be used sparingly or stored locally.
|
||||
/// Videos and samples return StartTime as their EndTIme.
|
||||
/// Sample events use their start time as "end time" during this calculation.
|
||||
/// Video and background events are not included to match stable.
|
||||
/// </remarks>
|
||||
public double? LatestEventTime => Layers.SelectMany(l => l.Elements).MaxBy(e => e.GetEndTime())?.GetEndTime();
|
||||
public double? LatestEventTime => Layers.SelectMany(l => l.Elements)
|
||||
.Where(e => e is not StoryboardVideo)
|
||||
.MaxBy(e => e.GetEndTime())?.GetEndTime();
|
||||
|
||||
/// <summary>
|
||||
/// Depth of the currently front-most storyboard layer, excluding the overlay layer.
|
||||
|
Loading…
Reference in New Issue
Block a user