Move `DrawableRuleset.Audio` to a less generic level

This commit is contained in:
Dean Herbert 2023-02-21 19:03:52 +09:00
parent c540d78fbc
commit 1acc536248
1 changed files with 20 additions and 24 deletions

View File

@ -66,6 +66,10 @@ public abstract partial class DrawableRuleset<TObject> : DrawableRuleset, IProvi
public override Container Overlays { get; } = new Container { RelativeSizeAxes = Axes.Both };
public override IAdjustableAudioComponent Audio => audioContainer;
private readonly AudioContainer audioContainer = new AudioContainer { RelativeSizeAxes = Axes.Both };
public override Container FrameStableComponents { get; } = new Container { RelativeSizeAxes = Axes.Both };
public override IFrameStableClock FrameStableClock => frameStabilityContainer;
@ -102,14 +106,6 @@ internal override bool FrameStablePlayback
private DrawableRulesetDependencies dependencies;
/// <summary>
/// Audio adjustments which are applied to the playfield.
/// </summary>
/// <remarks>
/// Does not affect <see cref="Overlays"/>.
/// </remarks>
public IAdjustableAudioComponent Audio { get; private set; }
/// <summary>
/// Creates a ruleset visualisation for the provided ruleset and beatmap.
/// </summary>
@ -172,30 +168,22 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
[BackgroundDependencyLoader]
private void load(CancellationToken? cancellationToken)
{
AudioContainer audioContainer;
InternalChild = frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
{
FrameStablePlayback = FrameStablePlayback,
Children = new Drawable[]
{
FrameStableComponents,
audioContainer = new AudioContainer
{
RelativeSizeAxes = Axes.Both,
Child = KeyBindingInputManager
.WithChildren(new Drawable[]
{
CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
Overlays
}),
},
audioContainer.WithChild(KeyBindingInputManager
.WithChildren(new Drawable[]
{
CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
Overlays
})),
}
};
Audio = audioContainer;
if ((ResumeOverlay = CreateResumeOverlay()) != null)
{
AddInternal(CreateInputManager()
@ -438,13 +426,21 @@ public abstract partial class DrawableRuleset : CompositeDrawable
/// </summary>
public readonly BindableBool IsPaused = new BindableBool();
/// <summary>
/// Audio adjustments which are applied to the playfield.
/// </summary>
/// <remarks>
/// Does not affect <see cref="Overlays"/>.
/// </remarks>
public abstract IAdjustableAudioComponent Audio { get; }
/// <summary>
/// The playfield.
/// </summary>
public abstract Playfield Playfield { get; }
/// <summary>
/// Content to be placed above hitobjects. Will be affected by frame stability.
/// Content to be placed above hitobjects. Will be affected by frame stability and adjustments applied to <see cref="Audio"/>.
/// </summary>
public abstract Container Overlays { get; }