mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
apply suggestions
- Replace the sprite with a solid black box when a storyboard requests it. - Create a new storyboard instance and exclude the fail layer as well as strip all samples from it - Do not attempt in creating the storyboard when it isn't needed
This commit is contained in:
parent
d00fb21188
commit
62b07fb9ce
@ -1,10 +1,13 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
@ -19,16 +22,23 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
LoadComponentAsync(new DrawableStoryboard(Beatmap.Storyboard)
|
||||
{
|
||||
Clock = new InterpolatingFramedClock(Beatmap.Track),
|
||||
},
|
||||
loaded =>
|
||||
{
|
||||
AddInternal(loaded);
|
||||
if (Beatmap.Storyboard.ReplacesBackground)
|
||||
Sprite.FadeOut(300, Easing.OutQuint);
|
||||
});
|
||||
if (!Beatmap.Storyboard.HasDrawable)
|
||||
return;
|
||||
|
||||
var storyboard = new Storyboard { BeatmapInfo = Beatmap.BeatmapInfo };
|
||||
foreach (var layer in storyboard.Layers)
|
||||
{
|
||||
if (layer.Name != "Fail")
|
||||
layer.Elements = Beatmap.Storyboard.GetLayer(layer.Name).Elements.Where(e => !(e is StoryboardSampleInfo)).ToList();
|
||||
}
|
||||
|
||||
if (storyboard.ReplacesBackground)
|
||||
{
|
||||
Sprite.Texture = Texture.WhitePixel;
|
||||
Sprite.Colour = Colour4.Black;
|
||||
}
|
||||
|
||||
LoadComponentAsync(new DrawableStoryboard(storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, AddInternal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user