Code quality, read position offsets

This commit is contained in:
voidedWarranties
2020-03-08 14:02:39 -07:00
parent 48282dea8b
commit 22dd93a4f6
7 changed files with 26 additions and 16 deletions

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
@ -117,15 +118,12 @@ namespace osu.Game.Screens.Play
startTime = Math.Min(startTime, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn);
// some beatmaps have no AudioLeadIn but the video starts before the first object
var videoLayer = beatmap.Storyboard.GetLayer("Video");
var videoLayer = beatmap.Storyboard.GetLayer(LegacyStoryLayer.Video);
if (videoLayer.Elements.Any())
{
var videoOffset = videoLayer.Elements.First().StartTime;
var videoOffset = videoLayer.Elements.SingleOrDefault()?.StartTime;
if (videoOffset != 0)
startTime = Math.Min(startTime, videoOffset);
}
if (videoOffset != null)
startTime = Math.Min(startTime, videoOffset.GetValueOrDefault());
Seek(startTime);