1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 05:52:54 +08:00

Make HitObject not store the judgement

This commit is contained in:
smoogipoo 2018-08-06 11:50:18 +09:00
parent 0d6a8a2bf5
commit 3a7488767c
20 changed files with 25 additions and 34 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -97,6 +97,6 @@ namespace osu.Game.Rulesets.Mania.Objects
}
}
protected override Judgement CreateJudgement() => new HoldNoteJudgement();
public override Judgement CreateJudgement() => new HoldNoteJudgement();
}
}

View File

@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects
/// </summary>
public class HoldNoteTick : ManiaHitObject
{
protected override Judgement CreateJudgement() => new HoldNoteTickJudgement();
public override Judgement CreateJudgement() => new HoldNoteTickJudgement();
}
}

View File

@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects
/// </summary>
public class Note : ManiaHitObject
{
protected override Judgement CreateJudgement() => new ManiaJudgement();
public override Judgement CreateJudgement() => new ManiaJudgement();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -214,6 +214,6 @@ namespace osu.Game.Rulesets.Osu.Objects
}
}
protected override Judgement CreateJudgement() => new OsuJudgement();
public override Judgement CreateJudgement() => new OsuJudgement();
}
}

View File

@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Objects
{
}
protected override Judgement CreateJudgement() => new OsuSliderTailJudgement();
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Objects
/// </summary>
public double HitWindow => TickSpacing / 2;
protected override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement();
public override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement();
}
}

View File

@ -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();
}
}

View File

@ -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();
}

View File

@ -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)}.");
}

View File

@ -63,14 +63,6 @@ namespace osu.Game.Rulesets.Objects
[JsonIgnore]
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects.Value;
/// <summary>
/// The judgement information provided by this <see cref="HitObject"/>.
/// </summary>
/// <remarks>
/// Only populated after <see cref="ApplyDefaults"/> is invoked.
/// </remarks>
public Judgement Judgement { get; private set; }
/// <summary>
/// Applies default values to this HitObject.
/// </summary>
@ -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 <see cref="Judgement"/> that represents the scoring information for this <see cref="HitObject"/>.
/// May be null.
/// </summary>
protected virtual Judgement CreateJudgement() => null;
public virtual Judgement CreateJudgement() => null;
/// <summary>
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.

View File

@ -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);
}