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

Merge pull request #31238 from frenzibyte/make-featured-artist-setting

Save "featured artists" filter to user settings and disable toggling on iOS
This commit is contained in:
Dean Herbert 2024-12-24 14:07:20 +09:00 committed by GitHub
commit 85f5234880
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 48 additions and 4 deletions

View File

@ -57,6 +57,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f, 0.01f);
SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal);
SetDefault(OsuSetting.BeatmapListingFeaturedArtistFilter, true);
SetDefault(OsuSetting.ProfileCoverExpanded, true);
@ -450,5 +451,6 @@ namespace osu.Game.Configuration
EditorAdjustExistingObjectsOnTimingChanges,
AlwaysRequireHoldingForPause,
MultiplayerShowInProgressFilter,
BeatmapListingFeaturedArtistFilter,
}
}

View File

@ -28,6 +28,11 @@ This includes content that may not be correctly licensed for osu! usage. Browse
/// </summary>
public static LocalisableString UserContentConfirmButtonText => new TranslatableString(getKey(@"understood"), @"I understand");
/// <summary>
/// "Featured Artists are music artists who have collaborated with osu! to make a selection of their tracks available for use in beatmaps. For some osu! releases, we showcase only featured artist beatmaps to better support the surrounding ecosystem."
/// </summary>
public static LocalisableString FeaturedArtistsTooltip => new TranslatableString(getKey(@"featured_artists_disabled_tooltip"), @"Featured Artists are music artists who have collaborated with osu! to make a selection of their tracks available for use in beatmaps. For some osu! releases, we showcase only featured artist beatmaps to better support the surrounding ecosystem.");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -221,6 +221,11 @@ namespace osu.Game
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
/// <summary>
/// Whether the game should be limited to only display officially licensed content.
/// </summary>
public virtual bool HideUnlicensedContent => false;
public OsuGame(string[] args = null)
{
this.args = args;

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
@ -113,7 +114,7 @@ namespace osu.Game.Overlays.BeatmapListing
}
}
private partial class FeaturedArtistsTabItem : MultipleSelectionFilterTabItem
private partial class FeaturedArtistsTabItem : MultipleSelectionFilterTabItem, IHasTooltip
{
private Bindable<bool> disclaimerShown = null!;
@ -125,17 +126,36 @@ namespace osu.Game.Overlays.BeatmapListing
[Resolved]
private OsuColour colours { get; set; } = null!;
[Resolved]
private OsuConfigManager config { get; set; } = null!;
[Resolved]
private SessionStatics sessionStatics { get; set; } = null!;
[Resolved]
private IDialogOverlay? dialogOverlay { get; set; }
[Resolved]
private OsuGame? game { get; set; }
public LocalisableString TooltipText => BeatmapOverlayStrings.FeaturedArtistsTooltip;
protected override void LoadComplete()
{
base.LoadComplete();
config.BindWith(OsuSetting.BeatmapListingFeaturedArtistFilter, Active);
disclaimerShown = sessionStatics.GetBindable<bool>(Static.FeaturedArtistDisclaimerShownOnce);
// no need to show the disclaimer if the user already had it toggled off in config.
if (!Active.Value)
disclaimerShown.Value = true;
if (game?.HideUnlicensedContent == true)
{
Enabled.Value = false;
Active.Disabled = true;
}
}
protected override Color4 ColourNormal => colours.Orange1;
@ -143,6 +163,9 @@ namespace osu.Game.Overlays.BeatmapListing
protected override bool OnClick(ClickEvent e)
{
if (!Enabled.Value)
return true;
if (!disclaimerShown.Value && dialogOverlay != null)
{
dialogOverlay.Push(new FeaturedArtistConfirmDialog(() =>

View File

@ -73,7 +73,10 @@ namespace osu.Game.Overlays.BeatmapListing
private void currentChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
foreach (var c in Children)
c.Active.Value = Current.Contains(c.Value);
{
if (!c.Active.Disabled)
c.Active.Value = Current.Contains(c.Value);
}
}
/// <summary>
@ -100,7 +103,7 @@ namespace osu.Game.Overlays.BeatmapListing
protected partial class MultipleSelectionFilterTabItem : FilterTabItem<T>
{
private Drawable activeContent = null!;
private Container activeContent = null!;
private Circle background = null!;
public MultipleSelectionFilterTabItem(T value)
@ -160,7 +163,9 @@ namespace osu.Game.Overlays.BeatmapListing
{
Color4 colour = Active.Value ? ColourActive : ColourNormal;
if (IsHovered)
if (!Enabled.Value)
colour = colour.Darken(1f);
else if (IsHovered)
colour = Active.Value ? colour.Darken(0.2f) : colour.Lighten(0.2f);
if (Active.Value)

View File

@ -57,7 +57,9 @@ namespace osu.Game.Overlays.BeatmapListing
{
base.LoadComplete();
Enabled.BindValueChanged(_ => UpdateState());
UpdateState();
FinishTransforms(true);
}

View File

@ -17,6 +17,8 @@ namespace osu.iOS
{
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
public override bool HideUnlicensedContent => true;
protected override UpdateManager CreateUpdateManager() => new MobileUpdateNotifier();
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();