From 3a7488767c51b54b70e5e202f647c6404b8e0e46 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:50:18 +0900 Subject: [PATCH] Make HitObject not store the judgement --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 2 +- osu.Game.Rulesets.Catch/Objects/Droplet.cs | 2 +- osu.Game.Rulesets.Catch/Objects/Fruit.cs | 2 +- osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Note.cs | 2 +- osu.Game.Rulesets.Mania/Objects/TailNote.cs | 2 +- osu.Game.Rulesets.Osu/Objects/HitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 +- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 6 +++--- osu.Game/Rulesets/Objects/HitObject.cs | 12 +----------- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 7 ++++--- 20 files changed, 25 insertions(+), 34 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index e021bafdb6..e1af4c1075 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; - protected override Judgement CreateJudgement() => new CatchBananaJudgement(); + public override Judgement CreateJudgement() => new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index 79aefdb6d3..8b54922959 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Droplet : CatchHitObject { - protected override Judgement CreateJudgement() => new CatchDropletJudgement(); + public override Judgement CreateJudgement() => new CatchDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index 53a484ed56..2c2cd013c3 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Fruit : CatchHitObject { - protected override Judgement CreateJudgement() => new CatchJudgement(); + public override Judgement CreateJudgement() => new CatchJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index ddb88c2c1c..39f1cadad5 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class TinyDroplet : Droplet { - protected override Judgement CreateJudgement() => new CatchTinyDropletJudgement(); + public override Judgement CreateJudgement() => new CatchTinyDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 26116c2691..e493956d6e 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -97,6 +97,6 @@ namespace osu.Game.Rulesets.Mania.Objects } } - protected override Judgement CreateJudgement() => new HoldNoteJudgement(); + public override Judgement CreateJudgement() => new HoldNoteJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index b428c6158d..05959a31c0 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNoteTick : ManiaHitObject { - protected override Judgement CreateJudgement() => new HoldNoteTickJudgement(); + public override Judgement CreateJudgement() => new HoldNoteTickJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index ffc3ed0bd7..42877649d2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class Note : ManiaHitObject { - protected override Judgement CreateJudgement() => new ManiaJudgement(); + public override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs index 522f78336f..9de542bcd3 100644 --- a/osu.Game.Rulesets.Mania/Objects/TailNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects { public class TailNote : Note { - protected override Judgement CreateJudgement() => new ManiaJudgement(); + public override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs index b5e64e9e40..d1656a9672 100644 --- a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects { public class HitCircle : OsuHitObject { - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs index 83f7f79f39..c8621cdbcf 100644 --- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs @@ -27,6 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = Math.Min(SpanDuration * 2, TimePreempt); } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index eead98ac28..7a0dcc77a6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -214,6 +214,6 @@ namespace osu.Game.Rulesets.Osu.Objects } } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index faa325d416..23616ea005 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Objects { } - protected override Judgement CreateJudgement() => new OsuSliderTailJudgement(); + public override Judgement CreateJudgement() => new OsuSliderTailJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 000781dec6..906f0a0182 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -29,6 +29,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index d100e33f17..e1a7a7c6df 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -32,6 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index f6a3a5efef..967d5acfd7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs @@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public double HitWindow => TickSpacing / 2; - protected override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement(); + public override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs index a9d452cc68..fac3705110 100644 --- a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Taiko.Objects { public class StrongHitObject : TaikoHitObject { - protected override Judgement CreateJudgement() => new TaikoStrongJudgement(); + public override Judgement CreateJudgement() => new TaikoStrongJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 702b6d73b6..6948c5bcde 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects AddNested(new StrongHitObject { StartTime = (this as IHasEndTime)?.EndTime ?? StartTime }); } - protected override Judgement CreateJudgement() => new TaikoJudgement(); + public override Judgement CreateJudgement() => new TaikoJudgement(); protected override HitWindows CreateHitWindows() => new TaikoHitWindows(); } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 17533f4ca0..e1848412c2 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Objects.Drawables [BackgroundDependencyLoader] private void load() { - if (HitObject.Judgement != null) + var judgement = HitObject.CreateJudgement(); + if (judgement != null) { - Result = CreateResult(HitObject.Judgement); - + Result = CreateResult(judgement); if (Result == null) throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); } diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index eee690474b..beb9620f78 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -63,14 +63,6 @@ namespace osu.Game.Rulesets.Objects [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; - /// - /// The judgement information provided by this . - /// - /// - /// Only populated after is invoked. - /// - public Judgement Judgement { get; private set; } - /// /// Applies default values to this HitObject. /// @@ -80,8 +72,6 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); - Judgement = CreateJudgement(); - if (nestedHitObjects.IsValueCreated) nestedHitObjects.Value.Clear(); @@ -120,7 +110,7 @@ namespace osu.Game.Rulesets.Objects /// Creates the that represents the scoring information for this . /// May be null. /// - protected virtual Judgement CreateJudgement() => null; + public virtual Judgement CreateJudgement() => null; /// /// Creates the for this . diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 4cadae4212..a185648531 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -233,11 +233,12 @@ namespace osu.Game.Rulesets.Scoring foreach (var nested in obj.NestedHitObjects) simulate(nested); - if (obj.Judgement == null) + var judgement = obj.CreateJudgement(); + if (judgement == null) return; - var result = CreateResult(obj.Judgement); - result.Type = obj.Judgement.MaxResult; + var result = CreateResult(judgement); + result.Type = judgement.MaxResult; applyResult(result); }