diff --git a/osu.Game.Rulesets.Mania/Skinning/Argon/ArgonJudgementPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Argon/ArgonJudgementPiece.cs index 6098459f6b..bef8625ea2 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Argon/ArgonJudgementPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Argon/ArgonJudgementPiece.cs @@ -53,7 +53,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon } } - private void onDirectionChanged() => Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position; + private void onDirectionChanged() + { + Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position; + } protected override SpriteText CreateJudgementText() => new OsuSpriteText diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs index 3752c5f27a..5ece5df66f 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs @@ -24,7 +24,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy this.result = result; this.animation = animation; - Anchor = Anchor.BottomCentre; Origin = Anchor.Centre; AutoSizeAxes = Axes.Both; @@ -53,10 +52,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy float hitPosition = skin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? 0; float scorePosition = skin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value ?? 0; - float absoluteHitPosition = 480f * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR - hitPosition; - float finalPosition = scorePosition - absoluteHitPosition; + float hitPositionFromTop = 480f * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR - hitPosition; - Y = direction.Value == ScrollingDirection.Up ? -finalPosition : finalPosition; + if (scorePosition > hitPositionFromTop / 2f) + { + Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + Y = direction.Value == ScrollingDirection.Up ? hitPositionFromTop - scorePosition : scorePosition - hitPositionFromTop; + } + else + { + Anchor = direction.Value == ScrollingDirection.Up ? Anchor.BottomCentre : Anchor.TopCentre; + Y = direction.Value == ScrollingDirection.Up ? -scorePosition : scorePosition; + } } public void PlayAnimation() diff --git a/osu.Game.Rulesets.Mania/UI/DefaultManiaJudgementPiece.cs b/osu.Game.Rulesets.Mania/UI/DefaultManiaJudgementPiece.cs index f0af6085d0..4872fe5049 100644 --- a/osu.Game.Rulesets.Mania/UI/DefaultManiaJudgementPiece.cs +++ b/osu.Game.Rulesets.Mania/UI/DefaultManiaJudgementPiece.cs @@ -29,7 +29,11 @@ namespace osu.Game.Rulesets.Mania.UI direction.BindValueChanged(_ => onDirectionChanged(), true); } - private void onDirectionChanged() => Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position; + private void onDirectionChanged() + { + Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + Y = direction.Value == ScrollingDirection.Up ? -judgement_y_position : judgement_y_position; + } protected override void LoadComplete() { diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 40fef1a56a..20248ab6bc 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -3,30 +3,23 @@ #nullable disable -using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI.Scrolling; +using osuTK; namespace osu.Game.Rulesets.Mania.UI { public partial class DrawableManiaJudgement : DrawableJudgement { - private IBindable direction; - - [BackgroundDependencyLoader] - private void load(IScrollingInfo scrollingInfo) + public DrawableManiaJudgement() { - direction = scrollingInfo.Direction.GetBoundCopy(); - direction.BindValueChanged(_ => onDirectionChanged(), true); - } - - private void onDirectionChanged() - { - Anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; - Origin = Anchor.Centre; + // Extend the dimensions of this drawable to the entire parenting container. + // This allows skin implementations (i.e. LegacyManiaJudgementPiece) to freely choose the anchor based on skin settings. + Anchor = Anchor.TopLeft; + Origin = Anchor.TopLeft; + RelativeSizeAxes = Axes.Both; + Size = new Vector2(1f); } protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);