1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-15 02:46:15 +08:00

Display results after fail

This commit is contained in:
Henry Lin
2021-06-10 10:58:42 +08:00
Unverified
parent 15e7cce264
commit 7815b3c72b
8 changed files with 27 additions and 3 deletions
@@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Osu.Mods
public bool RestartOnFail => false;
public bool DisplayResultsOnFail => false;
private OsuInputManager inputManager;
private IFrameStableClock gameplayClock;
+7 -1
View File
@@ -36,7 +36,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModTarget : ModWithVisibilityAdjustment, IApplicableToDrawableRuleset<OsuHitObject>,
IApplicableToHealthProcessor, IApplicableToDifficulty
IApplicableToHealthProcessor, IApplicableToDifficulty, IApplicableFailOverride
{
public override string Name => "Target";
public override string Acronym => "TP";
@@ -52,6 +52,12 @@ namespace osu.Game.Rulesets.Osu.Mods
Value = null
};
public bool PerformFail() => true;
public bool RestartOnFail => false;
public bool DisplayResultsOnFail => true;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
// Sudden death
@@ -18,5 +18,10 @@ namespace osu.Game.Rulesets.Mods
/// Whether we want to restart on fail. Only used if <see cref="PerformFail"/> returns true.
/// </summary>
bool RestartOnFail { get; }
/// <summary>
/// Whether to proceed to results screen on fail. Only used if <see cref="PerformFail"/> returns true and <see cref="RestartOnFail"/> is false.
/// </summary>
bool DisplayResultsOnFail { get; }
}
}
+2
View File
@@ -35,6 +35,8 @@ namespace osu.Game.Rulesets.Mods
public bool RestartOnFail => false;
public bool DisplayResultsOnFail => false;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModFailCondition), typeof(ModNoFail) };
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
+1
View File
@@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Mods
public bool PerformFail() => false;
public bool RestartOnFail => false;
public bool DisplayResultsOnFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
@@ -41,6 +41,7 @@ namespace osu.Game.Rulesets.Mods
}
public bool RestartOnFail => false;
public bool DisplayResultsOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
@@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Mods
public virtual bool PerformFail() => true;
public virtual bool RestartOnFail => true;
public virtual bool DisplayResultsOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
+8 -2
View File
@@ -604,7 +604,7 @@ namespace osu.Game.Screens.Play
if (!this.IsCurrentScreen())
return;
if (!ScoreProcessor.HasCompleted.Value)
if (!ScoreProcessor.HasCompleted.Value && !HealthProcessor.HasFailed)
{
completionProgressDelegate?.Cancel();
completionProgressDelegate = null;
@@ -617,7 +617,7 @@ namespace osu.Game.Screens.Play
throw new InvalidOperationException($"{nameof(updateCompletionState)} was fired more than once");
// Only show the completion screen if the player hasn't failed
if (HealthProcessor.HasFailed)
if (HealthProcessor.HasFailed && !Mods.Value.OfType<IApplicableFailOverride>().Any(m => m.DisplayResultsOnFail))
return;
ValidForResume = false;
@@ -712,6 +712,12 @@ namespace osu.Game.Screens.Play
// Called back when the transform finishes
private void onFailComplete()
{
if (Mods.Value.OfType<IApplicableFailOverride>().Any(m => m.DisplayResultsOnFail))
{
updateCompletionState(true);
return;
}
GameplayClockContainer.Stop();
FailOverlay.Retries = RestartCount;