diff --git a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs index 374dcbe2a..e3ce3b8cb 100644 --- a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs +++ b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs @@ -33,23 +33,21 @@ public LineLifetimeEntry(DrawableSentakkiRuleset? drawableSentakkiRuleset, doubl public void Add(SentakkiLanedHitObject hitObject) { - hitObject.LaneBindable.ValueChanged += onLaneChanged; hitObject.BreakBindable.ValueChanged += onBreakChanged; + hitObject.ColourBindable.ValueChanged += onColorChanged; HitObjects.AddInPlace(hitObject, Comparer.Create((lhs, rhs) => lhs.Lane.CompareTo(rhs.Lane))); UpdateLine(); } public void Remove(SentakkiLanedHitObject hitObject) { - hitObject.LaneBindable.ValueChanged -= onLaneChanged; hitObject.BreakBindable.ValueChanged -= onBreakChanged; HitObjects.Remove(hitObject); UpdateLine(); } - private void onLaneChanged(ValueChangedEvent obj) => UpdateLine(); - private void onBreakChanged(ValueChangedEvent obj) => UpdateLine(); + private void onColorChanged(ValueChangedEvent obj) => UpdateLine(); public Action OnLineUpdated = null!; diff --git a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineRenderer.cs b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineRenderer.cs index 10ef16a22..99a442e82 100644 --- a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineRenderer.cs +++ b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineRenderer.cs @@ -85,7 +85,11 @@ public void AddHitObject(SentakkiLanedHitObject hitObject) public void RemoveHitObject(SentakkiLanedHitObject hitObject) { + // Ensure that we don't continue to receive time changes + startTimeMap[hitObject].UnbindAll(); + startTimeMap.Remove(hitObject); + removeHitObjectFromEntry(hitObject.StartTime, hitObject); } diff --git a/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs b/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs index 04e4b3647..0eca6756d 100644 --- a/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs +++ b/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs @@ -59,20 +59,13 @@ public LanedPlayfield() }); } - public override void Add(HitObject h) + public override void Add(HitObject hitObject) { - switch (h) - { - case SentakkiLanedHitObject laned: - HitObjectLineRenderer.AddHitObject(laned); - laned.LaneBindable.BindValueChanged(lane => - { - if (lane.OldValue != lane.NewValue) - Lanes[lane.OldValue].Remove(h); - Lanes[lane.NewValue].Add(h); - }, true); - break; - } + if (hitObject is not SentakkiLanedHitObject lanedHitObject) + return; + + HitObjectLineRenderer.AddHitObject(lanedHitObject); + Lanes[lanedHitObject.Lane].Add(lanedHitObject); } public override bool Remove(HitObject hitObject) diff --git a/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs b/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs index 995755222..984c25a2e 100644 --- a/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs +++ b/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs @@ -143,6 +143,20 @@ public override void Add(HitObject h) } } + public override bool Remove(HitObject h) + { + switch (h) + { + case SentakkiLanedHitObject: + return LanedPlayfield.Remove(h); + + case Touch: + return touchPlayfield.Remove(h); + default: + return base.Remove(h); + } + } + private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!judgedObject.DisplayResult || !DisplayJudgements.Value || judgedObject is not DrawableSentakkiHitObject sentakkiHitObject)