Initialise container earlier to avoid null reference failures

This commit is contained in:
Dean Herbert 2024-10-23 18:46:20 +09:00
parent 1e03bd11a3
commit 064aaeb60e
No known key found for this signature in database

View File

@ -65,8 +65,6 @@ namespace osu.Game.Rulesets.UI
/// </summary>
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 @@ namespace osu.Game.Rulesets.UI
public override IFrameStableClock FrameStableClock => frameStabilityContainer;
private readonly PlayfieldAdjustmentContainer playfieldAdjustmentContainer;
private bool allowBackwardsSeeks;
public override bool AllowBackwardsSeeks
@ -144,6 +144,7 @@ namespace osu.Game.Rulesets.UI
RelativeSizeAxes = Axes.Both;
KeyBindingInputManager = CreateInputManager();
playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer();
playfield = new Lazy<Playfield>(() => CreatePlayfield().With(p =>
{
p.NewResult += (_, r) => NewResult?.Invoke(r);
@ -195,8 +196,7 @@ namespace osu.Game.Rulesets.UI
audioContainer.WithChild(KeyBindingInputManager
.WithChildren(new Drawable[]
{
playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
playfieldAdjustmentContainer.WithChild(Playfield),
Overlays
})),
}