mirror of https://github.com/ppy/osu
Revert "refactor BeatmapBackgroundWithStoryboard to reduce overhead"
This reverts commit 277545bb06
.
This commit is contained in:
parent
277545bb06
commit
a62dd7cca0
|
@ -13,21 +13,16 @@ public class BeatmapBackground : Background
|
|||
|
||||
private readonly string fallbackTextureName;
|
||||
|
||||
[Resolved]
|
||||
private LargeTextureStore textures { get; set; }
|
||||
|
||||
public BeatmapBackground(WorkingBeatmap beatmap, string fallbackTextureName = @"Backgrounds/bg1")
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
this.fallbackTextureName = fallbackTextureName;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
base.LoadComplete();
|
||||
Initialize();
|
||||
Sprite.Texture = Beatmap?.Background ?? textures.Get(fallbackTextureName);
|
||||
}
|
||||
|
||||
protected virtual void Initialize() => Sprite.Texture = Beatmap?.Background ?? textures.Get(fallbackTextureName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// 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.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
|
@ -15,21 +16,19 @@ public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTe
|
|||
{
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (Beatmap.Storyboard.HasDrawable)
|
||||
{
|
||||
LoadComponentAsync(new DrawableStoryboard(Beatmap.Storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, AddInternal);
|
||||
}
|
||||
|
||||
if (Beatmap.Storyboard.ReplacesBackground || Beatmap.Storyboard.Layers.First(l => l.Name == "Video").Elements.Any())
|
||||
{
|
||||
Sprite.Expire();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
LoadComponentAsync(new DrawableStoryboard(Beatmap.Storyboard)
|
||||
{
|
||||
Clock = new InterpolatingFramedClock(Beatmap.Track),
|
||||
},
|
||||
loaded =>
|
||||
{
|
||||
AddInternal(loaded);
|
||||
if (Beatmap.Storyboard.ReplacesBackground)
|
||||
Sprite.FadeOut(300, Easing.OutQuint);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue