mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 06:47:24 +08:00
Consolidate HoverClickSounds constructors
As suggested in review, merge both HoverClickSounds constructors into one accepting optional arguments. Due to existing usages the parameter is added as second and supplied by name in ModButton.
This commit is contained in:
parent
658e0edc3e
commit
c4dc34eefd
@ -20,24 +20,18 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private SampleChannel sampleClick;
|
||||
private readonly MouseButton[] buttons;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance that adds sounds on hover and left click only.
|
||||
/// </summary>
|
||||
/// <param name="sampleSet">Set of click samples to play.</param>
|
||||
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||
: this(new[] { MouseButton.Left }, sampleSet)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance that adds sounds on hover and on click for any of the buttons specified.
|
||||
/// </summary>
|
||||
/// <param name="buttons">Array of button codes which should trigger the click sound.</param>
|
||||
/// <param name="sampleSet">Set of click samples to play.</param>
|
||||
public HoverClickSounds(MouseButton[] buttons, HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||
/// <param name="buttons">
|
||||
/// Array of button codes which should trigger the click sound.
|
||||
/// If this optional parameter is omitted or set to <code>null</code>, the click sound will also be added on left click.
|
||||
/// </param>
|
||||
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal, MouseButton[] buttons = null)
|
||||
: base(sampleSet)
|
||||
{
|
||||
this.buttons = buttons;
|
||||
this.buttons = buttons ?? new[] { MouseButton.Left };
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
|
@ -283,7 +283,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Anchor = Anchor.TopCentre,
|
||||
Font = OsuFont.GetFont(size: 18)
|
||||
},
|
||||
new HoverClickSounds(new[] { MouseButton.Left, MouseButton.Right })
|
||||
new HoverClickSounds(buttons: new[] { MouseButton.Left, MouseButton.Right })
|
||||
};
|
||||
|
||||
Mod = mod;
|
||||
|
Loading…
Reference in New Issue
Block a user