1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-18 07:17:20 +08:00

Expose DrawableRuleset audio adjustments as non-container

This commit is contained in:
Dean Herbert 2021-07-31 15:05:54 +09:00
parent 29328bdf7f
commit 53c901bfa8
3 changed files with 15 additions and 5 deletions

View File

@ -22,5 +22,11 @@ namespace osu.Game.Extensions
/// <returns>An editor formatted display string.</returns>
public static string ToEditorFormattedString(this TimeSpan timeSpan) =>
$"{(timeSpan < TimeSpan.Zero ? "-" : string.Empty)}{timeSpan:mm\\:ss\\:fff}";
public static string ToFormattedDuration(this double milliseconds) =>
ToFormattedDuration(TimeSpan.FromMilliseconds(milliseconds));
public static string ToFormattedDuration(this TimeSpan timeSpan) =>
timeSpan.Hours == 0 ? $"{timeSpan:mm\\:ss}" : $"{timeSpan:HH\\:mm\\:ss}";
}
}

View File

@ -7,7 +7,6 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
@ -82,7 +81,7 @@ namespace osu.Game.Rulesets.Mods
}
if (AffectsHitSounds.Value)
drawableRuleset.AudioContainer.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust);
drawableRuleset.Audio.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust);
}
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -99,12 +100,12 @@ namespace osu.Game.Rulesets.UI
private DrawableRulesetDependencies dependencies;
/// <summary>
/// An audio container which can be used to apply adjustments to playfield content.
/// Audio adjustments which are applied to the playfield.
/// </summary>
/// <remarks>
/// Does not affect <see cref="Overlays"/>.
/// </remarks>
public AudioContainer AudioContainer { get; private set; }
public IAdjustableAudioComponent Audio { get; private set; }
/// <summary>
/// Creates a ruleset visualisation for the provided ruleset and beatmap.
@ -163,13 +164,15 @@ namespace osu.Game.Rulesets.UI
[BackgroundDependencyLoader]
private void load(CancellationToken? cancellationToken)
{
AudioContainer audioContainer;
InternalChild = frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
{
FrameStablePlayback = FrameStablePlayback,
Children = new Drawable[]
{
FrameStableComponents,
AudioContainer = new AudioContainer
audioContainer = new AudioContainer
{
RelativeSizeAxes = Axes.Both,
Child = KeyBindingInputManager
@ -181,6 +184,8 @@ namespace osu.Game.Rulesets.UI
}
};
Audio = audioContainer;
if ((ResumeOverlay = CreateResumeOverlay()) != null)
{
AddInternal(CreateInputManager()