diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index 683d48df10..76eb6bb77d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.F, Key.J }; - private readonly CirclePiece circlePiece; - public DrawableCentreHit(Hit hit) : base(hit) { - Add(circlePiece = new CirclePiece - { - Children = new[] - { - new CentreHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.PinkDarker; + Circle.AccentColour = colours.PinkDarker; } + + protected override CirclePiece CreateCirclePiece() => new CirclePiece + { + Children = new[] { new CentreHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index c8a7355e3c..f6239da929 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using System; using System.Linq; @@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override Container Content => bodyContainer; + protected readonly CirclePiece Circle; + private readonly Hit hit; + private readonly Container bodyContainer; + /// /// Whether the last key pressed is a valid hit key. /// private bool validKeyPressed; - private readonly Container bodyContainer; - protected DrawableHit(Hit hit) : base(hit) { @@ -38,6 +41,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Children = new[] + { + Circle = CreateCirclePiece() + } }); } @@ -100,5 +107,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Expire(); } + + protected abstract CirclePiece CreateCirclePiece(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs index cab6819300..893a6fbb4d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.D, Key.K }; - private readonly CirclePiece circlePiece; - public DrawableRimHit(Hit hit) : base(hit) { - Add(circlePiece = new CirclePiece - { - Children = new[] - { - new RimHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.BlueDarker; + Circle.AccentColour = colours.BlueDarker; } + + protected override CirclePiece CreateCirclePiece() => new CirclePiece + { + Children = new[] { new RimHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index b4ec0b108a..bac44f48fb 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.F, Key.J }; - private readonly CirclePiece circlePiece; - public DrawableStrongCentreHit(Hit hit) : base(hit) { - Add(circlePiece = new StrongCirclePiece - { - Children = new [] - { - new CentreHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.PinkDarker; + Circle.AccentColour = colours.PinkDarker; } + + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece + { + Children = new[] { new CentreHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs index 1f77ad0409..985ba1c2df 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.D, Key.K }; - private readonly CirclePiece circlePiece; - public DrawableStrongRimHit(Hit hit) : base(hit) { - Add(circlePiece = new StrongCirclePiece - { - Children = new[] - { - new RimHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.BlueDarker; + Circle.AccentColour = colours.BlueDarker; } + + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece + { + Children = new[] { new RimHitSymbolPiece() } + }; } }