mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #18005 from nekodex/fix-missing-sfx
Fix some missing/incorrect UI SFX
This commit is contained in:
commit
34457078eb
@ -4,6 +4,8 @@
|
||||
#nullable enable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -31,6 +33,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
private Color4 enabledColour;
|
||||
private Color4 disabledColour;
|
||||
|
||||
private Sample? sampleChecked;
|
||||
private Sample? sampleUnchecked;
|
||||
|
||||
public SwitchButton()
|
||||
{
|
||||
Size = new Vector2(45, 20);
|
||||
@ -70,13 +75,16 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OverlayColourProvider? colourProvider, OsuColour colours)
|
||||
private void load(OverlayColourProvider? colourProvider, OsuColour colours, AudioManager audio)
|
||||
{
|
||||
enabledColour = colourProvider?.Highlight1 ?? colours.BlueDark;
|
||||
disabledColour = colourProvider?.Background3 ?? colours.Gray3;
|
||||
|
||||
switchContainer.Colour = enabledColour;
|
||||
fill.Colour = disabledColour;
|
||||
|
||||
sampleChecked = audio.Samples.Get(@"UI/check-on");
|
||||
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -107,6 +115,16 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override void OnUserChange(bool value)
|
||||
{
|
||||
base.OnUserChange(value);
|
||||
|
||||
if (value)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
}
|
||||
|
||||
private void updateBorder()
|
||||
{
|
||||
circularContainer.TransformBorderTo((Current.Value ? enabledColour : disabledColour).Lighten(IsHovered ? 0.3f : 0));
|
||||
|
@ -72,7 +72,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
Size = new Vector2(12),
|
||||
Icon = getIconForCardSize(Value)
|
||||
}
|
||||
}
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
});
|
||||
|
||||
AddInternal(new HoverClickSounds());
|
||||
AddInternal(new HoverClickSounds(HoverSampleSet.TabSelect));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
Loading…
Reference in New Issue
Block a user