Merge remote-tracking branch 'origin/master' into auto-restart-mod-perfect

# Conflicts:
#	osu.Game/Screens/Play/Player.cs
This commit is contained in:
smoogipoo
2019-09-19 17:53:10 +09:00
18 changed files with 173 additions and 61 deletions

View File

@ -86,6 +86,12 @@ namespace osu.Game.Screens.Play
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
protected new readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
/// <summary>
/// Whether failing should be allowed.
/// By default, this checks whether all selected mods allow failing.
/// </summary>
protected virtual bool AllowFail => Mods.Value.OfType<IApplicableFailOverride>().All(m => m.AllowFail);
private readonly bool allowPause;
private readonly bool showResults;
@ -360,9 +366,7 @@ namespace osu.Game.Screens.Play
private bool onFail()
{
var failOverrideMods = Mods.Value.OfType<IApplicableFailOverride>();
if (failOverrideMods.Any(m => !m.AllowFail))
if (!AllowFail)
return false;
HasFailed = true;
@ -374,7 +378,8 @@ namespace osu.Game.Screens.Play
PauseOverlay.Hide();
failAnimation.Start();
if (failOverrideMods.Any(m => m.RestartOnFail))
if (Mods.Value.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
Restart();
return true;