1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:53:21 +08:00

Improve implementation

This commit is contained in:
BlauFx 2022-08-07 13:20:29 +02:00
parent bd43a9e96e
commit 09230304a4
No known key found for this signature in database
GPG Key ID: BB73374479D2AA97
3 changed files with 13 additions and 12 deletions

View File

@ -81,10 +81,6 @@ 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>();
@ -291,7 +287,7 @@ namespace osu.Game.Screens.Play
{
if (!this.IsCurrentScreen()) return;
IsRestartingFromHotkey.Value = true;
Configuration.AutomaticallySkipIntro = true;
fadeOut(true);
Restart();
},
@ -373,8 +369,11 @@ namespace osu.Game.Screens.Play
skipIntroOverlay.IsSkippable.ValueChanged += e =>
{
if (RestartedViaHotkey && e.NewValue && RestartCount > 0)
if (Configuration.AutomaticallySkipIntro && e.NewValue && RestartCount > 0)
{
Configuration.AutomaticallySkipIntro = false;
skipIntroOverlay.RequestSkip.Invoke();
}
};
}

View File

@ -31,5 +31,7 @@ namespace osu.Game.Screens.Play
/// Whether the player should be allowed to skip intros/outros, advancing to the start of gameplay or the end of a storyboard.
/// </summary>
public bool AllowSkipping { get; set; } = true;
public bool AutomaticallySkipIntro { get; set; }
}
}

View File

@ -365,17 +365,12 @@ 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;
CurrentPlayer.Configuration.AutomaticallySkipIntro = true;
isHotKeyRestart = false;
}
@ -390,6 +385,11 @@ namespace osu.Game.Screens.Play
private void restartRequested()
{
if (CurrentPlayer != null)
{
isHotKeyRestart = CurrentPlayer.Configuration.AutomaticallySkipIntro;
}
hideOverlays = true;
ValidForResume = true;
}