1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 07:22:55 +08:00

Add supporter note to background source setting

This commit is contained in:
Joseph Madamba 2021-05-04 01:00:35 -07:00
parent 796bd8e47e
commit 0a64922738

View File

@ -2,8 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Online.API;
using osu.Game.Users;
namespace osu.Game.Overlays.Settings.Sections.UserInterface
{
@ -11,9 +14,15 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
{
protected override string Header => "Main Menu";
private IBindable<User> user;
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, IAPIProvider api)
{
user = api.LocalUser.GetBoundCopy();
Children = new Drawable[]
{
new SettingsCheckbox
@ -31,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
LabelText = "Intro sequence",
Current = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
},
new SettingsEnumDropdown<BackgroundSource>
backgroundSourceDropdown = new SettingsEnumDropdown<BackgroundSource>
{
LabelText = "Background source",
Current = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
@ -43,5 +52,17 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
backgroundSourceDropdown.Current.BindValueChanged(source =>
{
const string not_supporter_note = "Changes to this setting will only apply with an active osu!supporter tag.";
backgroundSourceDropdown.NoteText = user.Value?.IsSupporter == false ? not_supporter_note : string.Empty;
}, true);
}
}
}