mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Turn on featured artist filter by default and add disclaimer when toggling for the first time
This commit is contained in:
parent
0763b86236
commit
d2b98b803d
@ -19,6 +19,7 @@ namespace osu.Game.Configuration
|
||||
SetDefault(Static.LoginOverlayDisplayed, false);
|
||||
SetDefault(Static.MutedAudioNotificationShownOnce, false);
|
||||
SetDefault(Static.LowBatteryNotificationShownOnce, false);
|
||||
SetDefault(Static.FeaturedArtistDisclaimerShownOnce, false);
|
||||
SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null);
|
||||
SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||
}
|
||||
@ -42,6 +43,7 @@ namespace osu.Game.Configuration
|
||||
LoginOverlayDisplayed,
|
||||
MutedAudioNotificationShownOnce,
|
||||
LowBatteryNotificationShownOnce,
|
||||
FeaturedArtistDisclaimerShownOnce,
|
||||
|
||||
/// <summary>
|
||||
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
|
||||
@ -53,6 +55,6 @@ namespace osu.Game.Configuration
|
||||
/// The last playback time in milliseconds of a hover sample (from <see cref="HoverSounds"/>).
|
||||
/// Used to debounce hover sounds game-wide to avoid volume saturation, especially in scrolling views with many UI controls like <see cref="SettingsOverlay"/>.
|
||||
/// </summary>
|
||||
LastHoverSoundPlaybackTime
|
||||
LastHoverSoundPlaybackTime,
|
||||
}
|
||||
}
|
||||
|
34
osu.Game/Localisation/BeatmapOverlayStrings.cs
Normal file
34
osu.Game/Localisation/BeatmapOverlayStrings.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public static class BeatmapOverlayStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.BeatmapOverlayStrings";
|
||||
|
||||
/// <summary>
|
||||
/// "User content disclaimer"
|
||||
/// </summary>
|
||||
public static LocalisableString UserContentDisclaimer => new TranslatableString(getKey(@"user_content_disclaimer"), @"User content disclaimer");
|
||||
|
||||
/// <summary>
|
||||
/// "By turning off the "featured artist" filter, all user uploaded content will be displayed.
|
||||
///
|
||||
/// This includes content which may not be correctly licensed for use and as such may not be safe for streaming, sharing, or consumption."
|
||||
/// </summary>
|
||||
public static LocalisableString ByTurningOffTheFeatured => new TranslatableString(getKey(@"by_turning_off_the_featured"),
|
||||
@"By turning off the ""featured artist"" filter, all user uploaded content will be displayed.
|
||||
|
||||
This includes content which may not be correctly licensed for use and as such may not be safe for streaming, sharing, or consumption.");
|
||||
|
||||
/// <summary>
|
||||
/// "I understand"
|
||||
/// </summary>
|
||||
public static LocalisableString Understood => new TranslatableString(getKey(@"understood"), @"I understand");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -3,10 +3,18 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK.Graphics;
|
||||
using CommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
@ -32,6 +40,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
|
||||
private partial class FeaturedArtistsTabItem : MultipleSelectionFilterTabItem
|
||||
{
|
||||
private Bindable<bool> disclaimerShown;
|
||||
|
||||
public FeaturedArtistsTabItem()
|
||||
: base(SearchGeneral.FeaturedArtists)
|
||||
{
|
||||
@ -40,7 +50,60 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private SessionStatics sessionStatics { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IDialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
protected override Color4 GetStateColour() => colours.Orange1;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
disclaimerShown = sessionStatics.GetBindable<bool>(Static.FeaturedArtistDisclaimerShownOnce);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (!disclaimerShown.Value && dialogOverlay != null)
|
||||
{
|
||||
dialogOverlay.Push(new FeaturedArtistConfirmDialog(() =>
|
||||
{
|
||||
disclaimerShown.Value = true;
|
||||
base.OnClick(e);
|
||||
}));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnClick(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal partial class FeaturedArtistConfirmDialog : PopupDialog
|
||||
{
|
||||
public FeaturedArtistConfirmDialog(Action confirm)
|
||||
{
|
||||
HeaderText = BeatmapOverlayStrings.UserContentDisclaimer;
|
||||
BodyText = BeatmapOverlayStrings.ByTurningOffTheFeatured;
|
||||
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogDangerousButton
|
||||
{
|
||||
Text = BeatmapOverlayStrings.Understood,
|
||||
Action = confirm
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = CommonStrings.ButtonsCancel,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user