mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 13:23:05 +08:00
Merge pull request #27616 from bdach/player-loader-disclaimers-alt
Add inline disclaimer displays on player loader
This commit is contained in:
commit
96ad0d4b54
@ -89,13 +89,18 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
setupUserSettings();
|
setupUserSettings();
|
||||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new LoadBlockingTestPlayer { BlockLoad = true })));
|
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new LoadBlockingTestPlayer { BlockLoad = true })));
|
||||||
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
||||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
AddAssert("Background retained from song select", () =>
|
||||||
AddStep("Trigger background preview", () =>
|
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(playerLoader.ScreenPos);
|
InputManager.MoveMouseTo(playerLoader);
|
||||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
return songSelect.IsBackgroundCurrent();
|
||||||
});
|
});
|
||||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
|
||||||
|
AddUntilStep("Screen is dimmed and blur applied", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||||
|
return songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied();
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||||
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.CheckBackgroundBlur(playerLoader.ExpectedBackgroundBlur));
|
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.CheckBackgroundBlur(playerLoader.ExpectedBackgroundBlur));
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
@ -36,7 +37,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private TestPlayerLoader loader;
|
private TestPlayerLoader loader;
|
||||||
private TestPlayer player;
|
private TestPlayer player;
|
||||||
|
|
||||||
private bool epilepsyWarning;
|
private bool? epilepsyWarning;
|
||||||
|
private BeatmapOnlineStatus? onlineStatus;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
@ -81,7 +83,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() => player = null);
|
public void Setup() => Schedule(() =>
|
||||||
|
{
|
||||||
|
player = null;
|
||||||
|
epilepsyWarning = null;
|
||||||
|
onlineStatus = null;
|
||||||
|
});
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
@ -118,8 +125,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
// Add intro time to test quick retry skipping (TestQuickRetry).
|
// Add intro time to test quick retry skipping (TestQuickRetry).
|
||||||
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
||||||
|
|
||||||
// Turn on epilepsy warning to test warning display (TestEpilepsyWarning).
|
// Set up data for testing disclaimer display.
|
||||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning ?? false;
|
||||||
|
workingBeatmap.BeatmapInfo.Status = onlineStatus ?? BeatmapOnlineStatus.Ranked;
|
||||||
|
|
||||||
Beatmap.Value = workingBeatmap;
|
Beatmap.Value = workingBeatmap;
|
||||||
|
|
||||||
@ -334,13 +342,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => (getWarning() != null) == warning);
|
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(warning ? 1 : 0));
|
||||||
|
|
||||||
if (warning)
|
|
||||||
{
|
|
||||||
AddUntilStep("sound volume decreased", () => Beatmap.Value.Track.AggregateVolume.Value == 0.25);
|
|
||||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
@ -357,30 +359,45 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddUntilStep("epilepsy warning absent", () => getWarning() == null);
|
AddUntilStep("epilepsy warning absent", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Single().Alpha, () => Is.Zero);
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(BeatmapOnlineStatus.Loved, 1)]
|
||||||
public void TestEpilepsyWarningEarlyExit()
|
[TestCase(BeatmapOnlineStatus.Qualified, 1)]
|
||||||
|
[TestCase(BeatmapOnlineStatus.Graveyard, 0)]
|
||||||
|
public void TestStatusWarning(BeatmapOnlineStatus status, int expectedDisclaimerCount)
|
||||||
{
|
{
|
||||||
saveVolumes();
|
saveVolumes();
|
||||||
setFullVolume();
|
setFullVolume();
|
||||||
|
|
||||||
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
||||||
AddStep("set epilepsy warning", () => epilepsyWarning = true);
|
AddStep("disable epilepsy warning", () => epilepsyWarning = false);
|
||||||
|
AddStep("set beatmap status", () => onlineStatus = status);
|
||||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddUntilStep("wait for epilepsy warning", () => getWarning().Alpha > 0);
|
AddAssert($"disclaimer count is {expectedDisclaimerCount}", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(expectedDisclaimerCount));
|
||||||
AddUntilStep("warning is shown", () => getWarning().State.Value == Visibility.Visible);
|
|
||||||
|
|
||||||
AddStep("exit early", () => loader.Exit());
|
restoreVolumes();
|
||||||
|
}
|
||||||
|
|
||||||
AddUntilStep("warning is hidden", () => getWarning().State.Value == Visibility.Hidden);
|
[Test]
|
||||||
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
public void TestCombinedWarnings()
|
||||||
|
{
|
||||||
|
saveVolumes();
|
||||||
|
setFullVolume();
|
||||||
|
|
||||||
|
AddStep("enable storyboards", () => config.SetValue(OsuSetting.ShowStoryboard, true));
|
||||||
|
AddStep("disable epilepsy warning", () => epilepsyWarning = true);
|
||||||
|
AddStep("set beatmap status", () => onlineStatus = BeatmapOnlineStatus.Loved);
|
||||||
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
|
||||||
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
|
AddAssert("disclaimer count is 2", () => this.ChildrenOfType<PlayerLoaderDisclaimer>().Count(), () => Is.EqualTo(2));
|
||||||
|
|
||||||
restoreVolumes();
|
restoreVolumes();
|
||||||
}
|
}
|
||||||
@ -479,8 +496,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("click notification", () => notification.TriggerClick());
|
AddStep("click notification", () => notification.TriggerClick());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault(w => w.IsAlive);
|
|
||||||
|
|
||||||
private partial class TestPlayerLoader : PlayerLoader
|
private partial class TestPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||||
|
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
48
osu.Game/Localisation/PlayerLoaderStrings.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// 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 PlayerLoaderStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.PlayerLoader";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap contains scenes with rapidly flashing colours"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString EpilepsyWarningTitle => new TranslatableString(getKey(@"epilepsy_warning_title"), @"This beatmap contains scenes with rapidly flashing colours");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Please take caution if you are affected by epilepsy."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString EpilepsyWarningContent => new TranslatableString(getKey(@"epilepsy_warning_content"), @"Please take caution if you are affected by epilepsy.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap is loved"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LovedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"loved_beatmap_disclaimer_title"), @"This beatmap is loved");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "No performance points will be awarded.
|
||||||
|
/// Leaderboards may be reset by the beatmap creator."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LovedBeatmapDisclaimerContent => new TranslatableString(getKey(@"loved_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||||
|
Leaderboards may be reset by the beatmap creator.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This beatmap is qualified"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString QualifiedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_title"), @"This beatmap is qualified");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "No performance points will be awarded.
|
||||||
|
/// Leaderboards will be reset when the beatmap is ranked."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString QualifiedBeatmapDisclaimerContent => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_content"), @"No performance points will be awarded.
|
||||||
|
Leaderboards will be reset when the beatmap is ranked.");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -1,102 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
|
||||||
{
|
|
||||||
public partial class EpilepsyWarning : VisibilityContainer
|
|
||||||
{
|
|
||||||
public const double FADE_DURATION = 250;
|
|
||||||
|
|
||||||
public EpilepsyWarning()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Alpha = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BackgroundScreenBeatmap dimmableBackground;
|
|
||||||
|
|
||||||
public BackgroundScreenBeatmap DimmableBackground
|
|
||||||
{
|
|
||||||
get => dimmableBackground;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
dimmableBackground = value;
|
|
||||||
|
|
||||||
if (IsLoaded)
|
|
||||||
updateBackgroundFade();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Colour = colours.Yellow,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Icon = FontAwesome.Solid.ExclamationTriangle,
|
|
||||||
Size = new Vector2(50),
|
|
||||||
},
|
|
||||||
new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 25))
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
TextAnchor = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}.With(tfc =>
|
|
||||||
{
|
|
||||||
tfc.AddText("This beatmap contains scenes with ");
|
|
||||||
tfc.AddText("rapidly flashing colours", s =>
|
|
||||||
{
|
|
||||||
s.Font = s.Font.With(weight: FontWeight.Bold);
|
|
||||||
s.Colour = colours.Yellow;
|
|
||||||
});
|
|
||||||
tfc.AddText(".");
|
|
||||||
|
|
||||||
tfc.NewParagraph();
|
|
||||||
tfc.AddText("Please take caution if you are affected by epilepsy.");
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
|
||||||
{
|
|
||||||
updateBackgroundFade();
|
|
||||||
|
|
||||||
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBackgroundFade()
|
|
||||||
{
|
|
||||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,6 +18,7 @@ using osu.Framework.Threading;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Audio.Effects;
|
using osu.Game.Audio.Effects;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected const double CONTENT_OUT_DURATION = 300;
|
protected const double CONTENT_OUT_DURATION = 300;
|
||||||
|
|
||||||
protected virtual double PlayerPushDelay => 1800;
|
protected virtual double PlayerPushDelay => 1800 + disclaimers.Count * 500;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => hideOverlays;
|
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected Task? DisposalTask { get; private set; }
|
protected Task? DisposalTask { get; private set; }
|
||||||
|
|
||||||
|
private FillFlowContainer disclaimers = null!;
|
||||||
private OsuScrollContainer settingsScroll = null!;
|
private OsuScrollContainer settingsScroll = null!;
|
||||||
|
|
||||||
private Bindable<bool> showStoryboards = null!;
|
private Bindable<bool> showStoryboards = null!;
|
||||||
@ -137,7 +139,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private ScheduledDelegate? scheduledPushPlayer;
|
private ScheduledDelegate? scheduledPushPlayer;
|
||||||
|
|
||||||
private EpilepsyWarning? epilepsyWarning;
|
private PlayerLoaderDisclaimer? epilepsyWarning;
|
||||||
|
|
||||||
private bool quickRestart;
|
private bool quickRestart;
|
||||||
|
|
||||||
@ -188,6 +190,18 @@ namespace osu.Game.Screens.Play
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
disclaimers = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Width = SettingsToolboxGroup.CONTAINER_WIDTH + padding * 2,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
AutoSizeDuration = 250,
|
||||||
|
AutoSizeEasing = Easing.OutQuint,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Padding = new MarginPadding(padding),
|
||||||
|
Spacing = new Vector2(20),
|
||||||
|
},
|
||||||
settingsScroll = new OsuScrollContainer
|
settingsScroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -216,11 +230,18 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||||
{
|
{
|
||||||
AddInternal(epilepsyWarning = new EpilepsyWarning
|
disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer(PlayerLoaderStrings.EpilepsyWarningTitle, PlayerLoaderStrings.EpilepsyWarningContent));
|
||||||
{
|
}
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
switch (Beatmap.Value.BeatmapInfo.Status)
|
||||||
});
|
{
|
||||||
|
case BeatmapOnlineStatus.Loved:
|
||||||
|
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.LovedBeatmapDisclaimerTitle, PlayerLoaderStrings.LovedBeatmapDisclaimerContent));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BeatmapOnlineStatus.Qualified:
|
||||||
|
disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.QualifiedBeatmapDisclaimerTitle, PlayerLoaderStrings.QualifiedBeatmapDisclaimerContent));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +250,9 @@ namespace osu.Game.Screens.Play
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager();
|
||||||
|
|
||||||
|
showStoryboards.BindValueChanged(val => epilepsyWarning?.FadeTo(val.NewValue ? 1 : 0, 250, Easing.OutQuint), true);
|
||||||
|
epilepsyWarning?.FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Screen handling
|
#region Screen handling
|
||||||
@ -237,22 +261,18 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.OnEntering(e);
|
base.OnEntering(e);
|
||||||
|
|
||||||
ApplyToBackground(b =>
|
|
||||||
{
|
|
||||||
if (epilepsyWarning != null)
|
|
||||||
epilepsyWarning.DimmableBackground = b;
|
|
||||||
});
|
|
||||||
|
|
||||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
// Start off-screen.
|
// Start side content off-screen.
|
||||||
|
disclaimers.MoveToX(-disclaimers.DrawWidth);
|
||||||
settingsScroll.MoveToX(settingsScroll.DrawWidth);
|
settingsScroll.MoveToX(settingsScroll.DrawWidth);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
|
|
||||||
contentIn();
|
const double metadata_delay = 500;
|
||||||
|
|
||||||
MetadataInfo.Delay(750).FadeIn(500, Easing.OutQuint);
|
MetadataInfo.Delay(metadata_delay).FadeIn(500, Easing.OutQuint);
|
||||||
|
contentIn(metadata_delay + 250);
|
||||||
|
|
||||||
// after an initial delay, start the debounced load check.
|
// after an initial delay, start the debounced load check.
|
||||||
// this will continue to execute even after resuming back on restart.
|
// this will continue to execute even after resuming back on restart.
|
||||||
@ -301,9 +321,6 @@ namespace osu.Game.Screens.Play
|
|||||||
cancelLoad();
|
cancelLoad();
|
||||||
ContentOut();
|
ContentOut();
|
||||||
|
|
||||||
// If the load sequence was interrupted, the epilepsy warning may already be displayed (or in the process of being displayed).
|
|
||||||
epilepsyWarning?.Hide();
|
|
||||||
|
|
||||||
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||||
this.Delay(CONTENT_OUT_DURATION).FadeOut();
|
this.Delay(CONTENT_OUT_DURATION).FadeOut();
|
||||||
|
|
||||||
@ -333,7 +350,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
content.StartTracking(logo, resuming ? 0 : 500, Easing.InOutExpo);
|
content.StartTracking(logo, resuming ? 0 : 500, Easing.InOutExpo);
|
||||||
}, resuming ? 0 : 500);
|
}, resuming ? 0 : 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoExiting(OsuLogo logo)
|
protected override void LogoExiting(OsuLogo logo)
|
||||||
@ -426,15 +443,21 @@ namespace osu.Game.Screens.Play
|
|||||||
this.MakeCurrent();
|
this.MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contentIn()
|
private void contentIn(double delayBeforeSideDisplays = 0)
|
||||||
{
|
{
|
||||||
MetadataInfo.Loading = true;
|
MetadataInfo.Loading = true;
|
||||||
|
|
||||||
content.FadeInFromZero(500, Easing.OutQuint);
|
content.FadeInFromZero(500, Easing.OutQuint);
|
||||||
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
||||||
|
|
||||||
settingsScroll.FadeInFromZero(500, Easing.Out)
|
using (BeginDelayedSequence(delayBeforeSideDisplays))
|
||||||
.MoveToX(0, 500, Easing.OutQuint);
|
{
|
||||||
|
settingsScroll.FadeInFromZero(500, Easing.Out)
|
||||||
|
.MoveToX(0, 500, Easing.OutQuint);
|
||||||
|
|
||||||
|
disclaimers.FadeInFromZero(500, Easing.Out)
|
||||||
|
.MoveToX(0, 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
AddRangeInternal(new[]
|
AddRangeInternal(new[]
|
||||||
{
|
{
|
||||||
@ -466,6 +489,8 @@ namespace osu.Game.Screens.Play
|
|||||||
lowPassFilter = null;
|
lowPassFilter = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
disclaimers.FadeOut(CONTENT_OUT_DURATION, Easing.Out)
|
||||||
|
.MoveToX(-disclaimers.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||||
settingsScroll.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint)
|
settingsScroll.FadeOut(CONTENT_OUT_DURATION, Easing.OutQuint)
|
||||||
.MoveToX(settingsScroll.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
.MoveToX(settingsScroll.DrawWidth, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||||
|
|
||||||
@ -503,33 +528,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
TransformSequence<PlayerLoader> pushSequence = this.Delay(0);
|
TransformSequence<PlayerLoader> pushSequence = this.Delay(0);
|
||||||
|
|
||||||
// only show if the warning was created (i.e. the beatmap needs it)
|
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
||||||
// and this is not a restart of the map (the warning expires after first load).
|
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
||||||
//
|
|
||||||
// note the late check of storyboard enable as the user may have just changed it
|
|
||||||
// from the settings on the loader screen.
|
|
||||||
if (epilepsyWarning?.IsAlive == true && showStoryboards.Value)
|
|
||||||
{
|
|
||||||
const double epilepsy_display_length = 3000;
|
|
||||||
|
|
||||||
pushSequence
|
|
||||||
.Delay(CONTENT_OUT_DURATION)
|
|
||||||
.Schedule(() => epilepsyWarning.State.Value = Visibility.Visible)
|
|
||||||
.TransformBindableTo(volumeAdjustment, 0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint)
|
|
||||||
.Delay(epilepsy_display_length)
|
|
||||||
.Schedule(() =>
|
|
||||||
{
|
|
||||||
epilepsyWarning.Hide();
|
|
||||||
epilepsyWarning.Expire();
|
|
||||||
})
|
|
||||||
.Delay(EpilepsyWarning.FADE_DURATION);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
|
||||||
this.TransformBindableTo(volumeAdjustment, 0, CONTENT_OUT_DURATION, Easing.OutCubic);
|
|
||||||
epilepsyWarning?.Expire();
|
|
||||||
}
|
|
||||||
|
|
||||||
pushSequence.Schedule(() =>
|
pushSequence.Schedule(() =>
|
||||||
{
|
{
|
||||||
|
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
107
osu.Game/Screens/Play/PlayerLoaderDisclaimer.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
public partial class PlayerLoaderDisclaimer : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly LocalisableString title;
|
||||||
|
private readonly LocalisableString content;
|
||||||
|
|
||||||
|
private Box background = null!;
|
||||||
|
|
||||||
|
public PlayerLoaderDisclaimer(LocalisableString title, LocalisableString content)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 5;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background4,
|
||||||
|
Alpha = 0.1f,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Width = 7,
|
||||||
|
Height = 15,
|
||||||
|
Margin = new MarginPadding { Top = 2 },
|
||||||
|
Colour = colours.Orange1,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding { Left = 12 },
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 2),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new TextFlowContainer(t => t.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Text = title,
|
||||||
|
},
|
||||||
|
new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 16))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Text = content,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateFadeState();
|
||||||
|
|
||||||
|
// handle hover so that users can hover the disclaimer to delay load if they want to read it.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
updateFadeState();
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFadeState()
|
||||||
|
{
|
||||||
|
// Matches SettingsToolboxGroup
|
||||||
|
background.FadeTo(IsHovered ? 1 : 0.1f, 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user