diff --git a/osu.Game.Mode.Osu/OsuScoreProcessor.cs b/osu.Game.Mode.Osu/OsuScoreProcessor.cs index 177844297e..a5ebda6834 100644 --- a/osu.Game.Mode.Osu/OsuScoreProcessor.cs +++ b/osu.Game.Mode.Osu/OsuScoreProcessor.cs @@ -10,23 +10,20 @@ namespace osu.Game.Modes.Osu { class OsuScoreProcessor : ScoreProcessor { - public override void AddJudgement(JudgementInfo judgement) + protected override void UpdateCalculations(JudgementInfo judgement) { - base.AddJudgement(judgement); - - switch (judgement.Result) + if (judgement != null) { - case HitResult.Hit: - Combo.Value++; - break; - case HitResult.Miss: - Combo.Value = 0; - break; + switch (judgement.Result) + { + case HitResult.Hit: + Combo.Value++; + break; + case HitResult.Miss: + Combo.Value = 0; + break; + } } - } - protected override void UpdateCalculations() - { - base.UpdateCalculations(); int score = 0; int maxScore = 0; @@ -51,8 +48,6 @@ namespace osu.Game.Modes.Osu maxScore += 300; break; } - - } TotalScore.Value = score; diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 695bca2593..eac762b4a0 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Catch protected override PlayMode PlayMode => PlayMode.Catch; - public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(); + public override ScoreProcessor CreateScoreProcessor() => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); } diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 0e7761e8fb..e91b2ed02e 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Mania protected override PlayMode PlayMode => PlayMode.Mania; - public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(); + public override ScoreProcessor CreateScoreProcessor() => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); } diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index 3e697e48ea..e706387aaa 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko protected override PlayMode PlayMode => PlayMode.Taiko; - public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(); + public override ScoreProcessor CreateScoreProcessor() => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); } diff --git a/osu.Game/Modes/ScoreProcesssor.cs b/osu.Game/Modes/ScoreProcesssor.cs index 7dfd7d04ce..63a1ed1528 100644 --- a/osu.Game/Modes/ScoreProcesssor.cs +++ b/osu.Game/Modes/ScoreProcesssor.cs @@ -11,37 +11,38 @@ using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes { - public class ScoreProcessor + public abstract class ScoreProcessor { public virtual Score GetScore() => new Score(); - public BindableDouble TotalScore = new BindableDouble { MinValue = 0 }; + public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 }; - public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 }; + public readonly BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 }; - public BindableInt Combo = new BindableInt(); + public readonly BindableInt Combo = new BindableInt(); - public BindableInt MaximumCombo = new BindableInt(); + public readonly BindableInt MaximumCombo = new BindableInt(); - public List Judgements = new List(); + public readonly List Judgements = new List(); - public virtual void AddJudgement(JudgementInfo judgement) + public ScoreProcessor() + { + Combo.ValueChanged += delegate { MaximumCombo.Value = Math.Max(MaximumCombo.Value, Combo.Value); }; + } + + public void AddJudgement(JudgementInfo judgement) { Judgements.Add(judgement); - UpdateCalculations(); + + UpdateCalculations(judgement); judgement.ComboAtHit = (ulong)Combo.Value; - - if (Combo.Value > MaximumCombo.Value) - MaximumCombo.Value = Combo.Value; } /// /// Update any values that potentially need post-processing on a judgement change. /// - protected virtual void UpdateCalculations() - { - - } + /// A new JudgementInfo that triggered this calculation. May be null. + protected abstract void UpdateCalculations(JudgementInfo newJudgement); } }