diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 2c941bf13a..32cd53f3a2 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -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 }); } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index b12f730511..be468f84b4 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -14,11 +14,17 @@ namespace osu.Game.Rulesets.Scoring public abstract class ScoreProcessor { /// - /// Invoked when the ScoreProcessor is in a failed state. + /// Invoked when the is in a failed state. + /// This may occur regardless of whether an event is invoked. /// Return true if the fail was permitted. /// public event Func Failed; + /// + /// Invoked when all s have been judged. + /// + public event Action AllJudged; + /// /// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the . /// @@ -49,6 +55,11 @@ namespace osu.Game.Rulesets.Scoring /// public readonly BindableInt HighestCombo = new BindableInt(); + /// + /// Whether all s have been processed. + /// + protected virtual bool HasCompleted => false; + /// /// Whether the score is in a failed state. /// @@ -117,6 +128,9 @@ namespace osu.Game.Rulesets.Scoring protected void NotifyNewJudgement(Judgement judgement) { NewJudgement?.Invoke(judgement); + + if (HasCompleted) + AllJudged?.Invoke(); } /// @@ -141,6 +155,8 @@ namespace osu.Game.Rulesets.Scoring public readonly Bindable Mode = new Bindable(ScoringMode.Exponential); + protected sealed override bool HasCompleted => Hits == MaxHits; + protected virtual double ComboPortion => 0.5f; protected virtual double AccuracyPortion => 0.5f; diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index f7ece531c3..767bb94f8d 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -29,11 +29,6 @@ namespace osu.Game.Rulesets.UI /// public abstract class RulesetContainer : Container { - /// - /// Invoked when all the judgeable HitObjects have been judged. - /// - public event Action OnAllJudged; - /// /// Whether to apply adjustments to the child based on our own size. /// @@ -77,15 +72,6 @@ namespace osu.Game.Rulesets.UI Ruleset = ruleset; } - /// - /// Checks whether all HitObjects have been judged, and invokes OnAllJudged. - /// - protected void CheckAllJudged() - { - if (AllObjectsJudged) - OnAllJudged?.Invoke(); - } - public abstract ScoreProcessor CreateScoreProcessor(); /// @@ -263,7 +249,6 @@ namespace osu.Game.Rulesets.UI { Playfield.OnJudgement(d, j); OnJudgement?.Invoke(j); - CheckAllJudged(); }; drawableObjects.Add(drawableObject); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 615e04d6c2..593abb7d26 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -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; }