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

Make mania judgements relative to the hit target position

This improves display in portrait screen, where the stage is scaled up.
This commit is contained in:
Salman Alshamrani 2024-12-29 23:33:32 -05:00
parent 0cd7f1b2d4
commit 1e08b3dbda
7 changed files with 21 additions and 27 deletions

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mania.Mods
foreach (Column column in maniaPlayfield.Stages.SelectMany(stage => stage.Columns))
{
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
HitObjectContainer hoc = column.HitObjectContainer;
Container hocParent = (Container)hoc.Parent!;
hocParent.Remove(hoc, false);

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
{
public partial class ArgonJudgementPiece : TextJudgementPiece, IAnimatableJudgement
{
private const float judgement_y_position = 160;
private const float judgement_y_position = -180f;
private RingExplosion? ringExplosion;

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
@ -23,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
this.result = result;
this.animation = animation;
Anchor = Anchor.Centre;
Anchor = Anchor.BottomCentre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
@ -32,12 +31,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
float? scorePosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value;
float hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? 0;
float scorePosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value ?? 0;
if (scorePosition != null)
scorePosition -= Stage.HIT_TARGET_POSITION + 150;
Y = scorePosition ?? 0;
float absoluteHitPosition = 480f * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR - hitPosition;
Y = scorePosition - absoluteHitPosition;
InternalChild = animation.With(d =>
{

View File

@ -9,7 +9,7 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI.Components
{
public partial class ColumnHitObjectArea : HitObjectArea
public partial class ColumnHitObjectArea : HitPositionPaddedContainer
{
public readonly Container Explosions;

View File

@ -1,29 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Skinning;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI.Components
{
public partial class HitObjectArea : SkinReloadableDrawable
public partial class HitPositionPaddedContainer : SkinReloadableDrawable
{
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
public readonly HitObjectContainer HitObjectContainer;
public HitObjectArea(HitObjectContainer hitObjectContainer)
public HitPositionPaddedContainer(Drawable child)
{
InternalChild = new Container
{
RelativeSizeAxes = Axes.Both,
Child = HitObjectContainer = hitObjectContainer
};
InternalChild = child;
}
[BackgroundDependencyLoader]

View File

@ -15,9 +15,12 @@ namespace osu.Game.Rulesets.Mania.UI
private partial class DefaultManiaJudgementPiece : DefaultJudgementPiece
{
private const float judgement_y_position = -180f;
public DefaultManiaJudgementPiece(HitResult result)
: base(result)
{
Y = judgement_y_position;
}
protected override void LoadComplete()

View File

@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Mania.UI
Width = 1366, // Bar lines should only be masked on the vertical axis
BypassAutoSizeAxes = Axes.Both,
Masking = true,
Child = barLineContainer = new HitObjectArea(HitObjectContainer)
Child = barLineContainer = new HitPositionPaddedContainer(HitObjectContainer)
{
Name = "Bar lines",
Anchor = Anchor.TopCentre,
@ -119,12 +119,12 @@ namespace osu.Game.Rulesets.Mania.UI
{
RelativeSizeAxes = Axes.Both
},
judgements = new JudgementContainer<DrawableManiaJudgement>
new HitPositionPaddedContainer(judgements = new JudgementContainer<DrawableManiaJudgement>
{
RelativeSizeAxes = Axes.Both,
})
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Y = HIT_TARGET_POSITION + 150
},
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
}
@ -218,7 +218,7 @@ namespace osu.Game.Rulesets.Mania.UI
{
j.Apply(result, judgedObject);
j.Anchor = Anchor.Centre;
j.Anchor = Anchor.BottomCentre;
j.Origin = Anchor.Centre;
})!);
}