1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Merge pull request #20417 from peppy/fix-main-menu-storyboard-crash

Fix crash when storyboard attempts to play at main menu
This commit is contained in:
Dean Herbert 2022-09-24 02:09:46 +09:00 committed by GitHub
commit 7bacd36825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Textures;
using osu.Framework.Utils;
using osu.Game.Screens.Play;
using osu.Game.Beatmaps;
using osu.Game.Skinning;
using osuTK;
@ -91,6 +91,9 @@ namespace osu.Game.Storyboards.Drawables
[Resolved]
private ISkinSource skin { get; set; }
[Resolved]
private IBeatSyncProvider beatSyncProvider { get; set; }
[BackgroundDependencyLoader]
private void load(TextureStore textureStore, Storyboard storyboard)
{
@ -116,9 +119,6 @@ namespace osu.Game.Storyboards.Drawables
Animation.ApplyTransforms(this);
}
[Resolved]
private IGameplayClock gameplayClock { get; set; }
protected override void 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
// 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()