1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 22:17:46 +08:00

Make Apply virtual to further simplify application process

This commit is contained in:
Dean Herbert 2020-07-10 18:35:20 +09:00
parent 8aff828dfe
commit f872343bab
3 changed files with 13 additions and 11 deletions

View File

@ -43,6 +43,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
{
base.Apply(result, judgedObject);
if (judgedObject?.HitObject is OsuHitObject osuObject)
{
Position = osuObject.StackedPosition;
Scale = new Vector2(osuObject.Scale);
}
}
protected override void PrepareForUse()
{
base.PrepareForUse();

View File

@ -107,16 +107,7 @@ namespace osu.Game.Rulesets.Osu.UI
if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return;
var osuObject = (OsuHitObject)judgedObject.HitObject;
DrawableOsuJudgement explosion = poolDictionary[result.Type].Get(doj =>
{
doj.Apply(result, judgedObject);
// todo: move to JudgedObject property?
doj.Position = osuObject.StackedEndPosition;
doj.Scale = new Vector2(osuObject.Scale);
});
DrawableOsuJudgement explosion = poolDictionary[result.Type].Get(doj => doj.Apply(result, judgedObject));
judgementLayer.Add(explosion);
}

View File

@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Judgements
this.Delay(FadeOutDelay).FadeOut(400);
}
public void Apply([NotNull] JudgementResult result, [CanBeNull] DrawableHitObject judgedObject)
public virtual void Apply([NotNull] JudgementResult result, [CanBeNull] DrawableHitObject judgedObject)
{
Result = result;
JudgedObject = judgedObject;