Add global web setting for allowing explicit content

This commit is contained in:
Salman Ahmed 2021-01-12 11:10:25 +03:00
parent 249be461d5
commit 24c1839739
3 changed files with 20 additions and 1 deletions

View File

@ -60,6 +60,8 @@ namespace osu.Game.Configuration
Set(OsuSetting.ExternalLinkWarning, true);
Set(OsuSetting.PreferNoVideo, false);
Set(OsuSetting.AllowExplicitContent, false);
// Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@ -270,5 +272,6 @@ namespace osu.Game.Configuration
EditorWaveformOpacity,
DiscordRichPresence,
AutomaticallyDownloadWhenSpectating,
AllowExplicitContent,
}
}

View File

@ -11,6 +11,7 @@ using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;
@ -140,10 +141,19 @@ namespace osu.Game.Overlays.BeatmapListing
categoryFilter.Current.Value = SearchCategory.Leaderboard;
}
private IBindable<bool> allowExplicitContent;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider, OsuConfigManager config)
{
background.Colour = colourProvider.Dark6;
allowExplicitContent = config.GetBindable<bool>(OsuSetting.AllowExplicitContent);
allowExplicitContent.BindValueChanged(allow =>
{
// Update search control if global "explicit allowed" setting changed.
Explicit.Value = allow.NewValue ? SearchExplicit.Show : SearchExplicit.Hide;
}, true);
}
public void TakeFocus() => textBox.TakeFocus();

View File

@ -33,6 +33,12 @@ namespace osu.Game.Overlays.Settings.Sections.Online
Keywords = new[] { "spectator" },
Current = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating),
},
new SettingsCheckbox
{
LabelText = "Hide warnings for explicit content in beatmaps",
Keywords = new[] { "nsfw", "18+", "offensive" },
Current = config.GetBindable<bool>(OsuSetting.AllowExplicitContent),
}
};
}
}