1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 20:07:25 +08:00

Add hover sounds to mod buttons

This commit is contained in:
Dean Herbert 2017-11-26 03:28:11 +09:00
parent 880418fd0d
commit c5aacb75c6
2 changed files with 4 additions and 5 deletions

View File

@ -17,6 +17,7 @@ using osu.Game.Rulesets.UI;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
@ -31,7 +32,7 @@ namespace osu.Game.Overlays.Mods
private readonly Container<ModIcon> iconsContainer; private readonly Container<ModIcon> iconsContainer;
private SampleChannel sampleOn, sampleOff; private SampleChannel sampleOn, sampleOff;
public Action<Mod> Action; // Passed the selected mod or null if none public new Action<Mod> Action; // Passed the selected mod or null if none
public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty;
@ -148,7 +149,7 @@ namespace osu.Game.Overlays.Mods
// the mods from Mod, only multiple if Mod is a MultiMod // the mods from Mod, only multiple if Mod is a MultiMod
public override Mod SelectedMod => Mods.ElementAtOrDefault(SelectedIndex); public virtual Mod SelectedMod => Mods.ElementAtOrDefault(SelectedIndex);
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
@ -253,6 +254,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
TextSize = 18, TextSize = 18,
}, },
new HoverClickSounds()
}; };
Mod = mod; Mod = mod;

View File

@ -3,7 +3,6 @@
using OpenTK; using OpenTK;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
@ -12,8 +11,6 @@ namespace osu.Game.Overlays.Mods
/// </summary> /// </summary>
public class ModButtonEmpty : Container public class ModButtonEmpty : Container
{ {
public virtual Mod SelectedMod => null;
public ModButtonEmpty() public ModButtonEmpty()
{ {
Size = new Vector2(100f); Size = new Vector2(100f);