mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 15:47:38 +09:00
Fix adjusting volume via settings playing tick samples twice
This commit is contained in:
parent
4803f606c2
commit
447d420c99
@ -44,6 +44,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
public virtual LocalisableString TooltipText { get; private set; }
|
public virtual LocalisableString TooltipText { get; private set; }
|
||||||
|
|
||||||
|
public bool PlaySamplesOnAdjust { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to format the tooltip as a percentage or the actual value.
|
/// Whether to format the tooltip as a percentage or the actual value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -187,6 +189,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void playSample(T value)
|
private void playSample(T value)
|
||||||
{
|
{
|
||||||
|
if (!PlaySamplesOnAdjust)
|
||||||
|
return;
|
||||||
|
|
||||||
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 30)
|
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 30)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Audio
|
namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||||
@ -21,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsSlider<double>
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.MasterVolume,
|
LabelText = AudioSettingsStrings.MasterVolume,
|
||||||
Current = audio.Volume,
|
Current = audio.Volume,
|
||||||
@ -35,14 +36,15 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
new SettingsSlider<double>
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.EffectVolume,
|
LabelText = AudioSettingsStrings.EffectVolume,
|
||||||
Current = audio.VolumeSample,
|
Current = audio.VolumeSample,
|
||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
DisplayAsPercentage = true
|
DisplayAsPercentage = true
|
||||||
},
|
},
|
||||||
new SettingsSlider<double>
|
|
||||||
|
new VolumeAdjustSlider
|
||||||
{
|
{
|
||||||
LabelText = AudioSettingsStrings.MusicVolume,
|
LabelText = AudioSettingsStrings.MusicVolume,
|
||||||
Current = audio.VolumeTrack,
|
Current = audio.VolumeTrack,
|
||||||
@ -51,5 +53,15 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class VolumeAdjustSlider : SettingsSlider<double>
|
||||||
|
{
|
||||||
|
protected override Drawable CreateControl()
|
||||||
|
{
|
||||||
|
var sliderBar = (OsuSliderBar<double>)base.CreateControl();
|
||||||
|
sliderBar.PlaySamplesOnAdjust = false;
|
||||||
|
return sliderBar;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user