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

Change ToolbarRulesetSelector to use SelectItem to trigger new sound feedback path

This commit is contained in:
Salman Ahmed 2024-04-17 02:38:39 +03:00
parent 2a3ae6bce1
commit 50a21fb727

View File

@ -3,11 +3,8 @@
#nullable disable
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -24,8 +21,6 @@ namespace osu.Game.Overlays.Toolbar
{
protected Drawable ModeButtonLine { get; private set; }
private readonly Dictionary<string, Sample> selectionSamples = new Dictionary<string, Sample>();
public ToolbarRulesetSelector()
{
RelativeSizeAxes = Axes.Y;
@ -33,7 +28,7 @@ namespace osu.Game.Overlays.Toolbar
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private void load()
{
AddRangeInternal(new[]
{
@ -59,9 +54,6 @@ namespace osu.Game.Overlays.Toolbar
}
},
});
foreach (var ruleset in Rulesets.AvailableRulesets)
selectionSamples[ruleset.ShortName] = audio.Samples.Get($"UI/ruleset-select-{ruleset.ShortName}");
}
protected override void LoadComplete()
@ -117,7 +109,7 @@ namespace osu.Game.Overlays.Toolbar
RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
if (found != null)
Current.Value = found;
SelectItem(found);
return true;
}