Use events instead of overriding Add (catch)

This commit is contained in:
ekrctb
2020-11-20 17:25:57 +09:00
parent c013cd11c9
commit 468b2a97cb
3 changed files with 6 additions and 14 deletions

View File

@ -55,21 +55,14 @@ namespace osu.Game.Rulesets.Catch.UI
HitObjectContainer,
CatcherArea,
};
NewResult += onNewResult;
RevertResult += onRevertResult;
DrawableHitObjectAdded += d => ((DrawableCatchHitObject)d).CheckPosition = CheckIfWeCanCatch;
}
public bool CheckIfWeCanCatch(CatchHitObject obj) => CatcherArea.AttemptCatch(obj);
public override void Add(DrawableHitObject h)
{
h.OnNewResult += onNewResult;
h.OnRevertResult += onRevertResult;
base.Add(h);
var fruit = (DrawableCatchHitObject)h;
fruit.CheckPosition = CheckIfWeCanCatch;
}
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
=> CatcherArea.OnNewResult((DrawableCatchHitObject)judgedObject, result);