mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 12:22:56 +08:00
Inverse and xmldoc ShearedToggleButton
sample allowance bool
This commit is contained in:
parent
c811546868
commit
fc2fac577f
@ -14,7 +14,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private Sample? sampleOff;
|
||||
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>
|
||||
/// Whether this button is currently toggled to an active state.
|
||||
@ -70,13 +74,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
sampleClick?.Play();
|
||||
|
||||
if (PlayClickSampleOnly)
|
||||
return;
|
||||
|
||||
if (Active.Value)
|
||||
sampleOn?.Play();
|
||||
else
|
||||
sampleOff?.Play();
|
||||
if (PlayToggleSamples)
|
||||
{
|
||||
if (Active.Value)
|
||||
sampleOn?.Play();
|
||||
else
|
||||
sampleOff?.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public partial class AddPresetButton : ShearedToggleButton, IHasPopover
|
||||
{
|
||||
protected override bool PlayClickSampleOnly => true;
|
||||
protected override bool PlayToggleSamples => false;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
Loading…
Reference in New Issue
Block a user