1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 12:42:54 +08:00

Merge pull request #2632 from peppy/catch-sizing-fixes

Fix catch sizing
This commit is contained in:
Dan Balasescu 2018-05-31 12:58:16 +09:00 committed by GitHub
commit 1201fe90fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 48 deletions

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.Tests
Child = catcherArea = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size }) Child = catcherArea = new TestCatcherArea(new BeatmapDifficulty { CircleSize = size })
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomLeft Origin = Anchor.TopLeft
}, },
}; };
} }

View File

@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Catch.Tests
typeof(DrawableCatchHitObject), typeof(DrawableCatchHitObject),
typeof(DrawableFruit), typeof(DrawableFruit),
typeof(DrawableDroplet), typeof(DrawableDroplet),
typeof(BananaShower),
typeof(Pulp), typeof(Pulp),
}; };
@ -53,12 +54,19 @@ namespace osu.Game.Rulesets.Catch.Tests
private DrawableFruit createDrawable(int index) private DrawableFruit createDrawable(int index)
{ {
var fruit = new Fruit Fruit fruit = index == 5
{ ? new BananaShower.Banana
StartTime = 1000000000000, {
IndexInBeatmap = index, StartTime = 1000000000000,
Scale = 1.5f, IndexInBeatmap = index,
}; Scale = 1.5f,
}
: new Fruit
{
StartTime = 1000000000000,
IndexInBeatmap = index,
Scale = 1.5f,
};
return new DrawableFruit(fruit) return new DrawableFruit(fruit)
{ {

View File

@ -18,12 +18,19 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
private Circle border; private Circle border;
private const float drawable_radius = (float)CatchHitObject.OBJECT_RADIUS * radius_adjust;
/// <summary>
/// Because we're adding a border around the fruit, we need to scale down some.
/// </summary>
private const float radius_adjust = 1.1f;
public DrawableFruit(Fruit h) public DrawableFruit(Fruit h)
: base(h) : base(h)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS); Size = new Vector2(drawable_radius);
Masking = false; Masking = false;
Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; Rotation = (float)(RNG.NextDouble() - 0.5f) * 40;
@ -44,14 +51,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
Hollow = !HitObject.HyperDash, Hollow = !HitObject.HyperDash,
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Radius = 4, Radius = 4 * radius_adjust,
Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f) Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f)
}, },
Size = new Vector2(Height * 1.5f), Size = new Vector2(Height),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
BorderColour = Color4.White, BorderColour = Color4.White,
BorderThickness = 4f, BorderThickness = 3f * radius_adjust,
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
{ {
new Box new Box
@ -82,8 +89,8 @@ 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 = 13f; const float large_pulp_3 = 8f * radius_adjust;
const float distance_from_centre_3 = 0.23f; 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;
const float distance_from_centre_4 = distance_from_centre_3 / 0.925f; const float distance_from_centre_4 = distance_from_centre_3 / 0.925f;
@ -106,11 +113,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
new Pulp new Pulp
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre,
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(small_pulp), Size = new Vector2(small_pulp),
Y = 0.05f, Y = -0.34f,
}, },
new Pulp new Pulp
{ {
@ -146,11 +151,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
new Pulp new Pulp
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre,
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(small_pulp), Size = new Vector2(small_pulp),
Y = 0.1f, Y = -0.3f,
}, },
new Pulp new Pulp
{ {
@ -186,11 +189,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
new Pulp new Pulp
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(small_pulp), Size = new Vector2(small_pulp),
Y = -0.1f, Y = -0.33f,
}, },
new Pulp new Pulp
{ {
@ -220,10 +221,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
new Pulp new Pulp
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(small_pulp), Size = new Vector2(small_pulp),
Y = -0.25f,
}, },
new Pulp new Pulp
{ {
@ -253,16 +253,15 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
new Pulp new Pulp
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(small_pulp), Size = new Vector2(small_pulp),
Y = -0.15f Y = -0.3f
}, },
new Pulp new Pulp
{ {
AccentColour = AccentColour, AccentColour = AccentColour,
Size = new Vector2(large_pulp_4 * 1.2f, large_pulp_4 * 3), Size = new Vector2(large_pulp_4 * 0.8f, large_pulp_4 * 2.5f),
Y = 0.05f,
}, },
} }
}; };

View File

@ -29,14 +29,24 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
set set
{ {
accentColour = value; accentColour = value;
if (IsLoaded) updateAccentColour();
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Radius = 8,
Colour = accentColour.Darken(0.2f).Opacity(0.75f)
};
} }
} }
private void updateAccentColour()
{
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Radius = Size.X / 2,
Colour = accentColour.Darken(0.2f).Opacity(0.75f)
};
}
protected override void LoadComplete()
{
base.LoadComplete();
updateAccentColour();
}
} }
} }

View File

@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.Catch.UI
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
protected override Vector2 PlayfieldArea => new Vector2(0.86f); // matches stable's vertical offset for catcher plate
protected override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h) protected override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h)
{ {
switch (h) switch (h)

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatcherArea : Container public class CatcherArea : Container
{ {
public const float CATCHER_SIZE = 172; public const float CATCHER_SIZE = 84;
protected readonly Catcher MovableCatcher; protected readonly Catcher MovableCatcher;
@ -99,8 +99,6 @@ namespace osu.Game.Rulesets.Catch.UI
public class Catcher : Container, IKeyBindingHandler<CatchAction> public class Catcher : Container, IKeyBindingHandler<CatchAction>
{ {
private Texture texture;
private Container<DrawableHitObject> caughtFruit; private Container<DrawableHitObject> caughtFruit;
public Container ExplodingFruitTarget; public Container ExplodingFruitTarget;
@ -121,10 +119,8 @@ namespace osu.Game.Rulesets.Catch.UI
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load()
{ {
texture = textures.Get(@"Play/Catch/fruit-catcher-idle");
Children = new Drawable[] Children = new Drawable[]
{ {
caughtFruit = new Container<DrawableHitObject> caughtFruit = new Container<DrawableHitObject>
@ -196,13 +192,7 @@ namespace osu.Game.Rulesets.Catch.UI
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50); Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
} }
private Sprite createCatcherSprite() => new Sprite private Sprite createCatcherSprite() => new CatcherSprite();
{
Size = new Vector2(CATCHER_SIZE),
FillMode = FillMode.Fill,
Texture = texture,
OriginPosition = new Vector2(-3, 10) // temporary until the sprite is aligned correctly.
};
/// <summary> /// <summary>
/// Add a caught fruit to the catcher's stack. /// Add a caught fruit to the catcher's stack.
@ -411,6 +401,23 @@ namespace osu.Game.Rulesets.Catch.UI
f.Expire(); f.Expire();
} }
} }
private class CatcherSprite : Sprite
{
public CatcherSprite()
{
Size = new Vector2(CATCHER_SIZE);
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
Texture = textures.Get(@"Play/Catch/fruit-catcher-idle");
}
}
} }
} }
} }