From 87189452d1a7d53c1167eb94fc291a74b27ded16 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 12:57:24 +0900 Subject: [PATCH 01/12] Refactor legacy skin piece to allow texture update --- .../Skinning/LegacyCatchHitObjectPiece.cs | 100 ++++++++++++++++++ .../Skinning/LegacyDropletPiece.cs | 20 ++++ .../Skinning/LegacyFruitPiece.cs | 84 ++++----------- 3 files changed, 140 insertions(+), 64 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs create mode 100644 osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs new file mode 100644 index 0000000000..4bcb92b9be --- /dev/null +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs @@ -0,0 +1,100 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Pooling; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Rulesets.Catch.Objects.Drawables; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Skinning; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Catch.Skinning +{ + public abstract class LegacyCatchHitObjectPiece : PoolableDrawable + { + public readonly Bindable AccentColour = new Bindable(); + public readonly Bindable HyperDash = new Bindable(); + + private readonly Sprite colouredSprite; + private readonly Sprite overlaySprite; + private readonly Sprite hyperSprite; + + [Resolved] + private ISkinSource skin { get; set; } + + protected ISkinSource Skin => skin; + + [Resolved(canBeNull: true)] + private DrawableHitObject drawableHitObject { get; set; } + + [CanBeNull] + protected DrawablePalpableCatchHitObject DrawableHitObject => (DrawablePalpableCatchHitObject)drawableHitObject; + + protected LegacyCatchHitObjectPiece() + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + colouredSprite = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + overlaySprite = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + hyperSprite = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Blending = BlendingParameters.Additive, + Depth = 1, + Alpha = 0, + Scale = new Vector2(1.2f), + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (DrawableHitObject != null) + { + AccentColour.BindTo(DrawableHitObject.AccentColour); + HyperDash.BindTo(DrawableHitObject.HyperDash); + } + + hyperSprite.Colour = Skin.GetConfig(CatchSkinColour.HyperDashFruit)?.Value ?? + Skin.GetConfig(CatchSkinColour.HyperDash)?.Value ?? + Catcher.DEFAULT_HYPER_DASH_COLOUR; + + AccentColour.BindValueChanged(colour => + { + colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue); + }, true); + + HyperDash.BindValueChanged(hyper => + { + hyperSprite.Alpha = hyper.NewValue ? 0.7f : 0; + }, true); + } + + protected void SetTexture(Texture texture, Texture overlayTexture) + { + colouredSprite.Texture = texture; + overlaySprite.Texture = overlayTexture; + hyperSprite.Texture = texture; + } + } +} diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs new file mode 100644 index 0000000000..cc8886f631 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Rulesets.Catch.Skinning +{ + public class LegacyDropletPiece : LegacyCatchHitObjectPiece + { + protected override void LoadComplete() + { + base.LoadComplete(); + + Texture texture = Skin.GetTexture("fruit-drop"); + Texture overlayTexture = Skin.GetTexture("fruit-drop-overlay"); + + SetTexture(texture, overlayTexture); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs index b8648f46f0..7008234e99 100644 --- a/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs @@ -1,83 +1,39 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Catch.Objects.Drawables; -using osu.Game.Rulesets.Catch.UI; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Skinning; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Skinning { - internal class LegacyFruitPiece : CompositeDrawable + internal class LegacyFruitPiece : LegacyCatchHitObjectPiece { - private readonly string lookupName; + public readonly Bindable VisualRepresentation = new Bindable(); - private readonly Bindable accentColour = new Bindable(); - private readonly Bindable hyperDash = new Bindable(); - private Sprite colouredSprite; - - public LegacyFruitPiece(string lookupName) + private readonly string[] lookupNames = { - this.lookupName = lookupName; - RelativeSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader] - private void load(DrawableHitObject drawableObject, ISkinSource skin) - { - var drawableCatchObject = (DrawablePalpableCatchHitObject)drawableObject; - - accentColour.BindTo(drawableCatchObject.AccentColour); - hyperDash.BindTo(drawableCatchObject.HyperDash); - - InternalChildren = new Drawable[] - { - colouredSprite = new Sprite - { - Texture = skin.GetTexture(lookupName), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - new Sprite - { - Texture = skin.GetTexture($"{lookupName}-overlay"), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - }; - - if (hyperDash.Value) - { - var hyperDashOverlay = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Blending = BlendingParameters.Additive, - Depth = 1, - Alpha = 0.7f, - Scale = new Vector2(1.2f), - Texture = skin.GetTexture(lookupName), - Colour = skin.GetConfig(CatchSkinColour.HyperDashFruit)?.Value ?? - skin.GetConfig(CatchSkinColour.HyperDash)?.Value ?? - Catcher.DEFAULT_HYPER_DASH_COLOUR, - }; - - AddInternal(hyperDashOverlay); - } - } + "fruit-pear", "fruit-grapes", "fruit-apple", "fruit-orange", "fruit-bananas" + }; protected override void LoadComplete() { base.LoadComplete(); - accentColour.BindValueChanged(colour => colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); + var fruit = (DrawableFruit)DrawableHitObject; + + if (fruit != null) + VisualRepresentation.BindTo(fruit.VisualRepresentation); + + VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true); + } + + private void setTexture(FruitVisualRepresentation visualRepresentation) + { + Texture texture = Skin.GetTexture(lookupNames[(int)visualRepresentation]); + Texture overlayTexture = Skin.GetTexture(lookupNames[(int)visualRepresentation] + "-overlay"); + + SetTexture(texture, overlayTexture); } } } From d51d2c533155d292c454780a9597bfc866f83556 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 12:59:03 +0900 Subject: [PATCH 02/12] Don't recreate pieces when catch DHO is reused --- .../CatchSkinComponents.cs | 7 +--- .../Objects/Drawables/DrawableDroplet.cs | 7 +--- .../Objects/Drawables/DrawableFruit.cs | 39 ++----------------- .../Skinning/CatchLegacySkinTransformer.cs | 21 +++++----- 4 files changed, 17 insertions(+), 57 deletions(-) diff --git a/osu.Game.Rulesets.Catch/CatchSkinComponents.cs b/osu.Game.Rulesets.Catch/CatchSkinComponents.cs index 23d8428fec..668f7197be 100644 --- a/osu.Game.Rulesets.Catch/CatchSkinComponents.cs +++ b/osu.Game.Rulesets.Catch/CatchSkinComponents.cs @@ -5,11 +5,8 @@ namespace osu.Game.Rulesets.Catch { public enum CatchSkinComponents { - FruitBananas, - FruitApple, - FruitGrapes, - FruitOrange, - FruitPear, + Fruit, + Banana, Droplet, CatcherIdle, CatcherFail, diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs index b8acea625b..4c49bfe6c9 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs @@ -25,17 +25,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables [BackgroundDependencyLoader] private void load() - { - HyperDash.BindValueChanged(_ => updatePiece(), true); - } - - private void updatePiece() { ScaleContainer.Child = new SkinnableDrawable( new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new DropletPiece { - HyperDash = { BindTarget = HyperDash } + HyperDash = { BindTarget = HyperDash }, }); } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs index ef9df02a68..2998d2cc6f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -35,21 +34,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables VisualRepresentation.Value = GetVisualRepresentation(change.NewValue); }, true); - VisualRepresentation.BindValueChanged(_ => updatePiece()); - HyperDash.BindValueChanged(_ => updatePiece(), true); - } - - protected override void UpdateInitialTransforms() - { - base.UpdateInitialTransforms(); - - ScaleContainer.RotateTo((RandomSingle(1) - 0.5f) * 40); - } - - private void updatePiece() - { ScaleContainer.Child = new SkinnableDrawable( - new CatchSkinComponent(getComponent(VisualRepresentation.Value)), + new CatchSkinComponent(this is DrawableBanana ? CatchSkinComponents.Banana : CatchSkinComponents.Fruit), _ => new FruitPiece { VisualRepresentation = { BindTarget = VisualRepresentation }, @@ -57,28 +43,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables }); } - private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation) + protected override void UpdateInitialTransforms() { - switch (hitObjectVisualRepresentation) - { - case FruitVisualRepresentation.Pear: - return CatchSkinComponents.FruitPear; + base.UpdateInitialTransforms(); - case FruitVisualRepresentation.Grape: - return CatchSkinComponents.FruitGrapes; - - case FruitVisualRepresentation.Pineapple: - return CatchSkinComponents.FruitApple; - - case FruitVisualRepresentation.Raspberry: - return CatchSkinComponents.FruitOrange; - - case FruitVisualRepresentation.Banana: - return CatchSkinComponents.FruitBananas; - - default: - throw new ArgumentOutOfRangeException(nameof(hitObjectVisualRepresentation), hitObjectVisualRepresentation, null); - } + ScaleContainer.RotateTo((RandomSingle(1) - 0.5f) * 40); } } diff --git a/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs b/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs index 22db147e32..1889b230a7 100644 --- a/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs @@ -1,11 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using Humanizer; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Skinning; -using osuTK; using osuTK.Graphics; using static osu.Game.Skinning.LegacySkinConfiguration; @@ -40,20 +38,21 @@ namespace osu.Game.Rulesets.Catch.Skinning switch (catchSkinComponent.Component) { - case CatchSkinComponents.FruitApple: - case CatchSkinComponents.FruitBananas: - case CatchSkinComponents.FruitOrange: - case CatchSkinComponents.FruitGrapes: - case CatchSkinComponents.FruitPear: - var lookupName = catchSkinComponent.Component.ToString().Kebaberize(); - if (GetTexture(lookupName) != null) - return new LegacyFruitPiece(lookupName); + case CatchSkinComponents.Fruit: + if (GetTexture("fruit-pear") != null) + return new LegacyFruitPiece(); + + break; + + case CatchSkinComponents.Banana: + if (GetTexture("fruit-bananas") != null) + return new LegacyFruitPiece(); break; case CatchSkinComponents.Droplet: if (GetTexture("fruit-drop") != null) - return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) }; + return new LegacyDropletPiece(); break; From 0d73bf84888b655ef1b233464bf1a9239c70b9f3 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 13:14:00 +0900 Subject: [PATCH 03/12] Refactor catch default piece to allow reuse But Fruit in-place update is still incomplete, as child drawables are recreated when reused. --- .../Objects/Drawables/DrawableDroplet.cs | 5 +- .../Objects/Drawables/DrawableFruit.cs | 6 +-- .../Drawables/Pieces/CatchHitObjectPiece.cs | 54 +++++++++++++++++++ .../Objects/Drawables/Pieces/DropletPiece.cs | 27 +++------- .../Objects/Drawables/Pieces/FruitPiece.cs | 48 +++++++---------- 5 files changed, 83 insertions(+), 57 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/CatchHitObjectPiece.cs diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs index 4c49bfe6c9..dea19a2446 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableDroplet.cs @@ -28,10 +28,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { ScaleContainer.Child = new SkinnableDrawable( new CatchSkinComponent(CatchSkinComponents.Droplet), - _ => new DropletPiece - { - HyperDash = { BindTarget = HyperDash }, - }); + _ => new DropletPiece()); } protected override void UpdateInitialTransforms() diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs index 2998d2cc6f..8db8f5ec82 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs @@ -36,11 +36,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables ScaleContainer.Child = new SkinnableDrawable( new CatchSkinComponent(this is DrawableBanana ? CatchSkinComponents.Banana : CatchSkinComponents.Fruit), - _ => new FruitPiece - { - VisualRepresentation = { BindTarget = VisualRepresentation }, - HyperDash = { BindTarget = HyperDash }, - }); + _ => new FruitPiece()); } protected override void UpdateInitialTransforms() diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/CatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/CatchHitObjectPiece.cs new file mode 100644 index 0000000000..ec5f66a945 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/CatchHitObjectPiece.cs @@ -0,0 +1,54 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Objects.Drawables; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces +{ + public class CatchHitObjectPiece : CompositeDrawable + { + public readonly Bindable AccentColour = new Bindable(); + public readonly Bindable HyperDash = new Bindable(); + + [Resolved(canBeNull: true)] + private DrawableHitObject drawableHitObject { get; set; } + + [CanBeNull] + protected DrawablePalpableCatchHitObject DrawableHitObject => (DrawablePalpableCatchHitObject)drawableHitObject; + + [CanBeNull] + protected BorderPiece BorderPiece; + + [CanBeNull] + protected HyperBorderPiece HyperBorderPiece; + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (DrawableHitObject != null) + { + AccentColour.BindTo(DrawableHitObject.AccentColour); + HyperDash.BindTo(DrawableHitObject.HyperDash); + } + + HyperDash.BindValueChanged(hyper => + { + if (HyperBorderPiece != null) + HyperBorderPiece.Alpha = hyper.NewValue ? 1 : 0; + }, true); + } + + protected override void Update() + { + if (BorderPiece != null && DrawableHitObject?.HitObject != null) + BorderPiece.Alpha = (float)Math.Clamp((DrawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/DropletPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/DropletPiece.cs index c90407ae15..f92c92160a 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/DropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/DropletPiece.cs @@ -1,37 +1,26 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Objects.Drawables; using osuTK; namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces { - public class DropletPiece : CompositeDrawable + public class DropletPiece : CatchHitObjectPiece { - public readonly Bindable HyperDash = new Bindable(); - public DropletPiece() { Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2); - } - [BackgroundDependencyLoader] - private void load(DrawableHitObject drawableObject) - { - InternalChild = new Pulp + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - AccentColour = { BindTarget = drawableObject.AccentColour } + new Pulp + { + RelativeSizeAxes = Axes.Both, + AccentColour = { BindTarget = AccentColour } + }, + HyperBorderPiece = new HyperDropletBorderPiece() }; - - if (HyperDash.Value) - { - AddInternal(new HyperDropletBorderPiece()); - } } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs index 31487ee407..9b5c00b2bf 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs @@ -1,17 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using JetBrains.Annotations; -using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces { - internal class FruitPiece : CompositeDrawable + internal class FruitPiece : CatchHitObjectPiece { /// /// Because we're adding a border around the fruit, we need to scale down some. @@ -19,38 +14,36 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces public const float RADIUS_ADJUST = 1.1f; public readonly Bindable VisualRepresentation = new Bindable(); - public readonly Bindable HyperDash = new Bindable(); - - [CanBeNull] - private DrawableCatchHitObject drawableHitObject; - - [CanBeNull] - private BorderPiece borderPiece; public FruitPiece() { RelativeSizeAxes = Axes.Both; } - [BackgroundDependencyLoader(permitNulls: true)] - private void load([CanBeNull] DrawableHitObject drawable) + protected override void LoadComplete() { - drawableHitObject = (DrawableCatchHitObject)drawable; + base.LoadComplete(); + + if (DrawableHitObject != null) + { + var fruit = (DrawableFruit)DrawableHitObject; + VisualRepresentation.BindTo(fruit.VisualRepresentation); + } + + VisualRepresentation.BindValueChanged(_ => recreateChildren(), true); + } + + private void recreateChildren() + { + ClearInternal(); AddInternal(getFruitFor(VisualRepresentation.Value)); - // if it is not part of a DHO, the border is always invisible. - if (drawableHitObject != null) - AddInternal(borderPiece = new BorderPiece()); + if (DrawableHitObject != null) + AddInternal(BorderPiece = new BorderPiece()); if (HyperDash.Value) - AddInternal(new HyperBorderPiece()); - } - - protected override void Update() - { - if (borderPiece != null && drawableHitObject?.HitObject != null) - borderPiece.Alpha = (float)Math.Clamp((drawableHitObject.HitObject.StartTime - Time.Current) / 500, 0, 1); + AddInternal(HyperBorderPiece = new HyperBorderPiece()); } private Drawable getFruitFor(FruitVisualRepresentation representation) @@ -66,9 +59,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces case FruitVisualRepresentation.Pineapple: return new PineapplePiece(); - case FruitVisualRepresentation.Banana: - return new BananaPiece(); - case FruitVisualRepresentation.Raspberry: return new RaspberryPiece(); } From b8f1c499a45f6dd71b925b2963ba7f5f7858d05c Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 13:56:22 +0900 Subject: [PATCH 04/12] Allow PulpFormation to update formation dynamically Pulps are lazily allocated but never deallocated for a DrawableFruit --- .../Objects/Drawables/Pieces/BananaPiece.cs | 30 --------- .../Objects/Drawables/Pieces/FruitPiece.cs | 46 ++++---------- .../Drawables/Pieces/FruitPulpFormation.cs | 63 +++++++++++++++++++ .../Objects/Drawables/Pieces/GrapePiece.cs | 42 ------------- .../Objects/Drawables/Pieces/PearPiece.cs | 42 ------------- .../Drawables/Pieces/PineapplePiece.cs | 48 -------------- .../Objects/Drawables/Pieces/Pulp.cs | 4 +- .../Objects/Drawables/Pieces/PulpFormation.cs | 26 +++++--- .../Drawables/Pieces/RaspberryPiece.cs | 48 -------------- 9 files changed, 95 insertions(+), 254 deletions(-) delete mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs delete mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/GrapePiece.cs delete mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PearPiece.cs delete mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PineapplePiece.cs delete mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/RaspberryPiece.cs diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs deleted file mode 100644 index fa8837dec5..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces -{ - public class BananaPiece : PulpFormation - { - public BananaPiece() - { - InternalChildren = new Drawable[] - { - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(SMALL_PULP), - Y = -0.3f - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f), - Y = 0.05f, - }, - }; - } - } -} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs index 9b5c00b2bf..e915253ff7 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPiece.cs @@ -18,6 +18,17 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces public FruitPiece() { RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new FruitPulpFormation + { + AccentColour = { BindTarget = AccentColour }, + VisualRepresentation = { BindTarget = VisualRepresentation } + }, + BorderPiece = new BorderPiece(), + HyperBorderPiece = new HyperBorderPiece() + }; } protected override void LoadComplete() @@ -29,41 +40,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces var fruit = (DrawableFruit)DrawableHitObject; VisualRepresentation.BindTo(fruit.VisualRepresentation); } - - VisualRepresentation.BindValueChanged(_ => recreateChildren(), true); - } - - private void recreateChildren() - { - ClearInternal(); - - AddInternal(getFruitFor(VisualRepresentation.Value)); - - if (DrawableHitObject != null) - AddInternal(BorderPiece = new BorderPiece()); - - if (HyperDash.Value) - AddInternal(HyperBorderPiece = new HyperBorderPiece()); - } - - private Drawable getFruitFor(FruitVisualRepresentation representation) - { - switch (representation) - { - case FruitVisualRepresentation.Pear: - return new PearPiece(); - - case FruitVisualRepresentation.Grape: - return new GrapePiece(); - - case FruitVisualRepresentation.Pineapple: - return new PineapplePiece(); - - case FruitVisualRepresentation.Raspberry: - return new RaspberryPiece(); - } - - return Empty(); } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs new file mode 100644 index 0000000000..cd870b1f98 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs @@ -0,0 +1,63 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; +using osuTK; + +namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces +{ + public class FruitPulpFormation : PulpFormation + { + public readonly Bindable VisualRepresentation = new Bindable(); + + protected override void LoadComplete() + { + base.LoadComplete(); + + VisualRepresentation.BindValueChanged(setFormation, true); + } + + private void setFormation(ValueChangedEvent visualRepresentation) + { + Clear(); + + switch (visualRepresentation.NewValue) + { + case FruitVisualRepresentation.Pear: + Add(new Vector2(0, -0.33f), new Vector2(SMALL_PULP)); + Add(PositionAt(60, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + Add(PositionAt(180, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + Add(PositionAt(300, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + break; + + case FruitVisualRepresentation.Grape: + Add(new Vector2(0, -0.25f), new Vector2(SMALL_PULP)); + Add(PositionAt(0, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + Add(PositionAt(120, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + Add(PositionAt(240, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + break; + + case FruitVisualRepresentation.Pineapple: + Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); + Add(PositionAt(45, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(135, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(225, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(315, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + break; + + case FruitVisualRepresentation.Raspberry: + Add(new Vector2(0, -0.34f), new Vector2(SMALL_PULP)); + Add(PositionAt(0, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(90, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(180, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + Add(PositionAt(270, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + break; + + case FruitVisualRepresentation.Banana: + Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); + Add(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f)); + break; + } + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/GrapePiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/GrapePiece.cs deleted file mode 100644 index 15349c18d5..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/GrapePiece.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces -{ - public class GrapePiece : PulpFormation - { - public GrapePiece() - { - InternalChildren = new Drawable[] - { - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(SMALL_PULP), - Y = -0.25f, - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_3), - Position = PositionAt(0, DISTANCE_FROM_CENTRE_3), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_3), - Position = PositionAt(120, DISTANCE_FROM_CENTRE_3), - }, - new Pulp - { - Size = new Vector2(LARGE_PULP_3), - AccentColour = { BindTarget = AccentColour }, - Position = PositionAt(240, DISTANCE_FROM_CENTRE_3), - }, - }; - } - } -} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PearPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PearPiece.cs deleted file mode 100644 index 3372a06996..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PearPiece.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces -{ - public class PearPiece : PulpFormation - { - public PearPiece() - { - InternalChildren = new Drawable[] - { - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(SMALL_PULP), - Y = -0.33f, - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_3), - Position = PositionAt(60, DISTANCE_FROM_CENTRE_3), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_3), - Position = PositionAt(180, DISTANCE_FROM_CENTRE_3), - }, - new Pulp - { - Size = new Vector2(LARGE_PULP_3), - AccentColour = { BindTarget = AccentColour }, - Position = PositionAt(300, DISTANCE_FROM_CENTRE_3), - }, - }; - } - } -} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PineapplePiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PineapplePiece.cs deleted file mode 100644 index 7f80c58178..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PineapplePiece.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces -{ - public class PineapplePiece : PulpFormation - { - public PineapplePiece() - { - InternalChildren = new Drawable[] - { - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(SMALL_PULP), - Y = -0.3f, - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(45, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(135, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(225, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - Size = new Vector2(LARGE_PULP_4), - AccentColour = { BindTarget = AccentColour }, - Position = PositionAt(315, DISTANCE_FROM_CENTRE_4), - }, - }; - } - } -} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/Pulp.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/Pulp.cs index d3e4945611..3113cf0ceb 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/Pulp.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/Pulp.cs @@ -12,6 +12,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces { public class Pulp : Circle { + public readonly Bindable AccentColour = new Bindable(); + public Pulp() { RelativePositionAxes = Axes.Both; @@ -22,8 +24,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces Colour = Color4.White.Opacity(0.9f); } - public readonly Bindable AccentColour = new Bindable(); - protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PulpFormation.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PulpFormation.cs index 1df548e70a..412750019f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/PulpFormation.cs @@ -2,11 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Objects.Drawables; using osuTK; using osuTK.Graphics; @@ -14,7 +12,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces { public abstract class PulpFormation : CompositeDrawable { - protected readonly IBindable AccentColour = new Bindable(); + public readonly Bindable AccentColour = new Bindable(); protected const float LARGE_PULP_3 = 16f * FruitPiece.RADIUS_ADJUST; protected const float DISTANCE_FROM_CENTRE_3 = 0.15f; @@ -24,6 +22,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces protected const float SMALL_PULP = LARGE_PULP_3 / 2; + private int numPulps; + protected PulpFormation() { RelativeSizeAxes = Axes.Both; @@ -33,11 +33,23 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces distance * MathF.Sin(angle * MathF.PI / 180), distance * MathF.Cos(angle * MathF.PI / 180)); - [BackgroundDependencyLoader] - private void load(DrawableHitObject drawableObject) + protected void Clear() { - DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject; - AccentColour.BindTo(drawableCatchObject.AccentColour); + for (; numPulps > 0; numPulps--) + InternalChildren[numPulps - 1].Alpha = 0; + } + + protected void Add(Vector2 position, Vector2 size) + { + if (numPulps == InternalChildren.Count) + AddInternal(new Pulp { AccentColour = { BindTarget = AccentColour } }); + + var pulp = InternalChildren[numPulps]; + pulp.Position = position; + pulp.Size = size; + pulp.Alpha = 1; + + numPulps++; } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/RaspberryPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/RaspberryPiece.cs deleted file mode 100644 index 288ece95b2..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/RaspberryPiece.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces -{ - public class RaspberryPiece : PulpFormation - { - public RaspberryPiece() - { - InternalChildren = new Drawable[] - { - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(SMALL_PULP), - Y = -0.34f, - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(0, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(90, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - AccentColour = { BindTarget = AccentColour }, - Size = new Vector2(LARGE_PULP_4), - Position = PositionAt(180, DISTANCE_FROM_CENTRE_4), - }, - new Pulp - { - Size = new Vector2(LARGE_PULP_4), - AccentColour = { BindTarget = AccentColour }, - Position = PositionAt(270, DISTANCE_FROM_CENTRE_4), - }, - }; - } - } -} From c0f39514b9aba1295ba168ad29b541ba92d4b1a7 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 14:00:22 +0900 Subject: [PATCH 05/12] Fix legacy droplet scale --- osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs index cc8886f631..8f4331d2a3 100644 --- a/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyDropletPiece.cs @@ -2,11 +2,17 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Textures; +using osuTK; namespace osu.Game.Rulesets.Catch.Skinning { public class LegacyDropletPiece : LegacyCatchHitObjectPiece { + public LegacyDropletPiece() + { + Scale = new Vector2(0.8f); + } + protected override void LoadComplete() { base.LoadComplete(); From 7f1ad1040d3fef6def87abcd4144014b3952148b Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 14:08:50 +0900 Subject: [PATCH 06/12] Don't inherit DrawableFruit from DrawableBanana - A banana cannot be hyper --- .../Objects/Drawables/DrawableBanana.cs | 15 +++++++++--- .../Objects/Drawables/DrawableFruit.cs | 7 ++---- .../Objects/Drawables/Pieces/BananaPiece.cs | 24 +++++++++++++++++++ .../Drawables/Pieces/BananaPulpFormation.cs | 16 +++++++++++++ .../Drawables/Pieces/FruitPulpFormation.cs | 5 ---- .../Skinning/CatchLegacySkinTransformer.cs | 2 +- .../Skinning/LegacyBananaPiece.cs | 20 ++++++++++++++++ .../Skinning/LegacyFruitPiece.cs | 2 +- 8 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPulpFormation.cs create mode 100644 osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs index 8e9d80106b..bdf257a13f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableBanana.cs @@ -2,14 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using JetBrains.Annotations; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces; +using osu.Game.Skinning; namespace osu.Game.Rulesets.Catch.Objects.Drawables { - public class DrawableBanana : DrawableFruit + public class DrawableBanana : DrawablePalpableCatchHitObject { - protected override FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => FruitVisualRepresentation.Banana; - public DrawableBanana() : this(null) { @@ -20,6 +21,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { } + [BackgroundDependencyLoader] + private void load() + { + ScaleContainer.Child = new SkinnableDrawable( + new CatchSkinComponent(CatchSkinComponents.Banana), + _ => new BananaPiece()); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs index 8db8f5ec82..63b48ea99f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableFruit.cs @@ -14,8 +14,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { public readonly Bindable VisualRepresentation = new Bindable(); - protected virtual FruitVisualRepresentation GetVisualRepresentation(int indexInBeatmap) => (FruitVisualRepresentation)(indexInBeatmap % 4); - public DrawableFruit() : this(null) { @@ -31,11 +29,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { IndexInBeatmap.BindValueChanged(change => { - VisualRepresentation.Value = GetVisualRepresentation(change.NewValue); + VisualRepresentation.Value = (FruitVisualRepresentation)(change.NewValue % 4); }, true); ScaleContainer.Child = new SkinnableDrawable( - new CatchSkinComponent(this is DrawableBanana ? CatchSkinComponents.Banana : CatchSkinComponents.Fruit), + new CatchSkinComponent(CatchSkinComponents.Fruit), _ => new FruitPiece()); } @@ -53,6 +51,5 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables Grape, Pineapple, Raspberry, - Banana // banananananannaanana } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs new file mode 100644 index 0000000000..9f5d3f36df --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPiece.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; + +namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces +{ + public class BananaPiece : CatchHitObjectPiece + { + public BananaPiece() + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new BananaPulpFormation + { + AccentColour = { BindTarget = AccentColour }, + }, + BorderPiece = new BorderPiece(), + }; + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPulpFormation.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPulpFormation.cs new file mode 100644 index 0000000000..b22d7fb413 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/BananaPulpFormation.cs @@ -0,0 +1,16 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osuTK; + +namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces +{ + public class BananaPulpFormation : PulpFormation + { + public BananaPulpFormation() + { + Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); + Add(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f)); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs index cd870b1f98..c0b1f588f5 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/Pieces/FruitPulpFormation.cs @@ -52,11 +52,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces Add(PositionAt(180, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); Add(PositionAt(270, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); break; - - case FruitVisualRepresentation.Banana: - Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); - Add(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f)); - break; } } } diff --git a/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs b/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs index 1889b230a7..b4bee8adc6 100644 --- a/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Catch/Skinning/CatchLegacySkinTransformer.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Skinning case CatchSkinComponents.Banana: if (GetTexture("fruit-bananas") != null) - return new LegacyFruitPiece(); + return new LegacyBananaPiece(); break; diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs new file mode 100644 index 0000000000..f80e50c8c0 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyBananaPiece.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Rulesets.Catch.Skinning +{ + public class LegacyBananaPiece : LegacyCatchHitObjectPiece + { + protected override void LoadComplete() + { + base.LoadComplete(); + + Texture texture = Skin.GetTexture("fruit-bananas"); + Texture overlayTexture = Skin.GetTexture("fruit-bananas-overlay"); + + SetTexture(texture, overlayTexture); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs index 7008234e99..9b3003f1d6 100644 --- a/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyFruitPiece.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Skinning private readonly string[] lookupNames = { - "fruit-pear", "fruit-grapes", "fruit-apple", "fruit-orange", "fruit-bananas" + "fruit-pear", "fruit-grapes", "fruit-apple", "fruit-orange" }; protected override void LoadComplete() From c1d39b64010652f194df448b74f9ccedc04fea0a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 7 Dec 2020 14:10:17 +0900 Subject: [PATCH 07/12] Don't inherit Fruit from Banana --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index 3f71da713e..178306b3bc 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -14,7 +14,7 @@ using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects { - public class Banana : Fruit, IHasComboInformation + public class Banana : PalpableCatchHitObject, IHasComboInformation { /// /// Index of banana in current shower. From 3cbdaf5960a992e21b4fff30ad8660987edf005a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 8 Dec 2020 10:30:23 +0900 Subject: [PATCH 08/12] Make resolved properties protected --- .../Skinning/Default/CatchHitObjectPiece.cs | 12 ++++++------ .../Skinning/Default/FruitPiece.cs | 7 +++---- .../Skinning/LegacyCatchHitObjectPiece.cs | 16 +++++++--------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs index 3c3cb5b0ee..be6cf0fc05 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs @@ -18,10 +18,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default public readonly Bindable HyperDash = new Bindable(); [Resolved(canBeNull: true)] - private DrawableHitObject drawableHitObject { get; set; } - [CanBeNull] - protected DrawablePalpableCatchHitObject DrawableHitObject => (DrawablePalpableCatchHitObject)drawableHitObject; + protected DrawableHitObject DrawableHitObject { get; private set; } [CanBeNull] protected BorderPiece BorderPiece; @@ -33,10 +31,12 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default { base.LoadComplete(); - if (DrawableHitObject != null) + var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject; + + if (hitObject != null) { - AccentColour.BindTo(DrawableHitObject.AccentColour); - HyperDash.BindTo(DrawableHitObject.HyperDash); + AccentColour.BindTo(hitObject.AccentColour); + HyperDash.BindTo(hitObject.HyperDash); } HyperDash.BindValueChanged(hyper => diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs index 05b924eb75..45d688c4e5 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs @@ -36,11 +36,10 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default { base.LoadComplete(); - if (DrawableHitObject != null) - { - var fruit = (DrawableFruit)DrawableHitObject; + var fruit = (DrawableFruit)DrawableHitObject; + + if (fruit != null) VisualRepresentation.BindTo(fruit.VisualRepresentation); - } } } } diff --git a/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs index 4bcb92b9be..1e68439402 100644 --- a/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/LegacyCatchHitObjectPiece.cs @@ -27,15 +27,11 @@ namespace osu.Game.Rulesets.Catch.Skinning private readonly Sprite hyperSprite; [Resolved] - private ISkinSource skin { get; set; } - - protected ISkinSource Skin => skin; + protected ISkinSource Skin { get; private set; } [Resolved(canBeNull: true)] - private DrawableHitObject drawableHitObject { get; set; } - [CanBeNull] - protected DrawablePalpableCatchHitObject DrawableHitObject => (DrawablePalpableCatchHitObject)drawableHitObject; + protected DrawableHitObject DrawableHitObject { get; private set; } protected LegacyCatchHitObjectPiece() { @@ -69,10 +65,12 @@ namespace osu.Game.Rulesets.Catch.Skinning { base.LoadComplete(); - if (DrawableHitObject != null) + var hitObject = (DrawablePalpableCatchHitObject)DrawableHitObject; + + if (hitObject != null) { - AccentColour.BindTo(DrawableHitObject.AccentColour); - HyperDash.BindTo(DrawableHitObject.HyperDash); + AccentColour.BindTo(hitObject.AccentColour); + HyperDash.BindTo(hitObject.HyperDash); } hyperSprite.Colour = Skin.GetConfig(CatchSkinColour.HyperDashFruit)?.Value ?? From 4da6717d0e3ececba5dc73a36326a1bb92e4ea26 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 8 Dec 2020 10:32:46 +0900 Subject: [PATCH 09/12] Rename things in PulpFormation --- .../Skinning/Default/BananaPulpFormation.cs | 4 +-- .../Skinning/Default/FruitPulpFormation.cs | 36 +++++++++---------- .../Skinning/Default/PulpFormation.cs | 15 ++++---- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs index cabea46083..ee1cc68f7d 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPulpFormation.cs @@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default { public BananaPulpFormation() { - Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); - Add(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f)); + AddPulp(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); + AddPulp(new Vector2(0, 0.05f), new Vector2(LARGE_PULP_4 * 0.8f, LARGE_PULP_4 * 2.5f)); } } } diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs index 8696854f23..88e0b5133a 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPulpFormation.cs @@ -25,33 +25,33 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default switch (visualRepresentation.NewValue) { case FruitVisualRepresentation.Pear: - Add(new Vector2(0, -0.33f), new Vector2(SMALL_PULP)); - Add(PositionAt(60, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); - Add(PositionAt(180, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); - Add(PositionAt(300, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(new Vector2(0, -0.33f), new Vector2(SMALL_PULP)); + AddPulp(PositionAt(60, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(PositionAt(180, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(PositionAt(300, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); break; case FruitVisualRepresentation.Grape: - Add(new Vector2(0, -0.25f), new Vector2(SMALL_PULP)); - Add(PositionAt(0, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); - Add(PositionAt(120, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); - Add(PositionAt(240, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(new Vector2(0, -0.25f), new Vector2(SMALL_PULP)); + AddPulp(PositionAt(0, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(PositionAt(120, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); + AddPulp(PositionAt(240, DISTANCE_FROM_CENTRE_3), new Vector2(LARGE_PULP_3)); break; case FruitVisualRepresentation.Pineapple: - Add(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); - Add(PositionAt(45, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(135, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(225, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(315, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(new Vector2(0, -0.3f), new Vector2(SMALL_PULP)); + AddPulp(PositionAt(45, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(135, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(225, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(315, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); break; case FruitVisualRepresentation.Raspberry: - Add(new Vector2(0, -0.34f), new Vector2(SMALL_PULP)); - Add(PositionAt(0, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(90, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(180, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); - Add(PositionAt(270, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(new Vector2(0, -0.34f), new Vector2(SMALL_PULP)); + AddPulp(PositionAt(0, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(90, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(180, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); + AddPulp(PositionAt(270, DISTANCE_FROM_CENTRE_4), new Vector2(LARGE_PULP_4)); break; } } diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs b/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs index c0e3d0e724..8753aa4077 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/PulpFormation.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default protected const float SMALL_PULP = LARGE_PULP_3 / 2; - private int numPulps; + private int pulpsInUse; protected PulpFormation() { @@ -35,21 +35,22 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default protected void Clear() { - for (; numPulps > 0; numPulps--) - InternalChildren[numPulps - 1].Alpha = 0; + for (int i = 0; i < pulpsInUse; i++) + InternalChildren[i].Alpha = 0; + pulpsInUse = 0; } - protected void Add(Vector2 position, Vector2 size) + protected void AddPulp(Vector2 position, Vector2 size) { - if (numPulps == InternalChildren.Count) + if (pulpsInUse == InternalChildren.Count) AddInternal(new Pulp { AccentColour = { BindTarget = AccentColour } }); - var pulp = InternalChildren[numPulps]; + var pulp = InternalChildren[pulpsInUse]; pulp.Position = position; pulp.Size = size; pulp.Alpha = 1; - numPulps++; + pulpsInUse++; } } } From 17d48c82f6f4d8ed22981b2ed4e749012709db55 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 8 Dec 2020 16:59:06 +0900 Subject: [PATCH 10/12] Use switch statement instead of an array --- .../Skinning/Legacy/LegacyFruitPiece.cs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs index e45f00c6aa..6f93e68594 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; -using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Catch.Objects.Drawables; namespace osu.Game.Rulesets.Catch.Skinning.Legacy @@ -11,11 +10,6 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy { public readonly Bindable VisualRepresentation = new Bindable(); - private readonly string[] lookupNames = - { - "fruit-pear", "fruit-grapes", "fruit-apple", "fruit-orange" - }; - protected override void LoadComplete() { base.LoadComplete(); @@ -30,10 +24,24 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy private void setTexture(FruitVisualRepresentation visualRepresentation) { - Texture texture = Skin.GetTexture(lookupNames[(int)visualRepresentation]); - Texture overlayTexture = Skin.GetTexture(lookupNames[(int)visualRepresentation] + "-overlay"); + switch (visualRepresentation) + { + case FruitVisualRepresentation.Pear: + SetTexture(Skin.GetTexture("fruit-pear"), Skin.GetTexture("fruit-pear-overlay")); + break; - SetTexture(texture, overlayTexture); + case FruitVisualRepresentation.Grape: + SetTexture(Skin.GetTexture("fruit-grapes"), Skin.GetTexture("fruit-grapes-overlay")); + break; + + case FruitVisualRepresentation.Pineapple: + SetTexture(Skin.GetTexture("fruit-apple"), Skin.GetTexture("fruit-apple-overlay")); + break; + + case FruitVisualRepresentation.Raspberry: + SetTexture(Skin.GetTexture("fruit-orange"), Skin.GetTexture("fruit-orange-overlay")); + break; + } } } } From 603cecb2ebbf2241f605ed86daf18d1139013140 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 8 Dec 2020 17:02:57 +0900 Subject: [PATCH 11/12] Make CatchHitObjectPiece abstract class --- osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs index be6cf0fc05..0d4a4e8e78 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs @@ -12,7 +12,7 @@ using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Skinning.Default { - public class CatchHitObjectPiece : CompositeDrawable + public abstract class CatchHitObjectPiece : CompositeDrawable { public readonly Bindable AccentColour = new Bindable(); public readonly Bindable HyperDash = new Bindable(); From 4d5c242d35e0603282bee8d157a92fb4239c9e22 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 8 Dec 2020 17:15:40 +0900 Subject: [PATCH 12/12] Use virtual property instead of a field for optional pieces --- .../Skinning/Default/BananaPiece.cs | 2 ++ .../Skinning/Default/CatchHitObjectPiece.cs | 10 ++++++++-- .../Skinning/Default/DropletPiece.cs | 2 ++ osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs index f81c1063b9..8da18a668a 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs @@ -7,6 +7,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default { public class BananaPiece : CatchHitObjectPiece { + protected override BorderPiece BorderPiece { get; } + public BananaPiece() { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs index 0d4a4e8e78..d59b6cc0de 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/CatchHitObjectPiece.cs @@ -21,11 +21,17 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default [CanBeNull] protected DrawableHitObject DrawableHitObject { get; private set; } + /// + /// A part of this piece that will be faded out while falling in the playfield. + /// [CanBeNull] - protected BorderPiece BorderPiece; + protected virtual BorderPiece BorderPiece => null; + /// + /// A part of this piece that will be only visible when is true. + /// [CanBeNull] - protected HyperBorderPiece HyperBorderPiece; + protected virtual HyperBorderPiece HyperBorderPiece => null; protected override void LoadComplete() { diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs index c149f7769f..8b1052dfe2 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/DropletPiece.cs @@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default { public class DropletPiece : CatchHitObjectPiece { + protected override HyperBorderPiece HyperBorderPiece { get; } + public DropletPiece() { Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2); diff --git a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs index 45d688c4e5..2e3803a31a 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs @@ -16,6 +16,9 @@ namespace osu.Game.Rulesets.Catch.Skinning.Default public readonly Bindable VisualRepresentation = new Bindable(); + protected override BorderPiece BorderPiece { get; } + protected override HyperBorderPiece HyperBorderPiece { get; } + public FruitPiece() { RelativeSizeAxes = Axes.Both;