mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 05:27:17 +09:00
Integrate storyboards with gameplay.
This commit is contained in:
parent
77252a76db
commit
ddaf28d7f6
@ -46,6 +46,21 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Storyboard Storyboard = new Storyboard();
|
public Storyboard Storyboard = new Storyboard();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this beatmap's Storyboard uses the background texture in its Background layer.
|
||||||
|
/// </summary>
|
||||||
|
public bool StoryboardUsesBackground
|
||||||
|
{
|
||||||
|
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,6 +75,7 @@ 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[]
|
||||||
|
@ -24,6 +24,8 @@ using osu.Game.Screens.Ranking;
|
|||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -66,6 +68,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private DrawableStoryboard storyboard;
|
||||||
|
private bool storyboardUsesBackground;
|
||||||
|
|
||||||
private HUDOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
|
|
||||||
@ -145,6 +150,15 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Clock = offsetClock,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
storyboard = beatmap.Storyboard.CreateDrawable(),
|
||||||
|
}
|
||||||
|
},
|
||||||
pauseContainer = new PauseContainer
|
pauseContainer = new PauseContainer
|
||||||
{
|
{
|
||||||
AudioClock = decoupledClock,
|
AudioClock = decoupledClock,
|
||||||
@ -196,6 +210,10 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
||||||
|
|
||||||
|
storyboardUsesBackground = beatmap.StoryboardUsesBackground;
|
||||||
|
storyboard.Width = storyboard.Height * beatmap.BeatmapInfo.StoryboardAspect;
|
||||||
|
storyboard.Masking = true;
|
||||||
|
|
||||||
hudOverlay.BindProcessor(scoreProcessor);
|
hudOverlay.BindProcessor(scoreProcessor);
|
||||||
hudOverlay.BindRulesetContainer(RulesetContainer);
|
hudOverlay.BindRulesetContainer(RulesetContainer);
|
||||||
|
|
||||||
@ -266,12 +284,11 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, Easing.OutQuint);
|
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, Easing.OutQuint);
|
||||||
Background?.FadeTo(1 - (float)dimLevel, 1500, Easing.OutQuint);
|
|
||||||
|
applyDim();
|
||||||
|
dimLevel.ValueChanged += newDim => applyDim();
|
||||||
|
|
||||||
Content.Alpha = 0;
|
Content.Alpha = 0;
|
||||||
|
|
||||||
dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800);
|
|
||||||
|
|
||||||
Content
|
Content
|
||||||
.ScaleTo(0.7f)
|
.ScaleTo(0.7f)
|
||||||
.ScaleTo(1, 750, Easing.OutQuint)
|
.ScaleTo(1, 750, Easing.OutQuint)
|
||||||
@ -310,6 +327,15 @@ namespace osu.Game.Screens.Play
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyDim()
|
||||||
|
{
|
||||||
|
var opacity = 1 - (float)dimLevel;
|
||||||
|
storyboard.FadeColour(new Color4(opacity, opacity, opacity, 1), 800);
|
||||||
|
storyboard.FadeTo(opacity == 0 ? 0 : 1);
|
||||||
|
|
||||||
|
Background?.FadeTo(storyboardUsesBackground ? 0 : opacity, 800, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
private void fadeOut()
|
private void fadeOut()
|
||||||
{
|
{
|
||||||
const float fade_out_duration = 250;
|
const float fade_out_duration = 250;
|
||||||
|
@ -14,6 +14,9 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
{
|
{
|
||||||
public Storyboard Storyboard { get; private set; }
|
public Storyboard Storyboard { get; private set; }
|
||||||
|
|
||||||
|
private readonly Container<DrawableStoryboardLayer> content;
|
||||||
|
protected override Container<DrawableStoryboardLayer> Content => content;
|
||||||
|
|
||||||
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
|
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
|
||||||
public override bool HandleInput => false;
|
public override bool HandleInput => false;
|
||||||
|
|
||||||
@ -39,6 +42,13 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
Size = new Vector2(640, 480);
|
Size = new Vector2(640, 480);
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
AddInternal(content = new Container<DrawableStoryboardLayer>
|
||||||
|
{
|
||||||
|
Size = new Vector2(640, 480),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user