mirror of
https://github.com/osukey/osukey.git
synced 2025-05-07 22:57:31 +09: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,
|
TextAddCaps,
|
||||||
TextRemove,
|
TextRemove,
|
||||||
TextConfirm,
|
TextConfirm,
|
||||||
|
TextInvalid,
|
||||||
CaretMove,
|
CaretMove,
|
||||||
SelectCharacter,
|
SelectCharacter,
|
||||||
SelectWord,
|
SelectWord,
|
||||||
@ -95,6 +96,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{ FeedbackSampleType.TextAddCaps, new[] { audio.Samples.Get(@"Keyboard/key-caps") } },
|
{ FeedbackSampleType.TextAddCaps, new[] { audio.Samples.Get(@"Keyboard/key-caps") } },
|
||||||
{ FeedbackSampleType.TextRemove, new[] { audio.Samples.Get(@"Keyboard/key-delete") } },
|
{ FeedbackSampleType.TextRemove, new[] { audio.Samples.Get(@"Keyboard/key-delete") } },
|
||||||
{ FeedbackSampleType.TextConfirm, new[] { audio.Samples.Get(@"Keyboard/key-confirm") } },
|
{ 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.CaretMove, new[] { audio.Samples.Get(@"Keyboard/key-movement") } },
|
||||||
{ FeedbackSampleType.SelectCharacter, new[] { audio.Samples.Get(@"Keyboard/select-char") } },
|
{ FeedbackSampleType.SelectCharacter, new[] { audio.Samples.Get(@"Keyboard/select-char") } },
|
||||||
{ FeedbackSampleType.SelectWord, new[] { audio.Samples.Get(@"Keyboard/select-word") } },
|
{ FeedbackSampleType.SelectWord, new[] { audio.Samples.Get(@"Keyboard/select-word") } },
|
||||||
@ -111,6 +113,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
base.OnUserTextAdded(added);
|
base.OnUserTextAdded(added);
|
||||||
|
|
||||||
|
if (!added.Any(CanAddCharacter))
|
||||||
|
return;
|
||||||
|
|
||||||
if (added.Any(char.IsUpper) && AllowUniqueCharacterSamples)
|
if (added.Any(char.IsUpper) && AllowUniqueCharacterSamples)
|
||||||
playSample(FeedbackSampleType.TextAddCaps);
|
playSample(FeedbackSampleType.TextAddCaps);
|
||||||
else
|
else
|
||||||
@ -124,6 +129,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
playSample(FeedbackSampleType.TextRemove);
|
playSample(FeedbackSampleType.TextRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void NotifyInputError()
|
||||||
|
{
|
||||||
|
base.NotifyInputError();
|
||||||
|
|
||||||
|
playSample(FeedbackSampleType.TextInvalid);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnTextCommitted(bool textChanged)
|
protected override void OnTextCommitted(bool textChanged)
|
||||||
{
|
{
|
||||||
base.OnTextCommitted(textChanged);
|
base.OnTextCommitted(textChanged);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user