From fc63ee43be2a75d39f16606e85f53e1135022027 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 23 Sep 2023 23:42:13 +0300 Subject: [PATCH] Fix legacy catcher sprites getting shrunk --- .../Skinning/Legacy/LegacyCatcher.cs | 8 +++++++- .../Skinning/Legacy/LegacyCatcherNew.cs | 19 ++----------------- .../Skinning/Legacy/LegacyCatcherOld.cs | 15 +++------------ 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcher.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcher.cs index cba2c671b0..6cd8b14191 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcher.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcher.cs @@ -13,7 +13,13 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy { Anchor = 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() diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs index f6b2c52498..54d555b22a 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherNew.cs @@ -7,14 +7,12 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; -using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.UI; using osu.Game.Skinning; -using osuTK; namespace osu.Game.Rulesets.Catch.Skinning.Legacy { - public partial class LegacyCatcherNew : CompositeDrawable + public partial class LegacyCatcherNew : LegacyCatcher { [Resolved] private Bindable currentState { get; set; } = null!; @@ -23,25 +21,12 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy private Drawable currentDrawable = null!; - public LegacyCatcherNew() - { - RelativeSizeAxes = Axes.Both; - } - [BackgroundDependencyLoader] private void load(ISkinSource skin) { foreach (var state in Enum.GetValues()) { - AddInternal(drawables[state] = getDrawableFor(state).With(d => - { - d.Anchor = Anchor.TopCentre; - d.Origin = Anchor.TopCentre; - d.RelativeSizeAxes = Axes.Both; - d.Size = Vector2.One; - d.FillMode = FillMode.Fit; - d.Alpha = 0; - })); + AddInternal(drawables[state] = getDrawableFor(state).With(d => d.Alpha = 0)); } currentDrawable = drawables[CatcherAnimationState.Idle]; diff --git a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs index 1e21d8eab1..012200eedf 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyCatcherOld.cs @@ -3,30 +3,21 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Skinning; -using osuTK; namespace osu.Game.Rulesets.Catch.Skinning.Legacy { - public partial class LegacyCatcherOld : CompositeDrawable + public partial class LegacyCatcherOld : LegacyCatcher { public LegacyCatcherOld() { - RelativeSizeAxes = Axes.Both; + AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] private void load(ISkinSource skin) { - InternalChild = (skin.GetAnimation(@"fruit-ryuuta", true, true, true) ?? Empty()).With(d => - { - d.Anchor = Anchor.TopCentre; - d.Origin = Anchor.TopCentre; - d.RelativeSizeAxes = Axes.Both; - d.Size = Vector2.One; - d.FillMode = FillMode.Fit; - }); + InternalChild = skin.GetAnimation(@"fruit-ryuuta", true, true, true) ?? Empty(); } } }