Add hotkey to select random skin

This commit is contained in:
Dean Herbert
2020-11-11 13:05:03 +09:00
parent df00a4ab9b
commit 8d38d9cc93
5 changed files with 26 additions and 17 deletions

View File

@ -9,7 +9,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Logging;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Skinning;
@ -103,7 +102,7 @@ namespace osu.Game.Overlays.Settings.Sections
{
if (skin.NewValue == random_skin_info)
{
randomizeSkin();
skins.SelectRandomSkin();
return;
}
@ -111,20 +110,6 @@ namespace osu.Game.Overlays.Settings.Sections
});
}
private void randomizeSkin()
{
// choose from only user skins, removing the current selection to ensure a new one is chosen.
var randomChoices = skinItems.Where(s => s.ID > 0 && s.ID != configBindable.Value).ToArray();
if (randomChoices.Length == 0)
{
configBindable.Value = SkinInfo.Default.ID;
return;
}
configBindable.Value = randomChoices.ElementAt(RNG.Next(0, randomChoices.Length)).ID;
}
private void updateItems()
{
skinItems = skins.GetAllUsableSkins();