Skip to content

Commit

Permalink
Merge pull request ppy#30375 from bdach/fix-broken-playfield-skin-lay…
Browse files Browse the repository at this point in the history
…er-rotation

Fix playfield skinning layer no longer correctly rotating with the playfield
  • Loading branch information
peppy authored Oct 23, 2024
2 parents c1453cf + 064aaeb commit 77d2f35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public override event Action<JudgementResult> RevertResult

public override IAdjustableAudioComponent Audio { get; }
public override Playfield Playfield { get; }
public override PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; }
public override Container Overlays { get; }
public override Container FrameStableComponents { get; }
public override IFrameStableClock FrameStableClock { get; }
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ public override event Action<JudgementResult> RevertResult

public override IAdjustableAudioComponent Audio { get; }
public override Playfield Playfield { get; }
public override PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; }
public override Container Overlays { get; }
public override Container FrameStableComponents { get; }
public override IFrameStableClock FrameStableClock { get; }
Expand Down
20 changes: 12 additions & 8 deletions osu.Game/Rulesets/UI/DrawableRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,20 @@ public abstract partial class DrawableRuleset<TObject> : DrawableRuleset, IProvi
/// </summary>
public override Playfield Playfield => playfield.Value;

public override PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer => playfieldAdjustmentContainer;

public override Container Overlays { get; } = new Container { RelativeSizeAxes = Axes.Both };

public override IAdjustableAudioComponent Audio => audioContainer;

private readonly AudioContainer audioContainer = new AudioContainer { RelativeSizeAxes = Axes.Both };

/// <summary>
/// A container which encapsulates the <see cref="Playfield"/> and provides any adjustments to
/// ensure correct scale and position.
/// </summary>
public virtual PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; private set; }

public override Container FrameStableComponents { get; } = new Container { RelativeSizeAxes = Axes.Both };

public override IFrameStableClock FrameStableClock => frameStabilityContainer;

private readonly PlayfieldAdjustmentContainer playfieldAdjustmentContainer;

private bool allowBackwardsSeeks;

public override bool AllowBackwardsSeeks
Expand Down Expand Up @@ -146,6 +144,7 @@ protected DrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>
RelativeSizeAxes = Axes.Both;

KeyBindingInputManager = CreateInputManager();
playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer();
playfield = new Lazy<Playfield>(() => CreatePlayfield().With(p =>
{
p.NewResult += (_, r) => NewResult?.Invoke(r);
Expand Down Expand Up @@ -197,8 +196,7 @@ private void load(CancellationToken? cancellationToken)
audioContainer.WithChild(KeyBindingInputManager
.WithChildren(new Drawable[]
{
PlayfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
playfieldAdjustmentContainer.WithChild(Playfield),
Overlays
})),
}
Expand Down Expand Up @@ -456,6 +454,12 @@ public abstract partial class DrawableRuleset : CompositeDrawable
/// </summary>
public abstract Playfield Playfield { get; }

/// <summary>
/// A container which encapsulates the <see cref="Playfield"/> and provides any adjustments to
/// ensure correct scale and position.
/// </summary>
public abstract PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; }

/// <summary>
/// Content to be placed above hitobjects. Will be affected by frame stability and adjustments applied to <see cref="Audio"/>.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Play/HUDOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ protected override void Update()
PlayfieldSkinLayer.Position = ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft);
PlayfieldSkinLayer.Width = (ToLocalSpace(playfieldScreenSpaceDrawQuad.TopRight) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
PlayfieldSkinLayer.Height = (ToLocalSpace(playfieldScreenSpaceDrawQuad.BottomLeft) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
PlayfieldSkinLayer.Rotation = drawableRuleset.Playfield.Rotation;
PlayfieldSkinLayer.Rotation = drawableRuleset.PlayfieldAdjustmentContainer.Rotation;
}

float? lowestTopScreenSpaceLeft = null;
Expand Down

0 comments on commit 77d2f35

Please sign in to comment.