mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 03:23:05 +08:00
Add skin seleciton dropdown to settings
This commit is contained in:
parent
2351b6ab26
commit
659cf629b6
@ -1,26 +1,33 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Skinning;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections
|
||||
{
|
||||
public class SkinSection : SettingsSection
|
||||
{
|
||||
private SettingsDropdown<SkinInfo> skinDropdown;
|
||||
|
||||
public override string Header => "Skin";
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load(OsuConfigManager config, SkinManager skins)
|
||||
{
|
||||
FlowContent.Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
skinDropdown = new SettingsDropdown<SkinInfo>(),
|
||||
new SettingsSlider<double, SizeSlider>
|
||||
{
|
||||
LabelText = "Menu cursor size",
|
||||
@ -39,6 +46,14 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
|
||||
},
|
||||
};
|
||||
|
||||
void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, SkinInfo>(s.Name, s));
|
||||
skins.ItemAdded += _ => reloadSkins();
|
||||
skins.ItemRemoved += _ => reloadSkins();
|
||||
|
||||
reloadSkins();
|
||||
|
||||
skinDropdown.Bindable = skins.CurrentSkinInfo;
|
||||
}
|
||||
|
||||
private class SizeSlider : OsuSliderBar<double>
|
||||
|
Loading…
Reference in New Issue
Block a user