1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-26 04:43:01 +08:00

Fix crash when storyboard attempts to play at main menu

This commit is contained in:
Dean Herbert 2022-09-23 20:10:57 +09:00
parent 2a5556de33
commit 4e9053b099

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Screens.Play; using osu.Game.Beatmaps;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -91,6 +91,9 @@ namespace osu.Game.Storyboards.Drawables
[Resolved] [Resolved]
private ISkinSource skin { get; set; } private ISkinSource skin { get; set; }
[Resolved]
private IBeatSyncProvider beatSyncProvider { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textureStore, Storyboard storyboard) private void load(TextureStore textureStore, Storyboard storyboard)
{ {
@ -116,9 +119,6 @@ namespace osu.Game.Storyboards.Drawables
Animation.ApplyTransforms(this); Animation.ApplyTransforms(this);
} }
[Resolved]
private IGameplayClock gameplayClock { get; set; }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
@ -128,7 +128,7 @@ namespace osu.Game.Storyboards.Drawables
// //
// In the case of storyboard animations, we want to synchronise with game time perfectly // In the case of storyboard animations, we want to synchronise with game time perfectly
// so let's get a correct time based on gameplay clock and earliest transform. // so let's get a correct time based on gameplay clock and earliest transform.
PlaybackPosition = gameplayClock.CurrentTime - Animation.EarliestTransformTime; PlaybackPosition = (beatSyncProvider?.Clock?.CurrentTime ?? Clock.CurrentTime) - Animation.EarliestTransformTime;
} }
private void skinSourceChanged() private void skinSourceChanged()