mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Move StoryboardReplacesBackground and StoryboardAspect properties to Storyboard.
This commit is contained in:
parent
2c245f4c22
commit
0996867112
@ -46,21 +46,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Storyboard Storyboard = new Storyboard();
|
public Storyboard Storyboard = new Storyboard();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this beatmap's background should be hidden while its storyboard is being displayed.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new beatmap.
|
/// Constructs a new beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -75,7 +75,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public bool LetterboxInBreaks { get; set; }
|
public bool LetterboxInBreaks { get; set; }
|
||||||
public bool WidescreenStoryboard { get; set; }
|
public bool WidescreenStoryboard { get; set; }
|
||||||
public float StoryboardAspect => WidescreenStoryboard ? 16 / 9f : 4 / 3f;
|
|
||||||
|
|
||||||
// Editor
|
// Editor
|
||||||
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
||||||
|
@ -232,10 +232,10 @@ namespace osu.Game.Screens.Play
|
|||||||
var beatmap = Beatmap.Value.Beatmap;
|
var beatmap = Beatmap.Value.Beatmap;
|
||||||
|
|
||||||
storyboard = beatmap.Storyboard.CreateDrawable();
|
storyboard = beatmap.Storyboard.CreateDrawable();
|
||||||
storyboard.Width = storyboard.Height * beatmap.BeatmapInfo.StoryboardAspect;
|
storyboard.Width = storyboard.Height * beatmap.Storyboard.AspectRatio(beatmap.BeatmapInfo);
|
||||||
storyboard.Masking = true;
|
storyboard.Masking = true;
|
||||||
|
|
||||||
if (!beatmap.StoryboardReplacesBackground)
|
if (!beatmap.Storyboard.ReplacesBackground(beatmap.BeatmapInfo))
|
||||||
storyboard.BackgroundTexture = Beatmap.Value.Background;
|
storyboard.BackgroundTexture = Beatmap.Value.Background;
|
||||||
storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard);
|
storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -31,6 +32,21 @@ namespace osu.Game.Storyboards
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the beatmap's background should be hidden while this storyboard is being displayed.
|
||||||
|
/// </summary>
|
||||||
|
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()
|
public DrawableStoryboard CreateDrawable()
|
||||||
=> new DrawableStoryboard(this);
|
=> new DrawableStoryboard(this);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
storyboard = working.Beatmap.Storyboard.CreateDrawable();
|
storyboard = working.Beatmap.Storyboard.CreateDrawable();
|
||||||
storyboard.Passing = false;
|
storyboard.Passing = false;
|
||||||
if (!working.Beatmap.StoryboardReplacesBackground)
|
|
||||||
|
var beatmap = working.Beatmap;
|
||||||
|
if (!beatmap.Storyboard.ReplacesBackground(beatmap.BeatmapInfo))
|
||||||
storyboard.BackgroundTexture = working.Background;
|
storyboard.BackgroundTexture = working.Background;
|
||||||
|
|
||||||
storyboardContainer.Add(storyboard);
|
storyboardContainer.Add(storyboard);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user