mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 21:43:21 +08:00
Make CheckFailed not actually trigger internal things, and make private.
This commit is contained in:
parent
52c1cd407c
commit
2394e7ff78
@ -43,6 +43,11 @@ namespace osu.Game.Modes
|
||||
/// </summary>
|
||||
public readonly BindableInt HighestCombo = new BindableInt();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the score is in a failed state.
|
||||
/// </summary>
|
||||
public virtual bool HasFailed { get; }
|
||||
|
||||
protected ScoreProcessor()
|
||||
{
|
||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||
@ -78,12 +83,6 @@ namespace osu.Game.Modes
|
||||
{
|
||||
Failed?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the score is in a failing state.
|
||||
/// </summary>
|
||||
/// <returns>Whether the score is in a failing state.</returns>
|
||||
public abstract bool CheckFailed();
|
||||
}
|
||||
|
||||
public abstract class ScoreProcessor<TObject, TJudgement> : ScoreProcessor
|
||||
@ -95,15 +94,12 @@ namespace osu.Game.Modes
|
||||
/// </summary>
|
||||
protected readonly List<TJudgement> Judgements = new List<TJudgement>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the score is in a failable state.
|
||||
/// </summary>
|
||||
protected virtual bool IsFailable => Health.Value == Health.MinValue;
|
||||
public override bool HasFailed => Health.Value == Health.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this ScoreProcessor has already failed.
|
||||
/// </summary>
|
||||
private bool hasFailed;
|
||||
private bool alreadyFailed;
|
||||
|
||||
protected ScoreProcessor()
|
||||
{
|
||||
@ -119,17 +115,6 @@ namespace osu.Game.Modes
|
||||
Reset();
|
||||
}
|
||||
|
||||
public override bool CheckFailed()
|
||||
{
|
||||
if (!hasFailed && IsFailable)
|
||||
{
|
||||
hasFailed = true;
|
||||
TriggerFailed();
|
||||
}
|
||||
|
||||
return hasFailed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes target scoring values for this ScoreProcessor. This is equivalent to performing an auto-play of the score to find the values.
|
||||
/// </summary>
|
||||
@ -148,14 +133,27 @@ namespace osu.Game.Modes
|
||||
|
||||
judgement.ComboAtHit = (ulong)Combo.Value;
|
||||
|
||||
CheckFailed();
|
||||
updateFailed();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the score is in a failing state.
|
||||
/// </summary>
|
||||
/// <returns>Whether the score is in a failing state.</returns>
|
||||
private void updateFailed()
|
||||
{
|
||||
if (alreadyFailed || !HasFailed)
|
||||
return;
|
||||
|
||||
alreadyFailed = true;
|
||||
TriggerFailed();
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
Judgements.Clear();
|
||||
|
||||
hasFailed = false;
|
||||
alreadyFailed = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -239,14 +239,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void onCompletion()
|
||||
{
|
||||
// Force a final check to see if the player has failed
|
||||
// Some game modes (e.g. taiko) fail at the end of the map
|
||||
if (scoreProcessor.CheckFailed())
|
||||
{
|
||||
// If failed, onFail will be invoked which will push a new screen.
|
||||
// Let's not push the completion screen in this case
|
||||
// Only show the completion screen if the player hasn't failed
|
||||
if (scoreProcessor.HasFailed)
|
||||
return;
|
||||
}
|
||||
|
||||
Delay(1000);
|
||||
Schedule(delegate
|
||||
|
Loading…
Reference in New Issue
Block a user