mirror of https://github.com/ppy/osu
Use more appropriate sounds for certain components
This commit is contained in:
parent
365819865e
commit
2878bb592f
|
@ -13,6 +13,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||
{
|
||||
public class ShearedToggleButton : ShearedButton
|
||||
{
|
||||
private Sample? sampleClick;
|
||||
private Sample? sampleOff;
|
||||
private Sample? sampleOn;
|
||||
|
||||
|
@ -39,8 +40,9 @@ public ShearedToggleButton(float? width = null)
|
|||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleOn = audio.Samples.Get(@"UI/check-on");
|
||||
sampleOff = audio.Samples.Get(@"UI/check-off");
|
||||
sampleClick = audio.Samples.Get(@"UI/default-select");
|
||||
sampleOn = audio.Samples.Get(@"UI/dropdown-open");
|
||||
sampleOff = audio.Samples.Get(@"UI/dropdown-close");
|
||||
}
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds(sampleSet);
|
||||
|
@ -67,6 +69,8 @@ private void updateActiveState()
|
|||
|
||||
private void playSample()
|
||||
{
|
||||
sampleClick?.Play();
|
||||
|
||||
if (Active.Value)
|
||||
sampleOn?.Play();
|
||||
else
|
||||
|
|
|
@ -40,7 +40,7 @@ private void load()
|
|||
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
|
||||
Text = LabelFor(Value)
|
||||
},
|
||||
new HoverClickSounds()
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
});
|
||||
|
||||
Enabled.Value = true;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
@ -16,6 +18,7 @@
|
|||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Chat;
|
||||
using osuTK;
|
||||
|
||||
|
@ -32,6 +35,8 @@ public class ChannelListingItem : OsuClickableContainer, IFilterable
|
|||
public IEnumerable<LocalisableString> FilterTerms => new LocalisableString[] { Channel.Name, Channel.Topic ?? string.Empty };
|
||||
public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); }
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
||||
|
||||
private Box hoverBox = null!;
|
||||
private SpriteIcon checkbox = null!;
|
||||
private OsuSpriteText channelText = null!;
|
||||
|
@ -46,14 +51,20 @@ public class ChannelListingItem : OsuClickableContainer, IFilterable
|
|||
|
||||
private const float vertical_margin = 1.5f;
|
||||
|
||||
private Sample? sampleJoin;
|
||||
private Sample? sampleLeave;
|
||||
|
||||
public ChannelListingItem(Channel channel)
|
||||
{
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleJoin = audio.Samples.Get(@"UI/check-on");
|
||||
sampleLeave = audio.Samples.Get(@"UI/check-off");
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
@ -156,7 +167,19 @@ protected override void LoadComplete()
|
|||
}
|
||||
}, true);
|
||||
|
||||
Action = () => (channelJoined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel);
|
||||
Action = () =>
|
||||
{
|
||||
if (channelJoined.Value)
|
||||
{
|
||||
OnRequestLeave?.Invoke(Channel);
|
||||
sampleLeave?.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnRequestJoin?.Invoke(Channel);
|
||||
sampleJoin?.Play();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ExpandDetailsButton : ProfileHeaderButton
|
|||
private Sample sampleOpen;
|
||||
private Sample sampleClose;
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds();
|
||||
|
||||
public ExpandDetailsButton()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue