mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Move AllObjectsJudged into ScoreProcessor as AllJudged
Changes to OsuScoreProcessor were required to make sure that ticks and slider heads weren't ignored.
This commit is contained in:
parent
cc6bb81a73
commit
2e0218f388
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -38,9 +37,19 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
||||
{
|
||||
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
|
||||
|
||||
foreach (var unused in beatmap.HitObjects)
|
||||
foreach (var obj in beatmap.HitObjects)
|
||||
{
|
||||
// TODO: add support for other object types.
|
||||
var slider = obj as Slider;
|
||||
if (slider != null)
|
||||
{
|
||||
// Head
|
||||
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||
|
||||
// Ticks
|
||||
foreach (var tick in slider.Ticks)
|
||||
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||
}
|
||||
|
||||
AddJudgement(new OsuJudgement { Result = HitResult.Great });
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,17 @@ namespace osu.Game.Rulesets.Scoring
|
||||
public abstract class ScoreProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when the ScoreProcessor is in a failed state.
|
||||
/// Invoked when the <see cref="ScoreProcessor"/> is in a failed state.
|
||||
/// This may occur regardless of whether an <see cref="AllJudged"/> event is invoked.
|
||||
/// Return true if the fail was permitted.
|
||||
/// </summary>
|
||||
public event Func<bool> Failed;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when all <see cref="HitObject"/>s have been judged.
|
||||
/// </summary>
|
||||
public event Action AllJudged;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the <see cref="ScoreProcessor"/>.
|
||||
/// </summary>
|
||||
@ -49,6 +55,11 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
public readonly BindableInt HighestCombo = new BindableInt();
|
||||
|
||||
/// <summary>
|
||||
/// Whether all <see cref="Judgement"/>s have been processed.
|
||||
/// </summary>
|
||||
protected virtual bool HasCompleted => false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the score is in a failed state.
|
||||
/// </summary>
|
||||
@ -117,6 +128,9 @@ namespace osu.Game.Rulesets.Scoring
|
||||
protected void NotifyNewJudgement(Judgement judgement)
|
||||
{
|
||||
NewJudgement?.Invoke(judgement);
|
||||
|
||||
if (HasCompleted)
|
||||
AllJudged?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -141,6 +155,8 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential);
|
||||
|
||||
protected sealed override bool HasCompleted => Hits == MaxHits;
|
||||
|
||||
protected virtual double ComboPortion => 0.5f;
|
||||
protected virtual double AccuracyPortion => 0.5f;
|
||||
|
||||
|
@ -29,11 +29,6 @@ namespace osu.Game.Rulesets.UI
|
||||
/// </summary>
|
||||
public abstract class RulesetContainer : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when all the judgeable HitObjects have been judged.
|
||||
/// </summary>
|
||||
public event Action OnAllJudged;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to apply adjustments to the child <see cref="Playfield"/> based on our own size.
|
||||
/// </summary>
|
||||
@ -77,15 +72,6 @@ namespace osu.Game.Rulesets.UI
|
||||
Ruleset = ruleset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether all HitObjects have been judged, and invokes OnAllJudged.
|
||||
/// </summary>
|
||||
protected void CheckAllJudged()
|
||||
{
|
||||
if (AllObjectsJudged)
|
||||
OnAllJudged?.Invoke();
|
||||
}
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor();
|
||||
|
||||
/// <summary>
|
||||
@ -263,7 +249,6 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
Playfield.OnJudgement(d, j);
|
||||
OnJudgement?.Invoke(j);
|
||||
CheckAllJudged();
|
||||
};
|
||||
|
||||
drawableObjects.Add(drawableObject);
|
||||
|
@ -206,10 +206,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
//bind RulesetContainer to ScoreProcessor and ourselves (for a pass situation)
|
||||
RulesetContainer.OnAllJudged += onCompletion;
|
||||
|
||||
//bind ScoreProcessor to ourselves (for a fail situation)
|
||||
// Bind ScoreProcessor to ourselves
|
||||
scoreProcessor.AllJudged += onCompletion;
|
||||
scoreProcessor.Failed += onFail;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user