mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 07:52:57 +08:00
Add audio feedback for invalid textbox input
This commit is contained in:
parent
cc9dc604a0
commit
212d76a11f
@ -53,6 +53,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
TextAddCaps,
|
||||
TextRemove,
|
||||
TextConfirm,
|
||||
TextInvalid,
|
||||
CaretMove,
|
||||
SelectCharacter,
|
||||
SelectWord,
|
||||
@ -95,6 +96,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{ FeedbackSampleType.TextAddCaps, new[] { audio.Samples.Get(@"Keyboard/key-caps") } },
|
||||
{ FeedbackSampleType.TextRemove, new[] { audio.Samples.Get(@"Keyboard/key-delete") } },
|
||||
{ FeedbackSampleType.TextConfirm, new[] { audio.Samples.Get(@"Keyboard/key-confirm") } },
|
||||
{ FeedbackSampleType.TextInvalid, new[] { audio.Samples.Get(@"Keyboard/key-invalid") } },
|
||||
{ FeedbackSampleType.CaretMove, new[] { audio.Samples.Get(@"Keyboard/key-movement") } },
|
||||
{ FeedbackSampleType.SelectCharacter, new[] { audio.Samples.Get(@"Keyboard/select-char") } },
|
||||
{ FeedbackSampleType.SelectWord, new[] { audio.Samples.Get(@"Keyboard/select-word") } },
|
||||
@ -111,6 +113,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.OnUserTextAdded(added);
|
||||
|
||||
if (!added.Any(CanAddCharacter))
|
||||
return;
|
||||
|
||||
if (added.Any(char.IsUpper) && AllowUniqueCharacterSamples)
|
||||
playSample(FeedbackSampleType.TextAddCaps);
|
||||
else
|
||||
@ -124,6 +129,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
playSample(FeedbackSampleType.TextRemove);
|
||||
}
|
||||
|
||||
protected override void NotifyInputError()
|
||||
{
|
||||
base.NotifyInputError();
|
||||
|
||||
playSample(FeedbackSampleType.TextInvalid);
|
||||
}
|
||||
|
||||
protected override void OnTextCommitted(bool textChanged)
|
||||
{
|
||||
base.OnTextCommitted(textChanged);
|
||||
|
Loading…
Reference in New Issue
Block a user