mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge pull request #28144 from peppy/hide-country-flags
Add setting to allow hiding all country flags
This commit is contained in:
commit
87f2a23263
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
new UpdateableFlag(score.User.CountryCode)
|
||||
{
|
||||
Size = new Vector2(19, 14),
|
||||
ShowPlaceholderOnUnknown = false,
|
||||
},
|
||||
username,
|
||||
#pragma warning disable 618
|
||||
|
@ -118,7 +118,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(19, 14),
|
||||
Margin = new MarginPadding { Top = 3 }, // makes spacing look more even
|
||||
ShowPlaceholderOnUnknown = false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,6 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
userFlag = new UpdateableFlag
|
||||
{
|
||||
Size = new Vector2(28, 20),
|
||||
ShowPlaceholderOnUnknown = false,
|
||||
},
|
||||
userCountryContainer = new OsuHoverContainer
|
||||
{
|
||||
|
@ -99,7 +99,6 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
new UpdateableFlag(GetCountryCode(item))
|
||||
{
|
||||
Size = new Vector2(28, 20),
|
||||
ShowPlaceholderOnUnknown = false,
|
||||
},
|
||||
CreateFlagContent(item)
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ namespace osu.Game.Overlays.Settings.Sections.Online
|
||||
LabelText = OnlineSettingsStrings.NotifyOnPrivateMessage,
|
||||
Current = config.GetBindable<bool>(OsuSetting.NotifyOnPrivateMessage)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = OnlineSettingsStrings.HideCountryFlags,
|
||||
Current = config.GetBindable<bool>(OsuSetting.HideCountryFlags)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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,33 +15,43 @@ namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public partial class UpdateableFlag : ModelBackedDrawable<CountryCode>
|
||||
{
|
||||
private CountryCode countryCode;
|
||||
|
||||
public CountryCode CountryCode
|
||||
{
|
||||
get => Model;
|
||||
set => Model = value;
|
||||
get => countryCode;
|
||||
set
|
||||
{
|
||||
countryCode = value;
|
||||
updateModel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show a place holder on unknown country.
|
||||
/// </summary>
|
||||
public bool ShowPlaceholderOnUnknown = true;
|
||||
|
||||
/// <summary>
|
||||
/// Perform an action in addition to showing the country ranking.
|
||||
/// This should be used to perform auxiliary tasks and not as a primary action for clicking a flag (to maintain a consistent UX).
|
||||
/// </summary>
|
||||
public Action? Action;
|
||||
|
||||
private readonly Bindable<bool> hideFlags = new BindableBool();
|
||||
|
||||
[Resolved]
|
||||
private RankingsOverlay? rankingsOverlay { get; set; }
|
||||
|
||||
public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown)
|
||||
{
|
||||
CountryCode = countryCode;
|
||||
hideFlags.BindValueChanged(_ => updateModel());
|
||||
}
|
||||
|
||||
protected override Drawable? CreateDrawable(CountryCode countryCode)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown)
|
||||
return null;
|
||||
config.BindWith(OsuSetting.HideCountryFlags, hideFlags);
|
||||
}
|
||||
|
||||
protected override Drawable CreateDrawable(CountryCode countryCode)
|
||||
{
|
||||
return new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -54,14 +66,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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user