1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 21:22:56 +08:00

Fix legacy catcher sprites getting shrunk

This commit is contained in:
Salman Ahmed 2023-09-23 23:42:13 +03:00
parent 0fb7895a52
commit fc63ee43be
3 changed files with 12 additions and 30 deletions

View File

@ -13,7 +13,13 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
Anchor = Anchor.TopCentre; Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre; Origin = Anchor.TopCentre;
RelativeSizeAxes = Axes.Both;
// in stable, catcher sprites are displayed in their raw size. stable also has catcher sprites displayed with the following scale factors applied:
// 1. 0.5x, affecting all sprites in the playfield, computed here based on lazer's catch playfield dimensions (see WIDTH/HEIGHT constants in CatchPlayfield),
// source: https://github.com/peppy/osu-stable-reference/blob/1531237b63392e82c003c712faa028406073aa8f/osu!/GameplayElements/HitObjectManager.cs#L483-L494
// 2. 0.7x, a constant scale applied to all catcher sprites on construction.
AutoSizeAxes = Axes.Both;
Scale = new Vector2(0.5f * 0.7f);
} }
protected override void Update() protected override void Update()

View File

@ -7,14 +7,12 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
public partial class LegacyCatcherNew : CompositeDrawable public partial class LegacyCatcherNew : LegacyCatcher
{ {
[Resolved] [Resolved]
private Bindable<CatcherAnimationState> currentState { get; set; } = null!; private Bindable<CatcherAnimationState> currentState { get; set; } = null!;
@ -23,25 +21,12 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
private Drawable currentDrawable = null!; private Drawable currentDrawable = null!;
public LegacyCatcherNew()
{
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin) private void load(ISkinSource skin)
{ {
foreach (var state in Enum.GetValues<CatcherAnimationState>()) foreach (var state in Enum.GetValues<CatcherAnimationState>())
{ {
AddInternal(drawables[state] = getDrawableFor(state).With(d => AddInternal(drawables[state] = getDrawableFor(state).With(d => d.Alpha = 0));
{
d.Anchor = Anchor.TopCentre;
d.Origin = Anchor.TopCentre;
d.RelativeSizeAxes = Axes.Both;
d.Size = Vector2.One;
d.FillMode = FillMode.Fit;
d.Alpha = 0;
}));
} }
currentDrawable = drawables[CatcherAnimationState.Idle]; currentDrawable = drawables[CatcherAnimationState.Idle];

View File

@ -3,30 +3,21 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
public partial class LegacyCatcherOld : CompositeDrawable public partial class LegacyCatcherOld : LegacyCatcher
{ {
public LegacyCatcherOld() public LegacyCatcherOld()
{ {
RelativeSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ISkinSource skin) private void load(ISkinSource skin)
{ {
InternalChild = (skin.GetAnimation(@"fruit-ryuuta", true, true, true) ?? Empty()).With(d => InternalChild = skin.GetAnimation(@"fruit-ryuuta", true, true, true) ?? Empty();
{
d.Anchor = Anchor.TopCentre;
d.Origin = Anchor.TopCentre;
d.RelativeSizeAxes = Axes.Both;
d.Size = Vector2.One;
d.FillMode = FillMode.Fit;
});
} }
} }
} }