diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index bfef1ba605..188de6a6ae 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -2,11 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osuTK; +using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -15,6 +19,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { public override bool CanBePlated => true; + protected Container ScaleContainer; + protected PalpableCatchHitObject(TObject hitObject) : base(hitObject) { @@ -22,6 +28,28 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2); Masking = false; } + + [BackgroundDependencyLoader] + private void load() + { + AddRangeInternal(new Framework.Graphics.Drawable[] + { + ScaleContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + } + }); + + ScaleContainer.Scale = new Vector2(HitObject.Scale); + } + + protected override void UpdateComboColour(Color4 proposedColour, IReadOnlyList comboColours) + { + // ignore the incoming combo colour as we use a custom lookup + AccentColour.Value = comboColours[(HitObject.IndexInBeatmap + 1) % comboColours.Count]; + } } public abstract class DrawableCatchHitObject : DrawableCatchHitObject @@ -43,6 +71,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable public virtual bool StaysOnPlate => CanBePlated; + public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale; + protected DrawableCatchHitObject(CatchHitObject hitObject) : base(hitObject) { diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index d0160f8cce..4e8faed091 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -1,13 +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 System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Skinning; -using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable @@ -16,8 +12,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { public override bool StaysOnPlate => false; - protected Container ScaleContainer; - public DrawableDroplet(Droplet h) : base(h) { @@ -26,32 +20,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable [BackgroundDependencyLoader] private void load() { - AddRangeInternal(new Framework.Graphics.Drawable[] - { - ScaleContainer = new Container + ScaleContainer.Child = new SkinnableDrawable( + new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new Pulp { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Children = new Framework.Graphics.Drawable[] - { - new SkinnableDrawable( - new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new Pulp - { - Size = Size / 4, - AccentColour = { Value = Color4.White } - }) - } - } - }); - - ScaleContainer.Scale = new Vector2(HitObject.Scale); - } - - protected override void UpdateComboColour(Color4 proposedColour, IReadOnlyList comboColours) - { - // ignore the incoming combo colour as we use a custom lookup - AccentColour.Value = comboColours[(HitObject.IndexInBeatmap + 1) % comboColours.Count]; + Size = Size / 4, + AccentColour = { Value = Color4.White } + }); } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 99f7e9386e..daa84f1057 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -2,21 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Utils; using osu.Game.Skinning; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableFruit : PalpableCatchHitObject { - private Container scaleContainer; - public DrawableFruit(Fruit h) : base(h) { @@ -26,28 +19,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable [BackgroundDependencyLoader] private void load() { - AddRangeInternal(new Framework.Graphics.Drawable[] - { - scaleContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Children = new Framework.Graphics.Drawable[] - { - new SkinnableDrawable( - new CatchSkinComponent(getComponent(HitObject.VisualRepresentation)), _ => new FruitPiece()) - } - } - }); - - scaleContainer.Scale = new Vector2(HitObject.Scale); - } - - protected override void UpdateComboColour(Color4 proposedColour, IReadOnlyList comboColours) - { - // ignore the incoming combo colour as we use a custom lookup - AccentColour.Value = comboColours[(HitObject.IndexInBeatmap + 1) % comboColours.Count]; + ScaleContainer.Child = new SkinnableDrawable( + new CatchSkinComponent(getComponent(HitObject.VisualRepresentation)), _ => new FruitPiece()); } private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 1ad12dc4ad..9ded0ff891 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -74,11 +74,11 @@ namespace osu.Game.Rulesets.Catch.UI caughtFruit.Anchor = Anchor.TopCentre; caughtFruit.Origin = Anchor.Centre; - caughtFruit.Scale *= 0.7f; + caughtFruit.Scale *= 0.5f; caughtFruit.LifetimeStart = caughtFruit.HitObject.StartTime; caughtFruit.LifetimeEnd = double.MaxValue; - MovableCatcher.Add(caughtFruit); + MovableCatcher.PlaceOnPlate(caughtFruit); lastPlateableFruit = caughtFruit; if (!fruit.StaysOnPlate) @@ -221,9 +221,9 @@ namespace osu.Game.Rulesets.Catch.UI /// Add a caught fruit to the catcher's stack. /// /// The fruit that was caught. - public void Add(DrawableHitObject fruit) + public void PlaceOnPlate(DrawableHitObject fruit) { - float ourRadius = fruit.DrawSize.X / 2 * fruit.Scale.X; + float ourRadius = ((DrawableCatchHitObject)fruit).DisplayRadius; float theirRadius = 0; const float allowance = 6;