From e89a4561ab85aa2c1753f24d0526f7ae19e773bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 21 Oct 2024 13:40:35 +0200 Subject: [PATCH 1/3] Fix playfield skinning layer no longer correctly rotating with the playfield Closes https://github.com/ppy/osu/issues/30353. Regressed in https://github.com/ppy/osu/commit/4a39873e2aac3a6fa71a3be06407d9afb7df8922. --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 18 +++++++++++------- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index a28b2716cb7b..3ad173893b0a 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -65,18 +65,16 @@ public abstract partial class DrawableRuleset : DrawableRuleset, IProvi /// public override Playfield Playfield => playfield.Value; + private PlayfieldAdjustmentContainer playfieldAdjustmentContainer; + + 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 }; - /// - /// A container which encapsulates the and provides any adjustments to - /// ensure correct scale and position. - /// - public virtual PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; private set; } - public override Container FrameStableComponents { get; } = new Container { RelativeSizeAxes = Axes.Both }; public override IFrameStableClock FrameStableClock => frameStabilityContainer; @@ -197,7 +195,7 @@ private void load(CancellationToken? cancellationToken) audioContainer.WithChild(KeyBindingInputManager .WithChildren(new Drawable[] { - PlayfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer() + playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer() .WithChild(Playfield), Overlays })), @@ -456,6 +454,12 @@ public abstract partial class DrawableRuleset : CompositeDrawable /// public abstract Playfield Playfield { get; } + /// + /// A container which encapsulates the and provides any adjustments to + /// ensure correct scale and position. + /// + public abstract PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer { get; } + /// /// Content to be placed above hitobjects. Will be affected by frame stability and adjustments applied to . /// diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index ac1b9ce34fa8..292f55448335 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -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; From 1e03bd11a350e4d4af98eb5c12b1c3a1ad412e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 21 Oct 2024 13:57:34 +0200 Subject: [PATCH 2/3] Fix test compile failures --- osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs | 1 + osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index d4b69c1be211..07d6d68e8235 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -96,6 +96,7 @@ public override event Action 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; } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index e57177498d43..2e646f28500d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -284,6 +284,7 @@ public override event Action 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; } From 064aaeb60e07e51d80582c2ecde491008166d1fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 23 Oct 2024 18:46:20 +0900 Subject: [PATCH 3/3] Initialise container earlier to avoid null reference failures --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 3ad173893b0a..ebd84fd91bea 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -65,8 +65,6 @@ public abstract partial class DrawableRuleset : DrawableRuleset, IProvi /// public override Playfield Playfield => playfield.Value; - private PlayfieldAdjustmentContainer playfieldAdjustmentContainer; - public override PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer => playfieldAdjustmentContainer; public override Container Overlays { get; } = new Container { RelativeSizeAxes = Axes.Both }; @@ -79,6 +77,8 @@ public abstract partial class DrawableRuleset : DrawableRuleset, IProvi public override IFrameStableClock FrameStableClock => frameStabilityContainer; + private readonly PlayfieldAdjustmentContainer playfieldAdjustmentContainer; + private bool allowBackwardsSeeks; public override bool AllowBackwardsSeeks @@ -144,6 +144,7 @@ protected DrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList RelativeSizeAxes = Axes.Both; KeyBindingInputManager = CreateInputManager(); + playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer(); playfield = new Lazy(() => CreatePlayfield().With(p => { p.NewResult += (_, r) => NewResult?.Invoke(r); @@ -195,8 +196,7 @@ private void load(CancellationToken? cancellationToken) audioContainer.WithChild(KeyBindingInputManager .WithChildren(new Drawable[] { - playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer() - .WithChild(Playfield), + playfieldAdjustmentContainer.WithChild(Playfield), Overlays })), }