mirror of
https://github.com/ppy/osu.git
synced 2026-05-28 08:30:00 +08:00
Inverse and xmldoc ShearedToggleButton sample allowance bool
This commit is contained in:
@@ -14,7 +14,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private Sample? sampleOff;
|
private Sample? sampleOff;
|
||||||
private Sample? sampleOn;
|
private Sample? sampleOn;
|
||||||
|
|
||||||
protected virtual bool PlayClickSampleOnly => false;
|
/// <summary>
|
||||||
|
/// Sheared toggle buttons by default play two samples when toggled: a click and a toggle (on/off).
|
||||||
|
/// Sometimes this might be too much. Setting this to <c>false</c> will silence the toggle sound.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool PlayToggleSamples => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this button is currently toggled to an active state.
|
/// Whether this button is currently toggled to an active state.
|
||||||
@@ -70,13 +74,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
sampleClick?.Play();
|
sampleClick?.Play();
|
||||||
|
|
||||||
if (PlayClickSampleOnly)
|
if (PlayToggleSamples)
|
||||||
return;
|
{
|
||||||
|
if (Active.Value)
|
||||||
if (Active.Value)
|
sampleOn?.Play();
|
||||||
sampleOn?.Play();
|
else
|
||||||
else
|
sampleOff?.Play();
|
||||||
sampleOff?.Play();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
public partial class AddPresetButton : ShearedToggleButton, IHasPopover
|
public partial class AddPresetButton : ShearedToggleButton, IHasPopover
|
||||||
{
|
{
|
||||||
protected override bool PlayClickSampleOnly => true;
|
protected override bool PlayToggleSamples => false;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; } = null!;
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|||||||
Reference in New Issue
Block a user