diff --git a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs index f29ded3bc..e3ce3b8cb 100644 --- a/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs +++ b/osu.Game.Rulesets.Sentakki/UI/Components/HitObjectLine/LineLifetimeEntry.cs @@ -34,6 +34,7 @@ public LineLifetimeEntry(DrawableSentakkiRuleset? drawableSentakkiRuleset, doubl public void Add(SentakkiLanedHitObject hitObject) { hitObject.BreakBindable.ValueChanged += onBreakChanged; + hitObject.ColourBindable.ValueChanged += onColorChanged; HitObjects.AddInPlace(hitObject, Comparer.Create((lhs, rhs) => lhs.Lane.CompareTo(rhs.Lane))); UpdateLine(); } @@ -46,6 +47,7 @@ public void Remove(SentakkiLanedHitObject hitObject) } 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 d316dd36e..0eca6756d 100644 --- a/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs +++ b/osu.Game.Rulesets.Sentakki/UI/LanedPlayfield.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Sentakki.Objects; using osu.Game.Rulesets.Sentakki.Objects.Drawables; using osu.Game.Rulesets.Sentakki.Objects.Drawables.Pieces.Slides; @@ -60,15 +59,13 @@ public LanedPlayfield() }); } - public override void Add(HitObject h) + public override void Add(HitObject hitObject) { - switch (h) - { - case SentakkiLanedHitObject laned: - HitObjectLineRenderer.AddHitObject(laned); - Lanes[laned.Lane].Add(h); - break; - } + if (hitObject is not SentakkiLanedHitObject lanedHitObject) + return; + + HitObjectLineRenderer.AddHitObject(lanedHitObject); + Lanes[lanedHitObject.Lane].Add(lanedHitObject); } public override bool Remove(HitObject hitObject) @@ -76,25 +73,9 @@ public override bool Remove(HitObject hitObject) if (hitObject is not SentakkiLanedHitObject lanedHitObject) return false; + HitObjectLineRenderer.RemoveHitObject(lanedHitObject); return Lanes[lanedHitObject.Lane].Remove(lanedHitObject); } - public override void Add(DrawableHitObject h) - { - switch (h) - { - case DrawableSentakkiLanedHitObject laned: - Lanes[laned.HitObject.Lane].Add(h); - break; - } - } - - public override bool Remove(DrawableHitObject hitObject) - { - if (hitObject is not DrawableSentakkiLanedHitObject lanedHitObject) - return false; - - return Lanes[lanedHitObject.HitObject.Lane].Remove(lanedHitObject); - } private void onHitObjectLoaded(Drawable hitObject) { diff --git a/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs b/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs index ceda9886a..984c25a2e 100644 --- a/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs +++ b/osu.Game.Rulesets.Sentakki/UI/SentakkiPlayfield.cs @@ -157,39 +157,6 @@ public override bool Remove(HitObject h) } } - public override void Add(DrawableHitObject h) - { - switch (h) - { - case SentakkiLanedHitObject: - LanedPlayfield.Add(h); - break; - - case Touch: - touchPlayfield.Add(h); - break; - - default: - base.Add(h); - break; - } - } - - public override bool Remove(DrawableHitObject 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)