1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 23:23:12 +08:00

Add setting to allow hiding all country flags

There have been enough requests for this at this point to implement it.
This commit is contained in:
Dean Herbert 2024-05-10 20:32:21 +08:00
parent 5285b35d64
commit b026309e36
No known key found for this signature in database
4 changed files with 39 additions and 7 deletions

View File

@ -200,6 +200,8 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.EditorLimitedDistanceSnap, false); SetDefault(OsuSetting.EditorLimitedDistanceSnap, false);
SetDefault(OsuSetting.EditorShowSpeedChanges, false); SetDefault(OsuSetting.EditorShowSpeedChanges, false);
SetDefault(OsuSetting.HideCountryFlags, false);
SetDefault(OsuSetting.MultiplayerRoomFilter, RoomPermissionsFilter.All); SetDefault(OsuSetting.MultiplayerRoomFilter, RoomPermissionsFilter.All);
SetDefault(OsuSetting.LastProcessedMetadataId, -1); SetDefault(OsuSetting.LastProcessedMetadataId, -1);
@ -435,6 +437,7 @@ namespace osu.Game.Configuration
TouchDisableGameplayTaps, TouchDisableGameplayTaps,
ModSelectTextSearchStartsActive, ModSelectTextSearchStartsActive,
UserOnlineStatus, UserOnlineStatus,
MultiplayerRoomFilter MultiplayerRoomFilter,
HideCountryFlags,
} }
} }

View File

@ -79,6 +79,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString DiscordPresenceOff => new TranslatableString(getKey(@"discord_presence_off"), @"Off"); public static LocalisableString DiscordPresenceOff => new TranslatableString(getKey(@"discord_presence_off"), @"Off");
/// <summary>
/// "Hide country flags"
/// </summary>
public static LocalisableString HideCountryFlags => new TranslatableString(getKey(@"hide_country_flags"), @"Hide country flags");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }
} }

View File

@ -28,6 +28,11 @@ namespace osu.Game.Overlays.Settings.Sections.Online
LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage, LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage,
Current = config.GetBindable<bool>(OsuSetting.NotifyOnPrivateMessage) Current = config.GetBindable<bool>(OsuSetting.NotifyOnPrivateMessage)
}, },
new SettingsCheckbox
{
LabelText = OnlineSettingsStrings.HideCountryFlags,
Current = config.GetBindable<bool>(OsuSetting.HideCountryFlags)
},
}; };
} }
} }

View File

@ -3,9 +3,11 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -13,14 +15,20 @@ namespace osu.Game.Users.Drawables
{ {
public partial class UpdateableFlag : ModelBackedDrawable<CountryCode> public partial class UpdateableFlag : ModelBackedDrawable<CountryCode>
{ {
private CountryCode countryCode;
public CountryCode CountryCode public CountryCode CountryCode
{ {
get => Model; get => countryCode;
set => Model = value; set
{
countryCode = value;
updateModel();
}
} }
/// <summary> /// <summary>
/// Whether to show a place holder on unknown country. /// Whether to show a placeholder on unknown country.
/// </summary> /// </summary>
public bool ShowPlaceholderOnUnknown = true; public bool ShowPlaceholderOnUnknown = true;
@ -30,9 +38,21 @@ namespace osu.Game.Users.Drawables
/// </summary> /// </summary>
public Action? Action; public Action? Action;
private readonly Bindable<bool> hideFlags = new BindableBool();
[Resolved]
private RankingsOverlay? rankingsOverlay { get; set; }
public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown)
{ {
CountryCode = countryCode; CountryCode = countryCode;
hideFlags.BindValueChanged(_ => updateModel());
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.HideCountryFlags, hideFlags);
} }
protected override Drawable? CreateDrawable(CountryCode countryCode) 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) protected override bool OnClick(ClickEvent e)
{ {
Action?.Invoke(); Action?.Invoke();
rankingsOverlay?.ShowCountry(CountryCode); rankingsOverlay?.ShowCountry(CountryCode);
return true; return true;
} }
private void updateModel() => Model = hideFlags.Value ? CountryCode.Unknown : countryCode;
} }
} }