From a19459bb934f92bd8196148d1ae74c2d4b576f88 Mon Sep 17 00:00:00 2001 From: Nikita-str Date: Fri, 27 Dec 2024 18:55:45 +0300 Subject: [PATCH] remove `RestorePieceState` function --- .../Objects/Drawables/DrawableDrumRoll.cs | 3 ++- .../Objects/Drawables/DrawableDrumRollTick.cs | 4 ---- .../Objects/Drawables/DrawableHit.cs | 8 +------- .../Objects/Drawables/DrawableSwell.cs | 3 ++- .../Objects/Drawables/DrawableSwellTick.cs | 1 - .../Objects/Drawables/DrawableTaikoHitObject.cs | 11 ----------- .../Drawables/DrawableTaikoStrongableHitObject.cs | 5 +---- 7 files changed, 6 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 82c92ab1e5..0aeca3d68d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -77,8 +77,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables OnNewResult += onNewResult; } - protected override void RestorePieceState() + protected override void OnApply() { + base.OnApply(); updateColour(); Height = HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 5b8bb5500d..7d894de6ee 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -43,10 +43,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables base.OnApply(); IsFirstTick.Value = HitObject.FirstTick; - } - - protected override void RestorePieceState() - { Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 2343919ff3..2987dbe0f4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -56,15 +56,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void OnApply() { + base.OnApply(); // it's empty actually type.BindTo(HitObject.TypeBindable); - // this doesn't need to be run inline as RecreatePieces is called by the base call below. - type.BindValueChanged(_ => Scheduler.AddOnce(RestorePieceState)); - base.OnApply(); - } - - protected override void RestorePieceState() - { if (editorMode) { // We in Editor Mode so the performance is not critical and we can recreate piece. diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 3ce4ac447d..7fb4b77dee 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -144,8 +144,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Origin = Anchor.Centre, }); - protected override void RestorePieceState() + protected override void OnApply() { + base.OnApply(); Size = baseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs index 0098e9ac0a..633e1751ed 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -43,7 +43,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(KeyBindingPressEvent e) => false; - protected override void RestorePieceState() { } protected override SkinnableDrawable OnLoadCreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick), _ => new TickPiece()); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 57bbb191f0..2978be8094 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -150,17 +150,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Content.Add(MainPiece = drawable); } - protected override void OnApply() - { - base.OnApply(); - - // TODO: now it fixed, yes? - // TODO: THIS CANNOT BE HERE, it makes pooling pointless (see https://github.com/ppy/osu/issues/21072). - RestorePieceState(); - } - - protected abstract void RestorePieceState(); - /// Creates MainPiece. Calls only on load or in EditorMode. protected abstract SkinnableDrawable OnLoadCreateMainPiece(); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs index 93fd6af496..3b68e0fa73 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoStrongableHitObject.cs @@ -27,11 +27,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void OnApply() { - isStrong.BindTo(HitObject.IsStrongBindable); - // this doesn't need to be run inline as RecreatePieces is called by the base call below. - isStrong.BindValueChanged(_ => Scheduler.AddOnce(RestorePieceState)); - base.OnApply(); + isStrong.BindTo(HitObject.IsStrongBindable); } protected override void OnFree()