1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Skip song intro only in case of a quick restart

This commit is contained in:
BlauFx 2022-08-06 17:02:45 +02:00
parent e411a2d187
commit 0d418559bc
No known key found for this signature in database
GPG Key ID: BB73374479D2AA97
2 changed files with 19 additions and 1 deletions

View File

@ -81,6 +81,10 @@ namespace osu.Game.Screens.Play
private bool isRestarting;
public bool RestartedViaHotkey;
public Bindable<bool> IsRestartingFromHotkey = new Bindable<bool>();
private Bindable<bool> mouseWheelDisabled;
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
@ -287,6 +291,7 @@ namespace osu.Game.Screens.Play
{
if (!this.IsCurrentScreen()) return;
IsRestartingFromHotkey.Value = true;
fadeOut(true);
Restart();
},
@ -368,7 +373,7 @@ namespace osu.Game.Screens.Play
skipIntroOverlay.IsSkippable.ValueChanged += (e) =>
{
if (RestartCount > 0 && e.NewValue)
if (RestartedViaHotkey && e.NewValue && RestartCount > 0)
skipIntroOverlay.RequestSkip.Invoke();
};
}

View File

@ -123,6 +123,8 @@ namespace osu.Game.Screens.Play
private EpilepsyWarning? epilepsyWarning;
private bool isHotKeyRestart;
[Resolved(CanBeNull = true)]
private INotificationOverlay? notificationOverlay { get; set; }
@ -363,9 +365,20 @@ namespace osu.Game.Screens.Play
CurrentPlayer = createPlayer();
CurrentPlayer.RestartCount = restartCount++;
CurrentPlayer.RestartRequested = restartRequested;
CurrentPlayer.IsRestartingFromHotkey.ValueChanged += e =>
{
if (e.NewValue)
isHotKeyRestart = true;
};
LoadTask = LoadComponentAsync(CurrentPlayer, _ =>
{
if (isHotKeyRestart)
{
CurrentPlayer.RestartedViaHotkey = true;
isHotKeyRestart = false;
}
MetadataInfo.Loading = false;
OnPlayerLoaded();
});