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