Fix metrics not matching between skins and lazer

This commit is contained in:
Dean Herbert
2020-02-17 19:16:40 +09:00
parent 2133ba38e5
commit 89bff32274
5 changed files with 25 additions and 9 deletions

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{ {
public abstract class CatchHitObject : HitObject, IHasXPosition, IHasComboInformation public abstract class CatchHitObject : HitObject, IHasXPosition, IHasComboInformation
{ {
public const double OBJECT_RADIUS = 44; public const float OBJECT_RADIUS = 64;
private float x; private float x;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
: base(h) : base(h)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 4; Size = new Vector2(CatchHitObject.OBJECT_RADIUS) / 4;
Masking = false; Masking = false;
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
public class DrawableFruit : PalpableCatchHitObject<Fruit> public class DrawableFruit : PalpableCatchHitObject<Fruit>
{ {
public const float DRAWABLE_RADIUS = (float)CatchHitObject.OBJECT_RADIUS * RADIUS_ADJUST; private Container scaleContainer;
/// <summary> /// <summary>
/// Because we're adding a border around the fruit, we need to scale down some. /// Because we're adding a border around the fruit, we need to scale down some.
@ -25,7 +26,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2(DRAWABLE_RADIUS); Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2);
Masking = false; Masking = false;
Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
@ -34,10 +36,24 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddInternal(new SkinnableDrawable( AddRangeInternal(new Framework.Graphics.Drawable[]
new CatchSkinComponent(getComponent(HitObject.VisualRepresentation)), _ => new FruitPiece())); {
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())
}
}
});
AccentColour.Value = colourForRepresentation(HitObject.VisualRepresentation); AccentColour.Value = colourForRepresentation(HitObject.VisualRepresentation);
scaleContainer.Scale = new Vector2(HitObject.Scale);
} }
private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation) private CatchSkinComponents getComponent(FruitVisualRepresentation hitObjectVisualRepresentation)

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
public DrawableTinyDroplet(TinyDroplet h) public DrawableTinyDroplet(TinyDroplet h)
: base(h) : base(h)
{ {
Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 8; Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 8);
} }
} }
} }

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
BorderColour = Color4.White, BorderColour = Color4.White,
BorderThickness = 3f * DrawableFruit.RADIUS_ADJUST, BorderThickness = 6f * DrawableFruit.RADIUS_ADJUST,
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
new Box new Box
@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
private Framework.Graphics.Drawable createPulp(FruitVisualRepresentation representation) private Framework.Graphics.Drawable createPulp(FruitVisualRepresentation representation)
{ {
const float large_pulp_3 = 8f * DrawableFruit.RADIUS_ADJUST; const float large_pulp_3 = 16f * DrawableFruit.RADIUS_ADJUST;
const float distance_from_centre_3 = 0.15f; const float distance_from_centre_3 = 0.15f;
const float large_pulp_4 = large_pulp_3 * 0.925f; const float large_pulp_4 = large_pulp_3 * 0.925f;