1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 00:53:10 +08:00

remove RestorePieceState function

This commit is contained in:
Nikita-str 2024-12-27 18:55:45 +03:00
parent 94f3cf1cbf
commit a19459bb93
7 changed files with 6 additions and 29 deletions

View File

@ -77,8 +77,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
OnNewResult += onNewResult; OnNewResult += onNewResult;
} }
protected override void RestorePieceState() protected override void OnApply()
{ {
base.OnApply();
updateColour(); updateColour();
Height = HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE; Height = HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE;
} }

View File

@ -43,10 +43,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
base.OnApply(); base.OnApply();
IsFirstTick.Value = HitObject.FirstTick; IsFirstTick.Value = HitObject.FirstTick;
}
protected override void RestorePieceState()
{
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE); Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
} }

View File

@ -56,15 +56,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected override void OnApply() protected override void OnApply()
{ {
base.OnApply(); // it's empty actually
type.BindTo(HitObject.TypeBindable); 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) if (editorMode)
{ {
// We in Editor Mode so the performance is not critical and we can recreate piece. // We in Editor Mode so the performance is not critical and we can recreate piece.

View File

@ -144,8 +144,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Origin = Anchor.Centre, Origin = Anchor.Centre,
}); });
protected override void RestorePieceState() protected override void OnApply()
{ {
base.OnApply();
Size = baseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE); Size = baseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);
} }

View File

@ -43,7 +43,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
protected override void RestorePieceState() { }
protected override SkinnableDrawable OnLoadCreateMainPiece() protected override SkinnableDrawable OnLoadCreateMainPiece()
=> new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick), _ => new TickPiece()); => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick), _ => new TickPiece());
} }

View File

@ -150,17 +150,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Content.Add(MainPiece = drawable); 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();
/// <summary>Creates <c>MainPiece</c>. Calls only on <c>load</c> or in EditorMode.</summary> /// <summary>Creates <c>MainPiece</c>. Calls only on <c>load</c> or in EditorMode.</summary>
protected abstract SkinnableDrawable OnLoadCreateMainPiece(); protected abstract SkinnableDrawable OnLoadCreateMainPiece();
} }

View File

@ -27,11 +27,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected override void OnApply() 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(); base.OnApply();
isStrong.BindTo(HitObject.IsStrongBindable);
} }
protected override void OnFree() protected override void OnFree()