diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 84db2f9943..458c2304f2 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -46,21 +46,6 @@ namespace osu.Game.Beatmaps /// public Storyboard Storyboard = new Storyboard(); - /// - /// Whether this beatmap's background should be hidden while its storyboard is being displayed. - /// - public bool StoryboardReplacesBackground - { - get - { - var backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant(); - if (backgroundPath == null) - return false; - - return Storyboard.GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath); - } - } - /// /// Constructs a new beatmap. /// diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 2dc4b44ed7..0776669811 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -75,7 +75,6 @@ namespace osu.Game.Beatmaps public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } - public float StoryboardAspect => WidescreenStoryboard ? 16 / 9f : 4 / 3f; // Editor // This bookmarks stuff is necessary because DB doesn't know how to store int[] diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fd1eeaa395..75a5dd8f7d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -232,10 +232,10 @@ namespace osu.Game.Screens.Play var beatmap = Beatmap.Value.Beatmap; storyboard = beatmap.Storyboard.CreateDrawable(); - storyboard.Width = storyboard.Height * beatmap.BeatmapInfo.StoryboardAspect; + storyboard.Width = storyboard.Height * beatmap.Storyboard.AspectRatio(beatmap.BeatmapInfo); storyboard.Masking = true; - if (!beatmap.StoryboardReplacesBackground) + if (!beatmap.Storyboard.ReplacesBackground(beatmap.BeatmapInfo)) storyboard.BackgroundTexture = Beatmap.Value.Background; storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard); } diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index 2e7188f28c..f74074e977 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Storyboards.Drawables; using System.Collections.Generic; using System.Linq; @@ -31,6 +32,21 @@ namespace osu.Game.Storyboards return layer; } + /// + /// Whether the beatmap's background should be hidden while this storyboard is being displayed. + /// + public bool ReplacesBackground(BeatmapInfo beatmapInfo) + { + var backgroundPath = beatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant(); + if (backgroundPath == null) + return false; + + return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath); + } + + public float AspectRatio(BeatmapInfo beatmapInfo) + => beatmapInfo.WidescreenStoryboard ? 16 / 9f : 4 / 3f; + public DrawableStoryboard CreateDrawable() => new DrawableStoryboard(this); } diff --git a/osu.Game/Tests/Visual/TestCaseStoryboard.cs b/osu.Game/Tests/Visual/TestCaseStoryboard.cs index c9601ffefc..75e23db475 100644 --- a/osu.Game/Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game/Tests/Visual/TestCaseStoryboard.cs @@ -83,7 +83,9 @@ namespace osu.Game.Tests.Visual storyboard = working.Beatmap.Storyboard.CreateDrawable(); storyboard.Passing = false; - if (!working.Beatmap.StoryboardReplacesBackground) + + var beatmap = working.Beatmap; + if (!beatmap.Storyboard.ReplacesBackground(beatmap.BeatmapInfo)) storyboard.BackgroundTexture = working.Background; storyboardContainer.Add(storyboard);