Merge pull request #30375 from bdach/fix-broken-playfield-skin-layer-rotation

Fix playfield skinning layer no longer correctly rotating with the playfield
This commit is contained in:
Dean Herbert 2024-10-23 19:50:39 +09:00 committed by GitHub
commit 77d2f35765
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 9 deletions

View File

@ -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; }

View File

@ -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; }

View File

@ -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
@ -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);
@ -197,8 +196,7 @@ private void load(CancellationToken? cancellationToken)
audioContainer.WithChild(KeyBindingInputManager
.WithChildren(new Drawable[]
{
PlayfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
playfieldAdjustmentContainer.WithChild(Playfield),
Overlays
})),
}
@ -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>

View File

@ -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;