Move playing text added samples to private helper and fix it never playing the last sample

`RNG.Next` is exclusive of the upper bound, meaning that the last sample would never be played.
This commit is contained in:
Susko3 2021-12-08 09:49:36 +01:00
parent f2318d7e26
commit af1e97b7c7

View File

@ -86,6 +86,8 @@ namespace osu.Game.Graphics.UserInterface
protected override Color4 SelectionColour => selectionColour;
private void playTextAddedSample() => textAddedSamples[RNG.Next(0, textAddedSamples.Length)]?.Play();
protected override void OnUserTextAdded(string added)
{
base.OnUserTextAdded(added);
@ -93,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface
if (added.Any(char.IsUpper) && AllowUniqueCharacterSamples)
capsTextAddedSample?.Play();
else
textAddedSamples[RNG.Next(0, 3)]?.Play();
playTextAddedSample();
}
protected override void OnUserTextRemoved(string removed)