diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index f4a4c553d8..affcaffe02 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -200,6 +200,8 @@ namespace osu.Game.Configuration SetDefault(OsuSetting.EditorLimitedDistanceSnap, false); SetDefault(OsuSetting.EditorShowSpeedChanges, false); + SetDefault(OsuSetting.HideCountryFlags, false); + SetDefault(OsuSetting.MultiplayerRoomFilter, RoomPermissionsFilter.All); SetDefault(OsuSetting.LastProcessedMetadataId, -1); @@ -435,6 +437,7 @@ namespace osu.Game.Configuration TouchDisableGameplayTaps, ModSelectTextSearchStartsActive, UserOnlineStatus, - MultiplayerRoomFilter + MultiplayerRoomFilter, + HideCountryFlags, } } diff --git a/osu.Game/Localisation/OnlineSettingsStrings.cs b/osu.Game/Localisation/OnlineSettingsStrings.cs index 0660bac172..8e8c81cf59 100644 --- a/osu.Game/Localisation/OnlineSettingsStrings.cs +++ b/osu.Game/Localisation/OnlineSettingsStrings.cs @@ -79,6 +79,11 @@ namespace osu.Game.Localisation /// public static LocalisableString DiscordPresenceOff => new TranslatableString(getKey(@"discord_presence_off"), @"Off"); + /// + /// "Hide country flags" + /// + public static LocalisableString HideCountryFlags => new TranslatableString(getKey(@"hide_country_flags"), @"Hide country flags"); + private static string getKey(string key) => $"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs index e7b6aa56a8..7bd0829add 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs @@ -28,6 +28,11 @@ namespace osu.Game.Overlays.Settings.Sections.Online LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage, Current = config.GetBindable(OsuSetting.NotifyOnPrivateMessage) }, + new SettingsCheckbox + { + LabelText = OnlineSettingsStrings.HideCountryFlags, + Current = config.GetBindable(OsuSetting.HideCountryFlags) + }, }; } } diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index 8f8d7052e5..136478c7bb 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -3,9 +3,11 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; @@ -13,14 +15,20 @@ namespace osu.Game.Users.Drawables { public partial class UpdateableFlag : ModelBackedDrawable { + private CountryCode countryCode; + public CountryCode CountryCode { - get => Model; - set => Model = value; + get => countryCode; + set + { + countryCode = value; + updateModel(); + } } /// - /// Whether to show a place holder on unknown country. + /// Whether to show a placeholder on unknown country. /// public bool ShowPlaceholderOnUnknown = true; @@ -30,9 +38,21 @@ namespace osu.Game.Users.Drawables /// public Action? Action; + private readonly Bindable hideFlags = new BindableBool(); + + [Resolved] + private RankingsOverlay? rankingsOverlay { get; set; } + public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) { CountryCode = countryCode; + hideFlags.BindValueChanged(_ => updateModel()); + } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + config.BindWith(OsuSetting.HideCountryFlags, hideFlags); } protected override Drawable? CreateDrawable(CountryCode countryCode) @@ -54,14 +74,13 @@ namespace osu.Game.Users.Drawables }; } - [Resolved] - private RankingsOverlay? rankingsOverlay { get; set; } - protected override bool OnClick(ClickEvent e) { Action?.Invoke(); rankingsOverlay?.ShowCountry(CountryCode); return true; } + + private void updateModel() => Model = hideFlags.Value ? CountryCode.Unknown : countryCode; } }